/* ============================================
   WAR ANALYTICS 2026 - GLOBAL STYLES
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-dark: #1a1a2e;
    --primary-accent: #667eea;
    --secondary-accent: #764ba2;
    --danger: #ff6b6b;
    --warning: #ffa500;
    --success: #51cf66;
    --info: #4dabf7;
    --light-bg: #f8f9fa;
    --card-bg: #ffffff;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --border-color: #e0e0e0;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.2);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(102, 126, 234, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(118, 75, 162, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* ============================================
   HEADER SECTION
   ============================================ */

.header {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 249, 250, 0.98) 100%);
    border-radius: 12px;
    padding: 40px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.header-content {
    position: relative;
    z-index: 1;
}

.header h1 {
    font-size: 3em;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    letter-spacing: -1px;
}

.header .subtitle {
    font-size: 1.2em;
    color: var(--text-secondary);
    margin-bottom: 25px;
    font-weight: 300;
}

.header-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    padding-top: 25px;
    border-top: 2px solid var(--border-color);
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95em;
    color: var(--text-primary);
}

.meta-item strong {
    font-weight: 600;
    color: var(--primary-accent);
    font-size: 1.1em;
}

/* ============================================
   CONTROL PANEL / FILTERS
   ============================================ */

.control-panel {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-width: 200px;
}

.filter-group label {
    font-weight: 600;
    font-size: 0.9em;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-group select {
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95em;
    background-color: white;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.filter-group select:hover {
    border-color: var(--primary-accent);
}

.filter-group select:focus {
    outline: none;
    border-color: var(--primary-accent);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn-reset {
    padding: 12px 25px;
    background: linear-gradient(135deg, var(--primary-accent) 0%, var(--secondary-accent) 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.95em;
    box-shadow: var(--shadow-sm);
}

.btn-reset:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

/* ============================================
   DASHBOARD GRID & SECTIONS
   ============================================ */

.dashboard-grid {
    display: grid;
    gap: 30px;
    margin-bottom: 40px;
}

.dashboard-section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.dashboard-section:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.dashboard-section h2 {
    font-size: 1.5em;
    margin-bottom: 25px;
    color: var(--text-primary);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dashboard-section.full-width {
    grid-column: 1 / -1;
}

/* ============================================
   METRICS GRID
   ============================================ */

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.metric-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 12px;
    padding: 25px;
    display: flex;
    gap: 20px;
    align-items: center;
    transition: var(--transition);
    border: 1px solid rgba(255, 255, 255, 0.5);
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    opacity: 0;
    transition: var(--transition);
}

.metric-card:nth-child(1) {
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8787 100%);
    color: white;
}

.metric-card:nth-child(2) {
    background: linear-gradient(135deg, #ffa500 0%, #ffb84d 100%);
    color: white;
}

.metric-card:nth-child(3) {
    background: linear-gradient(135deg, #4dabf7 0%, #74c0fc 100%);
    color: white;
}

.metric-card:nth-child(4) {
    background: linear-gradient(135deg, #51cf66 0%, #69db7c 100%);
    color: white;
}

.metric-card:hover::before {
    opacity: 1;
}

.metric-icon {
    font-size: 2.5em;
    line-height: 1;
}

.metric-content {
    flex: 1;
}

.metric-label {
    font-weight: 600;
    font-size: 0.9em;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.metric-value {
    font-size: 2.2em;
    font-weight: 700;
    margin-bottom: 5px;
}

.metric-sublabel {
    font-size: 0.85em;
    opacity: 0.8;
}

/* ============================================
   CHARTS SECTION
   ============================================ */

.chart-container {
    position: relative;
    height: 350px;
    margin-bottom: 20px;
}

canvas {
    max-height: 350px;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 20px;
    padding: 15px;
    background: var(--light-bg);
    border-radius: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
    color: var(--text-secondary);
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

/* ============================================
   HEATMAP SECTION
   ============================================ */

.heatmap-container {
    display: grid;
    gap: 15px;
}

.heatmap-row {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 15px;
    align-items: center;
}

.heatmap-label {
    font-weight: 600;
    color: var(--text-primary);
}

.heatmap-bar-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

.heatmap-bar {
    flex: 1;
    height: 40px;
    border-radius: 6px;
    background: linear-gradient(90deg, #ff6b6b, #ffa500, #51cf66);
    opacity: 0.3;
    position: relative;
    overflow: hidden;
}

.heatmap-bar.high {
    opacity: 0.8;
    background: linear-gradient(90deg, #ff6b6b, #ff8787);
}

.heatmap-bar.medium {
    opacity: 0.6;
    background: linear-gradient(90deg, #ffa500, #ffb84d);
}

.heatmap-bar.low {
    opacity: 0.4;
    background: linear-gradient(90deg, #51cf66, #69db7c);
}

.heatmap-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.heatmap-value {
    min-width: 60px;
    text-align: right;
    font-weight: 600;
    color: var(--text-primary);
}

/* ============================================
   INSIGHTS SECTION
   ============================================ */

.insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.insight-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 12px;
    padding: 25px;
    border-left: 6px solid var(--primary-accent);
    transition: var(--transition);
}

.insight-card:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-md);
}

.insight-card.critical {
    border-left-color: var(--danger);
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.1) 0%, rgba(255, 135, 135, 0.1) 100%);
}

.insight-card.warning {
    border-left-color: var(--warning);
    background: linear-gradient(135deg, rgba(255, 165, 0, 0.1) 0%, rgba(255, 184, 77, 0.1) 100%);
}

.insight-card.info {
    border-left-color: var(--info);
    background: linear-gradient(135deg, rgba(77, 171, 247, 0.1) 0%, rgba(116, 192, 252, 0.1) 100%);
}

.insight-title {
    font-weight: 700;
    font-size: 1.1em;
    color: var(--text-primary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.insight-description {
    color: var(--text-secondary);
    font-size: 0.95em;
    line-height: 1.6;
}

.insight-stat {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    font-size: 0.9em;
    color: var(--text-primary);
}

.insight-stat strong {
    color: var(--primary-accent);
    font-weight: 700;
}

/* ============================================
   NEWS TIMELINE SECTION
   ============================================ */

.timeline-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.btn-small {
    padding: 8px 16px;
    background: var(--light-bg);
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85em;
    transition: var(--transition);
    color: var(--text-primary);
}

.btn-small:hover {
    background: var(--primary-accent);
    color: white;
    border-color: var(--primary-accent);
}

.news-timeline {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.timeline-item {
    background: var(--light-bg);
    border-radius: 10px;
    overflow: hidden;
    transition: var(--transition);
    border-left: 5px solid var(--primary-accent);
    cursor: pointer;
}

.timeline-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateX(5px);
}

.timeline-header {
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
}

.timeline-date {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9em;
}

.timeline-category {
    display: inline-block;
    background: var(--primary-accent);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.timeline-title {
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 10px;
    line-height: 1.5;
}

.timeline-content {
    max-height: 0;
    overflow: hidden;
    transition: var(--transition);
}

.timeline-item.expanded .timeline-content {
    max-height: 300px;
}

.timeline-body {
    padding: 0 20px 20px;
    border-top: 1px solid var(--border-color);
    padding-top: 15px;
    color: var(--text-secondary);
    font-size: 0.95em;
    line-height: 1.6;
}

.timeline-link {
    display: inline-block;
    color: var(--primary-accent);
    text-decoration: none;
    font-weight: 600;
    margin-top: 10px;
    transition: var(--transition);
}

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

/* ============================================
   REFERENCES/ENCYCLOPEDIA SECTION
   ============================================ */

.references-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.reference-card {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 12px;
    padding: 20px;
    transition: var(--transition);
    border: 1px solid rgba(255, 255, 255, 0.3);
    display: flex;
    flex-direction: column;
}

.reference-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.reference-title {
    font-weight: 700;
    font-size: 1.05em;
    color: var(--text-primary);
    margin-bottom: 12px;
    line-height: 1.4;
}

.reference-preview {
    color: var(--text-secondary);
    font-size: 0.9em;
    line-height: 1.6;
    margin-bottom: 15px;
    flex: 1;
    max-height: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reference-meta {
    font-size: 0.85em;
    color: var(--text-secondary);
    margin-bottom: 12px;
    display: flex;
    gap: 15px;
}

.reference-link {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary-accent) 0%, var(--secondary-accent) 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85em;
    transition: var(--transition);
    text-align: center;
    margin-top: auto;
}

.reference-link:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

/* ============================================
   FOOTER
   ============================================ */

.footer {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 249, 250, 0.98) 100%);
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9em;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.footer p {
    margin: 10px 0;
}

.footer p strong {
    color: var(--text-primary);
}

/* ============================================
   LOADING & ERROR STATES
   ============================================ */

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-style: italic;
}

.loading::after {
    content: '.';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60% { content: '...'; }
}

.error {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.1) 0%, rgba(255, 135, 135, 0.1) 100%);
    color: var(--danger);
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    border-left: 5px solid var(--danger);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 1200px) {
    .container {
        padding: 16px;
    }

    .header {
        padding: 30px;
    }

    .header h1 {
        font-size: 2.2em;
    }

    .metrics-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

@media (max-width: 768px) {
    .control-panel {
        flex-direction: column;
    }

    .filter-group {
        min-width: 100%;
    }

    .header {
        padding: 20px;
    }

    .header h1 {
        font-size: 1.8em;
    }

    .header-meta {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .metric-card {
        gap: 15px;
        padding: 20px;
    }

    .metric-icon {
        font-size: 2em;
    }

    .insights-grid {
        grid-template-columns: 1fr;
    }

    .references-container {
        grid-template-columns: 1fr;
    }

    .heatmap-row {
        grid-template-columns: 100px 1fr;
    }

    .chart-container {
        height: 300px;
    }

    canvas {
        max-height: 300px;
    }

    .dashboard-section {
        padding: 20px;
    }

    .dashboard-section h2 {
        font-size: 1.2em;
        margin-bottom: 20px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 12px;
    }

    .header {
        padding: 16px;
    }

    .header h1 {
        font-size: 1.5em;
    }

    .header .subtitle {
        font-size: 0.95em;
    }

    .header-meta {
        grid-template-columns: 1fr;
        gap: 10px;
        font-size: 0.85em;
    }

    .dashboard-section {
        padding: 15px;
    }

    .metric-card {
        gap: 10px;
        padding: 15px;
    }

    .metric-icon {
        font-size: 1.8em;
    }

    .metric-value {
        font-size: 1.8em;
    }

    .timeline-header {
        padding: 12px 15px;
    }

    .control-panel {
        padding: 15px;
        gap: 10px;
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */

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

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.dashboard-section {
    animation: fadeIn 0.6s ease-out;
}

.metric-card {
    animation: slideInLeft 0.6s ease-out;
}

/* ============================================
   SCROLL BAR STYLING
   ============================================ */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--primary-accent);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-accent);
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    body {
        background: white;
    }

    .control-panel {
        display: none;
    }

    .dashboard-section {
        box-shadow: none;
        border: 1px solid #ccc;
        page-break-inside: avoid;
    }
}
