:root {
    --bg-color: #f6f8fa;
    --sidebar-bg: #ffffff;
    --main-bg: #f6f8fa;
    --border-color: #d0d7de;
    --grid-line: #e1e4e8;
    --primary-indigo: #10B981;
    /* New Emerald Green */
    --header-bg: #ffffff;
    --text-primary: #24292f;
    --text-muted: #57606a;
    --nav-hover: #f3f4f6;
    --nav-active: rgba(16, 185, 129, 0.1);
    --success-green: #059669;
    --error-red: #cf222e;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: 280px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 2rem 1.5rem;
    background: var(--primary-indigo);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.sidebar-header h2 {
    font-size: 1.25rem;
    color: #fff;
    margin-bottom: 0.25rem;
}

.sidebar-header p {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nav-links {
    list-style: none;
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
}

.nav-links li a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: 0.2s;
}

.nav-links li a:hover {
    background: var(--nav-hover);
}

.nav-links li a.active {
    background: var(--nav-active);
    color: var(--primary-indigo);
    border-right: 3px solid var(--primary-indigo);
    font-weight: 600;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
}

.sidebar-footer a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
}

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--main-bg);
}

.main-header {
    padding: 1rem 2rem;
    background: var(--primary-indigo);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.menu-trigger {
    display: none;
    /* Show only on mobile */
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    padding: 0.3rem 0.6rem;
    border-radius: 0;
    cursor: pointer;
}

.header-info h1 {
    font-size: 1.25rem;
    color: #fff;
    margin-bottom: 0.25rem;
}

.btn-fetch {
    background: var(--primary-indigo);
    color: #fff;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 0;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Award Section & Table */
.award-section {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    min-height: 0;
}

.award-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.summary-text {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.table-container {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 0;
    overflow-x: auto;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

th,
td {
    padding: 1rem 1.2rem;
    border: 1px solid var(--grid-line);
    text-align: center;
    font-size: 0.9rem;
}

thead th {
    background: var(--primary-indigo);
    color: #ffffff;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    position: sticky;
    top: 0;
    z-index: 10;
    border-color: rgba(0, 0, 0, 0.1);
}

.time-col {
    background: #fcfcfc;
    color: var(--text-muted);
    font-family: monospace;
    text-align: left;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
}

.col-extra {
    display: none;
}

.show-all .col-extra {
    display: table-cell;
}

/* Voting numbers */
.vote-val {
    font-weight: 600;
}

.vote-delta {
    display: inline-block;
    font-size: 0.75rem;
    padding: 0.1rem 0.4rem;
    background: rgba(45, 164, 78, 0.1);
    color: var(--success-green);
    border-radius: 0;
    margin-left: 0.5rem;
}

.delta-none {
    color: var(--text-muted);
    opacity: 0.5;
}

/* Real-time LIVE row */
.row-realtime {
    background-color: rgba(207, 34, 46, 0.05) !important;
}

.delta-live {
    background: rgba(207, 34, 46, 0.1) !important;
    color: var(--error-red) !important;
}

.row-realtime td {
    border-bottom: 2px solid rgba(207, 34, 46, 0.2);
}

.live-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: var(--error-red);
    border-radius: 50%;
    margin-right: 8px;
    box-shadow: 0 0 0 0 rgba(207, 34, 46, 0.4);
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(207, 34, 46, 0.4);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(207, 34, 46, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(207, 34, 46, 0);
    }
}

/* Dropdown & Stats Toggle */
.dropdown {
    position: relative;
    display: inline-block;
}

.btn-stats-toggle {
    background: var(--primary-indigo);
    border: 1px solid var(--primary-indigo);
    color: #ffffff;
    padding: 0.5rem 0.8rem;
    border-radius: 0;
    font-size: 0.8rem;
    cursor: pointer;
    transition: 0.2s;
    font-weight: 500;
}

.btn-stats-toggle:hover {
    background: #059669;
    border-color: #059669;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #ffffff;
    min-width: 180px;
    box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.1);
    z-index: 100;
    border: 1px solid var(--border-color);
    border-radius: 0;
    margin-top: 5px;
    overflow: hidden;
}

.dropdown-content a {
    color: var(--text-primary);
    padding: 10px 15px;
    text-decoration: none;
    display: block;
    font-size: 0.85rem;
    transition: 0.2s;
}

.dropdown-content a:hover {
    background-color: #f3f4f6;
    color: var(--primary-indigo);
}

.dropdown-content.show {
    display: block;
}

/* Responsive adjustments */
@media (max-width: 992px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.3);
        backdrop-filter: blur(2px);
        z-index: 999;
    }

    .sidebar-overlay.active {
        display: block;
    }

    .menu-trigger {
        display: block;
        padding: 0.35rem 0.75rem;
        font-size: 0.85rem;
        margin-right: 0.5rem;
    }

    .main-header {
        padding: 0.75rem 1rem;
    }

    .award-section {
        padding: 1rem 0;
    }

    .table-container {
        border-radius: 0;
        border-right: none;
        border-left: none;
    }

    .award-controls {
        padding: 0 1rem;
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    /* Mobile Table Optimization */
    th,
    td {
        padding: 0.6rem 0.4rem;
        font-size: 0.75rem;
    }

    .time-col {
        font-size: 0.7rem;
        padding-left: 0.5rem;
        white-space: normal;
        line-height: 1.2;
    }

    .live-dot {
        margin-right: 4px;
    }

    #live-clock {
        display: block !important;
        margin-left: 12px !important;
        font-size: 0.6rem !important;
        color: var(--text-muted);
        margin-top: 2px;
    }

    .vote-val {
        display: block;
        font-size: 0.8rem;
    }

    .vote-delta {
        margin-left: 0;
        margin-top: 2px;
        font-size: 0.65rem;
        display: inline-block;
    }

    /* Fix compression when "Show all" is active */
    .show-all table {
        table-layout: auto;
    }

    .show-all th,
    .show-all td {
        min-width: 100px;
    }
}

.btn-toggle-view {
    background: var(--primary-indigo);
    border: 1px solid var(--primary-indigo);
    color: #fff;
    padding: 0.5rem 0.8rem;
    border-radius: 0;
    font-size: 0.8rem;
    cursor: pointer;
    font-weight: 500;
    transition: 0.2s;
}

.btn-toggle-view:hover {
    background: #059669;
}

.btn-toggle-chart {
    background: var(--primary-indigo);
    border: 1px solid var(--primary-indigo);
    color: #ffffff;
    padding: 0.5rem 1.25rem;
    border-radius: 0;
    font-size: 0.8rem;
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s;
}

.btn-toggle-chart:hover {
    background: #059669;
    border-color: #059669;
}

.app-footer {
    padding: 1.5rem;
    text-align: center;
    color: #ffffff;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    font-weight: 500;
    text-transform: uppercase;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    background: var(--primary-indigo);
    flex-shrink: 0;
}