:root {
    --bg-color: #f4f7f9;
    --text-color: #1a1a2e;
    --card-bg: #ffffff;
    --primary: #002244;
    --accent: #e63946;
    --border: #e1e4e8;
    --muted: #6a737d;
    --timeline-color: #d1d5da;
    --heading-font: 'Merriweather', serif;
    --body-font: 'Inter', sans-serif;
    --title-font: 'Outfit', sans-serif;
}

[data-theme="dark"] {
    --bg-color: #0d1117;
    --text-color: #c9d1d9;
    --card-bg: #161b22;
    --primary: #58a6ff;
    --border: #30363d;
    --muted: #8b949e;
    --timeline-color: #30363d;
}

* { box-sizing: border-box; }
body {
    font-family: var(--body-font);
    background: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    transition: background 0.3s, color 0.3s;
}

h1, h2, h3, h4, .outfit { font-family: var(--heading-font); font-weight: 900; }
.title-font { font-family: var(--title-font); }

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

/* Header */
.main-header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}
.header-container { display: flex; justify-content: space-between; align-items: center; }
.logo { display: flex; align-items: center; gap: 12px; text-decoration: none !important; }
.logo img { max-height: 55px; }
.logo span { background: var(--accent); color: white; padding: 3px 10px; border-radius: 4px; font-size: 13px; font-weight: 900; font-family: var(--title-font); text-transform: uppercase; }

.header-actions { display: flex; align-items: center; gap: 20px; }
.btn-theme {
    background: var(--border);
    border: none;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    transition: all 0.3s ease;
    padding: 0;
    overflow: hidden;
}
.btn-theme:hover { background: var(--primary); color: white; transform: rotate(15deg); }

/* Theme toggle visibility - Fixed logic */
.btn-theme i { font-size: 18px; display: none; }
[data-theme="light"] .btn-theme .theme-icon-dark { display: block; }
[data-theme="dark"] .btn-theme .theme-icon-light { display: block; }

.btn {
    padding: 8px 16px;
    background: var(--primary);
    color: white !important;
    border-radius: 6px;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    text-decoration: none !important;
}

/* Hide long button if requested */
.btn-block { display: block; width: 100%; margin-top: 10px; }

/* Dashboard layout */
.dashboard-grid { display: grid; grid-template-columns: 280px 1fr; gap: 40px; margin-top: 40px; align-items: start; }

.sidebar {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    position: sticky;
    top: 100px;
}
.sidebar nav { display: flex; flex-direction: column; gap: 5px; }
.sidebar a { 
    padding: 12px 15px; 
    border-radius: 8px; 
    font-weight: 600; 
    color: var(--muted); 
    display: flex; 
    align-items: center; 
    gap: 12px;
    font-size: 14px;
    transition: 0.2s;
}
.sidebar a i { width: 20px; text-align: center; font-size: 16px; }
.sidebar a:hover { background: var(--bg-color); color: var(--primary); }
.sidebar a.active { background: var(--primary); color: white !important; box-shadow: 0 4px 10px rgba(0,34,68,0.2); }

.main-content h2 { font-size: 28px; margin-bottom: 25px; display: flex; justify-content: space-between; align-items: center; }

/* Stat Cards */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 40px; }
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}
.stat-card h3 { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px; font-weight: 800; }
.stat-card .value { font-size: 36px; font-weight: 900; color: var(--primary); font-family: var(--title-font); }

/* Table */
table { width: 100%; border-collapse: separate; border-spacing: 0; margin-top: 20px; background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
th, td { padding: 16px; text-align: left; border-bottom: 1px solid var(--border); }
th { background: rgba(0,0,0,0.02); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); font-weight: 800; }
[data-theme="dark"] th { background: rgba(255,255,255,0.02); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(0,0,0,0.01); }

.action-btns { display: flex; gap: 8px; }
.btn-icon-sm { width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; border-radius: 8px; background: var(--bg-color); color: var(--muted); transition: 0.2s; border: none; cursor: pointer; }
.btn-icon-sm:hover { background: var(--primary); color: white; }
.btn-icon-sm.delete:hover { background: var(--accent); }

/* Event Styles */
.event-header { margin-top: 50px; margin-bottom: 40px; border-bottom: 3px solid var(--primary); padding-bottom: 30px; }
.event-header h1 { font-size: 42px; margin: 0 0 15px 0; line-height: 1.1; color: var(--primary); }
.live-indicator { color: var(--accent); font-weight: 900; font-size: 15px; display: flex; align-items: center; gap: 12px; font-family: var(--title-font); text-transform: uppercase; letter-spacing: 1px; margin-left: 2px; }
.live-indicator .dot { width: 10px; height: 10px; background: var(--accent); border-radius: 50%; position: relative; display: inline-block; }
.live-indicator .dot::after { content: ""; position: absolute; top: -5px; left: -5px; right: -5px; bottom: -5px; border-radius: 50%; border: 2px solid var(--accent); animation: pulse-ring 1.5s cubic-bezier(0.215, 0.61, 0.355, 1) infinite; }
@keyframes pulse-ring { 0% { transform: scale(0.33); opacity: 1; } 80%, 100% { transform: scale(1.5); opacity: 0; } }
@keyframes blink { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } }
.live-indicator .dot { animation: blink 1.5s infinite; }

.timeline-container { position: relative; padding-left: 60px; margin-top: 30px; min-height: 100px; }
.timeline-line { position: absolute; left: 25px; top: 10px; bottom: 0; width: 2px; background: var(--timeline-color); }

.update-card {
    position: relative;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 40px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.update-card.pinned { border-left: 5px solid var(--primary); }
.update-card.breaking { border-left: 5px solid var(--accent); }

.timeline-dot {
    position: absolute;
    left: -43px;
    top: 30px;
    width: 16px;
    height: 16px;
    background: var(--bg-color);
    border: 4px solid var(--timeline-color);
    border-radius: 50%;
    z-index: 10;
}
.update-card.pinned .timeline-dot { background: var(--primary); border-color: var(--primary); }
.update-card.breaking .timeline-dot { background: var(--accent); border-color: var(--accent); }

.event-header { margin-bottom: 40px; padding-bottom: 30px; border-bottom: 2px solid var(--border); }
.event-header h1 { font-family: var(--title-font); font-size: 42px; color: var(--primary); margin-bottom: 20px; letter-spacing: -1.5px; font-weight: 800; }

.header-stats { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }

.stat-badge { 
    display: inline-flex; 
    align-items: center; 
    gap: 8px; 
    padding: 6px 16px; 
    border-radius: 50px; 
    font-size: 13px; 
    font-weight: 800; 
    font-family: var(--title-font); 
    background: var(--card-bg);
    border: 1px solid var(--border);
    color: var(--text-color);
    box-shadow: 0 4px 10px rgba(0,0,0,0.04);
}

.stat-badge.live { color: var(--accent); border-color: rgba(255, 71, 87, 0.2); background: rgba(255, 71, 87, 0.05); }
.stat-badge.views { color: var(--muted); }
.stat-badge.views i { color: var(--primary); font-size: 11px; }

.event-desc { font-size: 16px; color: var(--muted); line-height: 1.6; max-width: 800px; margin: 0; }

.update-meta { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.timestamp { font-weight: 800; font-size: 14px; color: var(--text-color); font-family: var(--body-font); }
.utc-time { font-weight: 400; font-size: 12px; color: var(--muted); margin-left: 5px; }
.badge { padding: 3px 8px; border-radius: 4px; font-size: 11px; font-weight: 900; color: white; }
.badge-breaking { background: var(--accent); }
.badge-pinned { background: var(--primary); }

.update-title { font-size: 24px; margin: 0 0 15px 0; line-height: 1.3; }
.update-title a { text-decoration: none; color: inherit; }
.update-title a:hover { color: var(--primary); text-decoration: underline; }

.update-content { font-size: 17px; line-height: 1.6; margin-bottom: 20px; }
.update-images img { width: 100%; border-radius: 8px; margin-top: 15px; }

.update-footer { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--border); padding-top: 15px; margin-top: 15px; }
.author { font-size: 13px; color: var(--muted); font-weight: 600; }
.share-actions { display: flex; gap: 15px; }
.share-actions a, .share-actions button { background: none; border: none; padding: 0; color: var(--muted); font-size: 18px; cursor: pointer; }
.share-actions a:hover, .share-actions button:hover { color: var(--primary); }

/* Highlight Animation */
@keyframes highlightBlink {
    0% { border-color: var(--accent); box-shadow: 0 0 0 0 rgba(230, 57, 70, 0.4); }
    50% { border-color: var(--accent); box-shadow: 0 0 20px 10px rgba(230, 57, 70, 0.2); background-color: rgba(230, 57, 70, 0.05); }
    100% { border-color: var(--border); box-shadow: 0 0 0 0 rgba(230, 57, 70, 0); }
}
.highlight-blink {
    animation: highlightBlink 1s ease-in-out infinite;
    z-index: 100;
}

.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 700; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.form-control { width: 100%; padding: 12px 15px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-color); color: var(--text-color); font-size: 15px; font-family: var(--body-font); }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,34,68,0.1); }

/* Authentication Pages */
.auth-container {
    min-height: calc(100vh - 200px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 0;
}

.auth-box {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.08);
}

.auth-box h2 {
    font-size: 32px;
    margin-bottom: 10px;
    text-align: center;
    color: var(--primary);
}

.auth-box p {
    text-align: center;
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 30px;
}

.auth-box .form-group label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-color);
}

.auth-box .btn {
    height: 50px;
    font-size: 16px;
    margin-top: 10px;
}

.auth-footer {
    margin-top: 25px;
    text-align: center;
    font-size: 14px;
    color: var(--muted);
}

.auth-footer a {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
}

.auth-footer a:hover {
    text-decoration: underline;
}

.alert {
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}
.alert-error {
    background: rgba(230, 57, 70, 0.1);
    color: var(--accent);
    border: 1px solid rgba(230, 57, 70, 0.2);
}
.alert-success {
    background: rgba(40, 167, 69, 0.1);
    color: #28a745;
    border: 1px solid rgba(40, 167, 69, 0.2);
}

@media (max-width: 900px) {
    .dashboard-grid { grid-template-columns: 1fr; gap: 20px; }
    .sidebar { position: static; margin-bottom: 20px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
    /* Container & Layout adjustments */
    .container { padding: 0 15px; }
    
    /* Header optimizations */
    .main-header { padding: 12px 0; }
    .logo img { max-height: 40px; }
    .logo span { font-size: 11px; padding: 2px 6px; }
    .header-actions { gap: 10px; }
    .header-actions .btn { padding: 0 12px; font-size: 13px; }
    
    .event-header { padding-bottom: 20px; margin-bottom: 30px; margin-top: 15px; }
    .event-header h1 { font-size: 32px; letter-spacing: -0.5px; line-height: 1.2; }
    
    /* Stats Bar optimizations */
    .header-stats { flex-wrap: wrap; gap: 8px; }
    .stat-badge { font-size: 12px; padding: 5px 12px; }
    
    /* Timeline Mobile Restructure */
    .timeline-container { padding-left: 30px; margin-top: 20px; }
    .timeline-line { left: 8px; width: 2px; }
    .timeline-dot { left: -29px; top: 25px; width: 14px; height: 14px; border-width: 3px; }
    
    /* Card Restructure for mobile */
    .update-card { 
        padding: 20px 15px; 
        border-radius: 12px; 
        margin-bottom: 25px;
        box-shadow: 0 4px 15px rgba(0,0,0,0.06);
    }
    
    /* Edge-to-edge images on mobile */
    .update-images { margin: 15px -15px; gap: 5px; }
    .update-images img { border-radius: 0; max-height: 350px; }
    
    /* Typography for readability */
    .update-title { font-size: 22px; margin-bottom: 10px; }
    .update-content { font-size: 16px; line-height: 1.5; }
    
    /* Better Touch Targets */
    .share-actions a, .share-actions button {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
    .btn { height: 44px; font-size: 14px; padding: 0 16px; }
    
    /* Embed responsive */
    iframe { max-height: 300px; }
}

@media (max-width: 400px) {
    .stats-grid { grid-template-columns: 1fr; }
    .event-header h1 { font-size: 28px; }
}
