/* ============================================
   OIXLY - Threat Intelligence Platform
   Complete Stylesheet v2.0
   ============================================ */

/* ============================================
   CSS Variables
   ============================================ */
:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #12182b;
    --bg-tertiary: #1a2332;
    --bg-hover: #242d3d;
    
    --cyan: #00fff7;
    --red: #ff003c;
    --yellow: #ffd700;
    --green: #00ff88;
    --orange: #ff8800;
    --purple: #a855f7;
    
    --text-primary: #e0e6f0;
    --text-secondary: #8892a8;
    --text-muted: #5a6478;
    
    --border: #2a3447;
    --border-light: #3a4557;
    
    --font-mono: 'JetBrains Mono', 'Consolas', monospace;
    --font-display: 'Rajdhani', sans-serif;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    
    --glow-cyan: 0 0 20px rgba(0, 255, 247, 0.3);
    --glow-red: 0 0 20px rgba(255, 0, 60, 0.3);
    --glow-green: 0 0 20px rgba(0, 255, 136, 0.3);
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-mono);
    background: linear-gradient(135deg, var(--bg-primary) 0%, #0f1623 100%);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Grid Background */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: 
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 50px 50px;
    opacity: 0.08;
    pointer-events: none;
    z-index: -1;
}

/* Scan Line Animation */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--cyan), transparent);
    animation: scan 4s ease-in-out infinite;
    pointer-events: none;
    z-index: 9999;
    box-shadow: var(--glow-cyan);
}

@keyframes scan {
    0%, 100% { transform: translateY(0); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateY(100vh); opacity: 0; }
}

/* Links */
a {
    color: var(--cyan);
    text-decoration: none;
    transition: opacity 0.2s;
}

a:hover {
    opacity: 0.8;
}

ul {
    list-style: none;
}

/* ============================================
   Header
   ============================================ */
.header {
    background: rgba(18, 24, 43, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 2px solid var(--border);
    padding: 16px 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-md);
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.logo-icon {
    color: var(--red);
    font-size: 24px;
}

.logo-text {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 4px;
    color: var(--cyan);
    text-shadow: var(--glow-cyan);
}

.logo-subtitle {
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--text-secondary);
    width: 100%;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: var(--glow-green);
    animation: pulse 2s ease-in-out infinite;
}

.status-dot.error {
    background: var(--red);
    box-shadow: var(--glow-red);
    animation: none;
}

.status-dot.loading {
    background: var(--yellow);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
    animation: pulse 0.5s ease-in-out infinite;
}

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

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--cyan), #0088cc);
    color: var(--bg-primary);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(0, 255, 247, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--orange), #cc6600);
    color: var(--bg-primary);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(255, 136, 0, 0.4);
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn-ghost:hover {
    border-color: var(--cyan);
    color: var(--cyan);
}

.btn-small {
    padding: 6px 12px;
    font-size: 10px;
}

.btn-full {
    width: 100%;
}

.btn:active {
    transform: translateY(0);
}

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

/* ============================================
   Navigation
   ============================================ */
.nav {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    overflow-x: auto;
}

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

.nav-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.nav-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.2s;
    white-space: nowrap;
}

.nav-btn:hover {
    border-color: var(--cyan);
    color: var(--cyan);
}

.nav-btn.active {
    background: var(--cyan);
    color: var(--bg-primary);
    border-color: var(--cyan);
}

.nav-actions {
    display: flex;
    gap: 8px;
}

/* ============================================
   Layout
   ============================================ */
.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 24px;
}

.layout {
    display: grid;
    grid-template-columns: 240px 1fr 260px;
    gap: 24px;
}

@media (max-width: 1200px) {
    .layout {
        grid-template-columns: 220px 1fr;
    }
    .panel {
        display: none;
    }
}

@media (max-width: 800px) {
    .layout {
        grid-template-columns: 1fr;
    }
    .sidebar {
        display: none;
    }
}

/* ============================================
   Sidebar
   ============================================ */
.sidebar, .panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
}

.sidebar-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--cyan);
    margin-bottom: 12px;
    letter-spacing: 1px;
}

.filter-list {
    list-style: none;
}

.filter-item {
    padding: 8px 12px;
    margin-bottom: 4px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

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

.filter-item.active {
    background: rgba(0, 255, 247, 0.1);
    color: var(--cyan);
    border-left: 2px solid var(--cyan);
    margin-left: -2px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dot-critical { background: var(--red); }
.dot-high { background: var(--orange); }
.dot-medium { background: var(--yellow); }
.dot-low { background: var(--green); }

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
}

.checkbox-wrapper input {
    accent-color: var(--cyan);
    width: 16px;
    height: 16px;
}

.mini-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mini-stat {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.mini-stat:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.mini-stat span:last-child {
    color: var(--cyan);
    font-weight: 600;
}

.text-critical {
    color: var(--red) !important;
}

/* Category Bars */
.category-bars {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.category-bar {
    font-size: 11px;
}

.category-bar-header {
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
    margin-bottom: 4px;
    text-transform: capitalize;
}

.category-bar-track {
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
}

.category-bar-fill {
    height: 100%;
    background: var(--cyan);
    border-radius: 2px;
    transition: width 0.5s ease-out;
}

/* Source List */
.source-list li {
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 11px;
}

.source-list li:last-child {
    border-bottom: none;
}

.info-text {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.6;
}

/* ============================================
   Stats Grid
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

@media (max-width: 600px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--cyan);
}

.stat-card.card-critical {
    border-color: rgba(255, 0, 60, 0.5);
}

.stat-card.card-critical:hover {
    border-color: var(--red);
}

.stat-card.card-high {
    border-color: rgba(255, 136, 0, 0.5);
}

.stat-card.card-high:hover {
    border-color: var(--orange);
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--cyan);
    font-family: var(--font-display);
    line-height: 1;
}

.card-critical .stat-value {
    color: var(--red);
}

.card-high .stat-value {
    color: var(--orange);
}

.stat-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 8px;
}

/* ============================================
   Threats List
   ============================================ */
.threats-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 300px;
}

/* Loading State */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border);
    border-top-color: var(--cyan);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

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

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    color: var(--text-primary);
    margin-bottom: 8px;
}

/* Error State */
.error-state {
    text-align: center;
    padding: 60px 20px;
}

.error-icon {
    font-size: 48px;
    color: var(--red);
    margin-bottom: 16px;
}

.error-message {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* ============================================
   Threat Cards
   ============================================ */
.threat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    position: relative;
    transition: all 0.3s;
    overflow: hidden;
}

.threat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    border-radius: 8px 0 0 8px;
}

.threat-card.severity-critical::before { background: var(--red); }
.threat-card.severity-high::before { background: var(--orange); }
.threat-card.severity-medium::before { background: var(--yellow); }
.threat-card.severity-low::before { background: var(--green); }

.threat-card:hover {
    transform: translateX(4px);
    border-color: var(--cyan);
}

.threat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 12px;
}

.threat-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    word-break: break-word;
}

.threat-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.badge {
    font-size: 10px;
    padding: 4px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.badge-critical {
    background: rgba(255, 0, 60, 0.2);
    color: var(--red);
    border: 1px solid var(--red);
}

.badge-high {
    background: rgba(255, 136, 0, 0.2);
    color: var(--orange);
    border: 1px solid var(--orange);
}

.badge-medium {
    background: rgba(255, 215, 0, 0.2);
    color: var(--yellow);
    border: 1px solid var(--yellow);
}

.badge-low {
    background: rgba(0, 255, 136, 0.2);
    color: var(--green);
    border: 1px solid var(--green);
}

.badge-category {
    background: rgba(0, 255, 247, 0.1);
    color: var(--cyan);
    border: 1px solid var(--border);
}

.threat-description {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 16px;
    word-break: break-word;
}

.threat-indicators {
    background: var(--bg-tertiary);
    border-radius: 4px;
    padding: 12px;
    margin-bottom: 16px;
}

.indicators-label {
    font-size: 10px;
    color: var(--cyan);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.indicators-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.indicator-tag {
    font-size: 10px;
    background: var(--bg-primary);
    padding: 4px 8px;
    border-radius: 4px;
    color: var(--text-secondary);
    word-break: break-all;
    max-width: 100%;
}

.threat-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--text-muted);
    padding-top: 12px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 8px;
}

.source-link {
    color: var(--cyan);
}

.source-link:hover {
    text-decoration: underline;
}

/* ============================================
   Modals
   ============================================ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    cursor: pointer;
}

.modal-content {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg), var(--glow-cyan);
    animation: modalIn 0.3s ease-out;
}

.modal-large {
    max-width: 800px;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-tertiary);
    flex-shrink: 0;
}

.modal-title {
    font-size: 20px;
    font-family: var(--font-display);
    color: var(--cyan);
    font-weight: 700;
}

.modal-close {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 24px;
    width: 40px;
    height: 40px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.modal-close:hover {
    border-color: var(--red);
    color: var(--red);
    background: rgba(255, 0, 60, 0.1);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* Legal Content Styling */
.legal-content section {
    margin-bottom: 24px;
}

.legal-content section:last-child {
    margin-bottom: 0;
}

.legal-content h3 {
    color: var(--cyan);
    font-size: 16px;
    margin-bottom: 12px;
    font-family: var(--font-display);
    font-weight: 600;
}

.legal-content p {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.8;
    margin-bottom: 12px;
}

.legal-content p:last-child {
    margin-bottom: 0;
}

/* About Modal Styling */
.about-hero {
    text-align: center;
    padding: 24px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    margin-bottom: 24px;
}

.about-logo {
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 700;
    color: var(--cyan);
    text-shadow: var(--glow-cyan);
}

.about-tagline {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 8px;
}

.about-sources {
    list-style: none;
    padding: 0;
    margin-top: 12px;
}

.about-sources li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-secondary);
}

.about-sources li:last-child {
    border-bottom: none;
}

.about-sources li strong {
    color: var(--cyan);
}

/* Contact Modal Styling */
.contact-hero {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.8;
}

.contact-link-main {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 24px;
    background: var(--bg-tertiary);
    border: 1px solid var(--cyan);
    border-radius: 12px;
    margin: 20px 0;
    transition: all 0.3s;
}

.contact-link-main:hover {
    background: var(--bg-hover);
    box-shadow: var(--glow-cyan);
    transform: translateY(-2px);
}

.contact-link-main .contact-icon {
    font-size: 32px;
}

.contact-link-main .contact-email {
    font-size: 20px;
    font-weight: 600;
    color: var(--cyan);
}

.contact-note {
    text-align: center;
    padding: 16px;
    color: var(--text-muted);
    font-size: 12px;
}

.contact-note p {
    margin: 0;
}

/* Legal Email Styling */
.contact-section {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.legal-email {
    display: inline-block;
    margin-top: 12px;
    padding: 12px 24px;
    background: var(--bg-tertiary);
    border: 1px solid var(--cyan);
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    color: var(--cyan);
    transition: all 0.3s;
}

.legal-email:hover {
    background: var(--bg-hover);
    box-shadow: var(--glow-cyan);
}

/* ============================================
   Toast Notification
   ============================================ */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--cyan);
    border-radius: 8px;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--glow-cyan), var(--shadow-lg);
    transform: translateX(calc(100% + 24px));
    transition: transform 0.3s ease-out;
    z-index: 2000;
    max-width: 400px;
}

.toast.active {
    transform: translateX(0);
}

.toast.error {
    border-color: var(--red);
    box-shadow: var(--glow-red), var(--shadow-lg);
}

.toast.success {
    border-color: var(--green);
    box-shadow: var(--glow-green), var(--shadow-lg);
}

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.toast-message {
    font-size: 12px;
    line-height: 1.4;
}

/* ============================================
   Footer
   ============================================ */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 40px 24px;
    margin-top: 40px;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 40px;
    align-items: start;
}

@media (max-width: 800px) {
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
}

.footer-brand {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.footer-logo {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    color: var(--cyan);
}

.footer-brand p {
    font-size: 12px;
    color: var(--text-muted);
}

.footer-links {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-links a {
    color: var(--text-secondary);
    font-size: 12px;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--cyan);
    opacity: 1;
}

.footer-info {
    text-align: right;
}

@media (max-width: 800px) {
    .footer-info {
        text-align: center;
    }
}

.footer-info p {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.6;
}

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

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

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

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

/* ============================================
   Utilities
   ============================================ */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* No overflow when modal is open */
body.modal-open {
    overflow: hidden;
}
