/* ThreatAnalyzer - Modern SOC Dashboard Theme */
/* Design System with Dark/Light Mode Support */

/* ============================================
   CSS CUSTOM PROPERTIES (DESIGN TOKENS)
   ============================================ */

/* Dark Mode (Default) */
:root, [data-theme="dark"] {
    /* Backgrounds */
    --bg-app: #0a0e14;
    --bg-panel: #111820;
    --bg-card: #1a222d;
    --bg-card-hover: #222c3a;
    --bg-input: #0d1218;
    --bg-elevated: #232d3f;
    
    /* Borders */
    --border-subtle: #1e2832;
    --border-default: #2a3644;
    --border-strong: #3d4a5c;
    
    /* Text */
    --text-primary: #e6edf5;
    --text-secondary: #9ba3b0;
    --text-muted: #5c6678;
    --text-inverse: #0a0e14;
    
    /* Accent Colors */
    --accent-primary: #3b82f6;
    --accent-primary-hover: #2563eb;
    --accent-primary-subtle: rgba(59, 130, 246, 0.15);
    
    /* Status Colors */
    --status-success: #10b981;
    --status-success-subtle: rgba(16, 185, 129, 0.15);
    --status-warning: #f59e0b;
    --status-warning-subtle: rgba(245, 158, 11, 0.15);
    --status-danger: #ef4444;
    --status-danger-subtle: rgba(239, 68, 68, 0.15);
    --status-info: #06b6d4;
    --status-info-subtle: rgba(6, 182, 212, 0.15);
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --shadow-glow-blue: 0 0 20px rgba(59, 130, 246, 0.3);
    --shadow-glow-green: 0 0 20px rgba(16, 185, 129, 0.3);
    --shadow-glow-red: 0 0 20px rgba(239, 68, 68, 0.3);
    
    /* Gradients */
    --gradient-header: linear-gradient(135deg, #0f1724 0%, #0a0e14 100%);
    --gradient-card: linear-gradient(180deg, #1a222d 0%, #141b24 100%);
    --gradient-primary: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --gradient-danger: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    --gradient-warning: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

/* Light Mode */
[data-theme="light"] {
    /* Backgrounds */
    --bg-app: #f8fafc;
    --bg-panel: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --bg-input: #f8fafc;
    --bg-elevated: #ffffff;
    
    /* Borders */
    --border-subtle: #e2e8f0;
    --border-default: #cbd5e1;
    --border-strong: #94a3b8;
    
    /* Text */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-inverse: #ffffff;
    
    /* Accent Colors */
    --accent-primary: #2563eb;
    --accent-primary-hover: #1d4ed8;
    --accent-primary-subtle: rgba(37, 99, 235, 0.1);
    
    /* Status Colors */
    --status-success: #059669;
    --status-success-subtle: rgba(5, 150, 105, 0.1);
    --status-warning: #d97706;
    --status-warning-subtle: rgba(217, 119, 6, 0.1);
    --status-danger: #dc2626;
    --status-danger-subtle: rgba(220, 38, 38, 0.1);
    --status-info: #0891b2;
    --status-info-subtle: rgba(8, 145, 178, 0.1);
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.15);
    --shadow-glow-blue: 0 0 20px rgba(37, 99, 235, 0.15);
    --shadow-glow-green: 0 0 20px rgba(5, 150, 105, 0.15);
    --shadow-glow-red: 0 0 20px rgba(220, 38, 38, 0.15);
    
    /* Gradients */
    --gradient-header: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    --gradient-card: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    --gradient-primary: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    --gradient-success: linear-gradient(135deg, #059669 0%, #047857 100());
    --gradient-danger: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    --gradient-warning: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

/* ============================================
   BASE STYLES
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'JetBrains Mono', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-app);
    color: var(--text-primary);
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ============================================
   LAYOUT - MODERN SOC DASHBOARD
   ============================================ */

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.app-header {
    background: var(--gradient-header);
    border-bottom: 1px solid var(--border-subtle);
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
}

.header-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.header-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* API Status Indicators */
.api-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-card);
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
}

.api-status-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--status-danger);
    transition: background-color 0.3s ease;
}

.status-dot.active {
    background: var(--status-success);
    box-shadow: 0 0 8px var(--status-success);
}

/* Theme Toggle */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px;
    background: var(--bg-card);
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-toggle:hover {
    border-color: var(--accent-primary);
}

.theme-toggle-track {
    width: 44px;
    height: 24px;
    background: var(--bg-input);
    border-radius: 12px;
    position: relative;
    transition: background-color 0.3s ease;
}

.theme-toggle-thumb {
    width: 20px;
    height: 20px;
    background: var(--accent-primary);
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: transform 0.3s ease, background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

[data-theme="light"] .theme-toggle-thumb {
    transform: translateX(20px);
}

/* Main Layout */
.app-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.app-sidebar {
    width: 320px;
    background: var(--bg-panel);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-section {
    padding: 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.sidebar-section:last-child {
    border-bottom: none;
    flex: 1;
}

/* IOC Input Card */
.ioc-input-card {
    background: var(--gradient-card);
    border: 1px solid var(--border-default);
    border-radius: 12px;
    padding: 16px;
}

.ioc-input-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.ioc-input-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Mode Toggle */
.mode-toggle-group {
    display: flex;
    background: var(--bg-input);
    border-radius: 8px;
    padding: 4px;
    gap: 4px;
}

.mode-btn {
    flex: 1;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mode-btn.active {
    background: var(--accent-primary-subtle);
    color: var(--accent-primary);
}

/* Form Inputs */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-default);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s ease;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-subtle);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

/* Primary Button */
.btn-primary {
    width: 100%;
    padding: 12px 20px;
    background: var(--gradient-primary);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg), var(--shadow-glow-blue);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Secondary Button */
.btn-secondary {
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-strong);
    color: var(--text-primary);
}

/* Workspace Actions */
.workspace-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 12px;
}

/* Recent Scans */
.recent-card {
    background: var(--gradient-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    overflow: hidden;
}

.recent-header {
    padding: 12px 16px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.recent-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.recent-list {
    max-height: 200px;
    overflow-y: auto;
}

.recent-item {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.recent-item:hover {
    background: var(--bg-card-hover);
}

.recent-item:last-child {
    border-bottom: none;
}

.recent-ioc {
    font-size: 13px;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
}

.recent-type {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    padding: 2px 6px;
    background: var(--bg-input);
    border-radius: 4px;
}

/* Main Content Area */
.app-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-app);
}

/* Tab Navigation */
.tab-navigation {
    display: flex;
    gap: 4px;
    padding: 12px 20px;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border-subtle);
    overflow-x: auto;
}

.tab-item {
    padding: 10px 18px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-item:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.tab-item.active {
    background: var(--accent-primary-subtle);
    color: var(--accent-primary);
}

.tab-item .badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    background: var(--bg-elevated);
    color: var(--text-muted);
}

/* Content Panel */
.content-panel {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.card:hover {
    border-color: var(--border-default);
    box-shadow: var(--shadow-lg);
}

.card-header {
    padding: 16px 20px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-body {
    padding: 20px;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
}

.empty-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-description {
    font-size: 14px;
    max-width: 400px;
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background: var(--status-success-subtle);
    color: var(--status-success);
}

.badge-warning {
    background: var(--status-warning-subtle);
    color: var(--status-warning);
}

.badge-danger {
    background: var(--status-danger-subtle);
    color: var(--status-danger);
}

.badge-info {
    background: var(--status-info-subtle);
    color: var(--status-info);
}

/* Threat Verdict Components */
.verdict-banner {
    padding: 24px;
    border-radius: 16px;
    text-align: center;
    margin-bottom: 24px;
}

.verdict-banner.malicious {
    background: var(--gradient-danger);
    box-shadow: var(--shadow-glow-red);
}

.verdict-banner.suspicious {
    background: var(--gradient-warning);
    box-shadow: var(--shadow-glow-red);
}

.verdict-banner.neutral {
    background: var(--gradient-success);
    box-shadow: var(--shadow-glow-green);
}

.verdict-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0.9;
    margin-bottom: 8px;
}

.verdict-text {
    font-size: 32px;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Signal Cards */
.signal-card {
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 12px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.signal-card.positive {
    background: var(--status-success-subtle);
    border: 1px solid var(--status-success);
}

.signal-card.negative {
    background: var(--status-danger-subtle);
    border: 1px solid var(--status-danger);
}

.signal-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.signal-card.positive .signal-icon {
    background: var(--status-success);
}

.signal-card.negative .signal-icon {
    background: var(--status-danger);
}

.signal-text {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.5;
}

/* Evidence Grid */
.evidence-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.evidence-item {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    transition: all 0.2s ease;
}

.evidence-item:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.evidence-source {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.evidence-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.evidence-detail {
    font-size: 12px;
    font-weight: 500;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

.animate-slide-in {
    animation: slideIn 0.3s ease-out forwards;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-input);
}

::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Responsive */
@media (max-width: 1024px) {
    .app-sidebar {
        width: 280px;
    }
}

@media (max-width: 768px) {
    .app-main {
        flex-direction: column;
    }
    
    .app-sidebar {
        width: 100%;
        max-height: 50vh;
    }
    
    .header-subtitle {
        display: none;
    }
    
    .tab-navigation {
        padding: 8px 12px;
    }
    
    .tab-item {
        padding: 8px 12px;
        font-size: 12px;
    }
}
