/* CSS Variables */
:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-tertiary: #1f2937;
    --bg-card: #1a2332;
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --accent-primary: #3b82f6;
    --accent-secondary: #8b5cf6;
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;
    --border-color: #374151;
    --border-light: #4b5563;
    --glow-primary: rgba(59, 130, 246, 0.3);
    --glow-success: rgba(16, 185, 129, 0.3);
    --glow-warning: rgba(245, 158, 11, 0.3);
    --glow-danger: rgba(239, 68, 68, 0.3);
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* App Container */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1600px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.logo-icon svg {
    width: 28px;
    height: 28px;
}

.logo-text h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-text .tagline {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.built-with {
    font-size: 0.85rem;
    color: var(--accent-primary);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border: 1px solid var(--accent-primary);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.built-with:hover {
    background: var(--accent-primary);
    color: white;
}

.compliance-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--accent-success);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--accent-success);
}

/* Main Content */
.main-content {
    display: flex;
    flex: 1;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
}

.nav-icon {
    font-size: 1.25rem;
}

.sidebar-footer {
    margin-top: auto;
}

.model-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-warning);
}

.status-indicator.loading {
    animation: pulse 1.5s infinite;
}

.status-indicator.ready {
    background: var(--accent-success);
}

.status-indicator.error {
    background: var(--accent-danger);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.legal-notice {
    padding: 1rem;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid var(--accent-warning);
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Content Area */
.content-area {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-header {
    margin-bottom: 2rem;
}

.section-header h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.section-header p {
    color: var(--text-secondary);
}

/* Analysis Container */
.analysis-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

@media (max-width: 1200px) {
    .analysis-container {
        grid-template-columns: 1fr;
    }
}

/* Input Section */
.input-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.input-section label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.input-section textarea {
    width: 100%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    resize: vertical;
    transition: border-color 0.2s ease;
}

.input-section textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.input-section textarea::placeholder {
    color: var(--text-muted);
}

.input-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    justify-content: flex-end;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--glow-primary);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

/* Output Section */
.output-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    min-height: 300px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 250px;
    text-align: center;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

/* Results */
.result-card {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.result-card:last-child {
    margin-bottom: 0;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.result-title {
    font-weight: 600;
    color: var(--text-primary);
}

.result-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--accent-success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--accent-warning);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: var(--accent-danger);
}

.badge-info {
    background: rgba(59, 130, 246, 0.2);
    color: var(--accent-primary);
}

.result-content {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Entity Tags */
.entity-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.entity-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border-radius: 999px;
    font-size: 0.85rem;
    border: 1px solid var(--border-color);
}

.entity-tag.org {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.entity-tag.loc {
    border-color: var(--accent-success);
    color: var(--accent-success);
}

.entity-tag.per {
    border-color: var(--accent-secondary);
    color: var(--accent-secondary);
}

.entity-tag.misc {
    border-color: var(--accent-warning);
    color: var(--accent-warning);
}

/* Sentiment Meter */
.sentiment-meter {
    margin: 1.5rem 0;
}

.meter-bar {
    height: 12px;
    background: linear-gradient(90deg, var(--accent-danger), var(--accent-warning), var(--accent-success));
    border-radius: 999px;
    position: relative;
    margin-bottom: 0.5rem;
}

.meter-indicator {
    position: absolute;
    top: -4px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transform: translateX(-50%);
    box-shadow: var(--shadow-md);
    transition: left 0.5s ease;
}

.meter-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Threat Level */
.threat-level {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
}

.threat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
}

.threat-critical .threat-icon {
    background: rgba(239, 68, 68, 0.2);
    border: 2px solid var(--accent-danger);
}

.threat-high .threat-icon {
    background: rgba(245, 158, 11, 0.2);
    border: 2px solid var(--accent-warning);
}

.threat-medium .threat-icon {
    background: rgba(59, 130, 246, 0.2);
    border: 2px solid var(--accent-primary);
}

.threat-low .threat-icon {
    background: rgba(16, 185, 129, 0.2);
    border: 2px solid var(--accent-success);
}

.threat-info h4 {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.threat-info p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    max-width: 500px;
    width: 90%;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1.25rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-body ul {
    list-style: none;
    margin: 1rem 0;
}

.modal-body li {
    padding: 0.5rem 0;
    color: var(--text-secondary);
}

.modal-body .warning {
    padding: 1rem;
    background: rgba(245, 158, 11, 0.1);
    border-radius: var(--radius-md);
    margin-top: 1rem;
    font-size: 0.85rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

/* Progress Overlay */
.progress-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.progress-overlay.hidden {
    display: none;
}

.progress-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    text-align: center;
    max-width: 400px;
}

.progress-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    margin: 0 auto 1.5rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.progress-card h3 {
    margin-bottom: 0.5rem;
}

.progress-card p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.progress-bar {
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    width: 0%;
    transition: width 0.3s ease;
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        padding: 1rem;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .main-content {
        flex-direction: column;
    }
    
    .content-area {
        padding: 1rem;
    }
    
    .compliance-badge {
        display: none;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}