:root {
    /* Color Palette - Light Theme (Ivory) */
    --primary-dark: #2c3e50;
    --primary-medium: #34495e;
    --primary-light: #5d6d7e;
    --bg-ivory: #fffff0;
    --bg-cream: #fdfbf7;
    --bg-warm: #faf8f5;
    --accent-blue: #2980b9;
    --accent-blue-light: #3498db;
    --accent-green: #27ae60;
    --accent-green-light: #2ecc71;
    --accent-orange: #d35400;
    --accent-orange-light: #e67e22;
    --accent-yellow: #d4ac0d;
    --accent-yellow-light: #f4d03f;
    --accent-red: #c0392b;
    --accent-red-light: #e74c3c;
    --text-dark: #2c3e50;
    --text-primary: #34495e;
    --text-secondary: #5d6d7e;
    --text-white: #ffffff;
    --text-light: #ecf0f1;
    --text-muted: #7f8c8d;
    --glass-bg: rgba(44, 62, 80, 0.08);
    --glass-border: rgba(44, 62, 80, 0.15);
    --shadow-light: rgba(0, 0, 0, 0.1);
    --shadow-dark: rgba(0, 0, 0, 0.15);

    /* Box Colors */
    --box-green: linear-gradient(135deg, #27ae60, #2ecc71);
    --box-orange: linear-gradient(135deg, #d35400, #e67e22);
    --box-blue: linear-gradient(135deg, #2980b9, #3498db);
    --box-yellow: linear-gradient(135deg, #d4ac0d, #f4d03f);
    --box-red: linear-gradient(135deg, #a93226, #c0392b);

    /* Table Colors - adjusted for light bg */
    --table-blue-header: #2980b9;
    --table-blue-row: rgba(52, 152, 219, 0.12);
    --table-blue-row-alt: rgba(52, 152, 219, 0.22);
    --table-yellow-header: #b7950b;
    --table-yellow-row: rgba(244, 208, 63, 0.2);
    --table-yellow-row-alt: rgba(244, 208, 63, 0.35);
    --table-red-header: #922b21;
    --table-red-row: rgba(192, 57, 43, 0.12);
    --table-red-row-alt: rgba(192, 57, 43, 0.22);
    --table-orange-header: #FF8C00;
    --table-orange-row: rgba(255, 165, 0, 0.18);
    --table-orange-row-alt: rgba(255, 165, 0, 0.32);

    /* Spacing */
    --spacing-xs: 0.2rem;
    --spacing-sm: 0.4rem;
    --spacing-md: 0.8rem;
    --spacing-lg: 1.2rem;
    --spacing-xl: 1.5rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(160deg, var(--bg-ivory) 0%, var(--bg-cream) 50%, var(--bg-warm) 100%);
    color: var(--text-dark);
    min-height: 100vh;
}

/* Main Container - Full viewport without scroll */
.main-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: var(--spacing-sm) var(--spacing-md);
    overflow: hidden;
}

/* Header Section */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-xs) 0;
    flex-shrink: 0;
}

.logo-container {
    width: 80px;
    height: 80px;
    background: transparent;
    border: none;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.logo-container:hover {
    transform: scale(1.05);
}

.logo-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.logo-placeholder {
    color: var(--text-muted);
    font-size: 0.6rem;
    text-align: center;
}

.header-center {
    text-align: center;
    flex: 1;
}

.header-title {
    font-size: 1.6rem;
    font-weight: 700;
    background: linear-gradient(90deg, var(--accent-blue), var(--primary-dark), var(--accent-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 2px;
    margin-bottom: var(--spacing-xs);
}

.datetime-display {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.datetime-display .date {
    margin-right: var(--spacing-md);
}

.datetime-display .time {
    font-weight: 600;
    color: var(--accent-blue);
}

/* Summary Boxes Section */
.summary-section {
    padding: var(--spacing-xs) 0;
    flex-shrink: 0;
}

.summary-boxes {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: var(--spacing-sm);
}

.summary-box {
    position: relative;
    padding: var(--spacing-sm) var(--spacing-xs);
    border-radius: 10px;
    text-align: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 15px var(--shadow-light);
    transition: all 0.3s ease;
    overflow: hidden;
}

.summary-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: inherit;
    z-index: -1;
}

.summary-box:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px var(--shadow-dark);
}

.summary-box.green {
    background: var(--box-green);
}

.summary-box.orange {
    background: var(--box-orange);
}

.summary-box.blue {
    background: var(--box-blue);
}

.summary-box.yellow {
    background: var(--box-yellow);
}

.summary-box.red {
    background: var(--box-red);
}

.summary-box .medal {
    position: absolute;
    top: 4px;
    right: 6px;
    font-size: 1.1rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.summary-box .label {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-white);
    margin-bottom: 2px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.summary-box .value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-white);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.summary-box.yellow .label,
.summary-box.yellow .value {
    color: #1a1a2e;
    text-shadow: none;
}

/* Tables Section */
.tables-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: var(--spacing-sm) 0;
}

.tables-header {
    display: grid;
    grid-template-columns: 1.3fr 0.7fr;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xs);
}

.tables-header h2 {
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-dark);
    padding: var(--spacing-xs);
    background: rgba(44, 62, 80, 0.1);
    border-radius: 8px;
    backdrop-filter: blur(5px);
}

.tables-container {
    display: grid;
    grid-template-columns: 1.3fr 0.7fr;
    gap: var(--spacing-lg);
    flex: 1;
    min-height: 0;
}

.tables-left,
.tables-right {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    overflow: hidden;
}

.table-wrapper {
    flex: 1;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 10px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(44, 62, 80, 0.12);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    position: relative;
}

.table-medal {
    position: absolute;
    top: 4px;
    left: 6px;
    font-size: 1.2rem;
    z-index: 10;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

/* Shift NO column text to the right in Sales tables to make room for medal */
.tables-left .table-wrapper .table-header-row th:first-child {
    padding-left: 1.5rem;
}

.tables-left .table-wrapper .table-body td:first-child {
    padding-left: 1.5rem;
}

.table-wrapper.blue .table-header-row {
    background: var(--table-blue-header);
}

.table-wrapper.yellow .table-header-row {
    background: var(--table-yellow-header);
}

.table-wrapper.red .table-header-row {
    background: var(--table-red-header);
}

.table-wrapper.orange .table-header-row {
    background: var(--table-orange-header);
}

.table-wrapper.blue .table-body tr:nth-child(odd) {
    background: var(--table-blue-row);
}

.table-wrapper.blue .table-body tr:nth-child(even) {
    background: var(--table-blue-row-alt);
}

.table-wrapper.yellow .table-body tr:nth-child(odd) {
    background: var(--table-yellow-row);
}

.table-wrapper.yellow .table-body tr:nth-child(even) {
    background: var(--table-yellow-row-alt);
}

.table-wrapper.red .table-body tr:nth-child(odd) {
    background: var(--table-red-row);
}

.table-wrapper.red .table-body tr:nth-child(even) {
    background: var(--table-red-row-alt);
}

.table-wrapper.orange .table-body tr:nth-child(odd) {
    background: var(--table-orange-row);
}

.table-wrapper.orange .table-body tr:nth-child(even) {
    background: var(--table-orange-row-alt);
}

.table-wrapper.yellow .table-body td,
.table-wrapper.yellow .table-header-row th {
    color: #1a1a2e;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
}

.table-header-row th {
    padding: var(--spacing-xs) var(--spacing-sm);
    text-align: center;
    font-weight: 600;
    color: var(--text-white);
    text-transform: uppercase;
    font-size: 0.65rem;
    letter-spacing: 0.5px;
}

.table-body td {
    padding: var(--spacing-xs) var(--spacing-sm);
    text-align: center;
    color: var(--text-dark);
    border-bottom: 1px solid rgba(44, 62, 80, 0.1);
    font-size: 0.7rem;
    font-weight: 600;
}

.table-body td.cabang-cell {
    font-weight: 700;
    vertical-align: middle;
    background: rgba(0, 0, 0, 0.1) !important;
}

/* Nama columns - uppercase */
.table-body td.nama-cell,
.tables-left .table-body td:nth-child(3),
.tables-right .table-body td:nth-child(2) {
    text-transform: uppercase;
}

/* Login Button */
.login-section {
    padding: var(--spacing-sm) 0;
    text-align: center;
    flex-shrink: 0;
}

.login-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-xl);
    background: linear-gradient(135deg, var(--accent-blue), var(--primary-light));
    color: var(--text-white);
    border: none;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.4);
    text-decoration: none;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.6);
    background: linear-gradient(135deg, var(--accent-blue-light), var(--accent-blue));
}

.login-btn svg {
    width: 18px;
    height: 18px;
}

/* Scheduled Content Overlay */
.scheduled-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.scheduled-overlay.active {
    display: flex;
}

.scheduled-overlay video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.scheduled-overlay .slideshow-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scheduled-overlay .slideshow-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    opacity: 0;
    position: absolute;
    transition: opacity 1s ease-in-out;
}

.scheduled-overlay .slideshow-container img.active {
    opacity: 1;
}

/* Document Container for PDF */
.scheduled-overlay .document-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

.scheduled-overlay .document-container iframe {
    width: 90%;
    height: 95%;
    border: none;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--glass-border);
    border-radius: 50%;
    border-top-color: var(--accent-blue);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Pulse Animation for values */
@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.value-updated {
    animation: pulse 0.5s ease-in-out;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .header-title {
        font-size: 1.5rem;
    }

    .summary-boxes {
        gap: var(--spacing-sm);
    }

    .summary-box .value {
        font-size: 1.5rem;
    }

    .tables-container {
        gap: var(--spacing-md);
    }
}

@media (max-width: 992px) {
    .main-container {
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
    }

    html,
    body {
        overflow: auto;
    }

    .summary-boxes {
        grid-template-columns: repeat(3, 1fr);
    }

    .summary-boxes .summary-box:nth-child(4),
    .summary-boxes .summary-box:nth-child(5) {
        grid-column: span 1;
    }

    .tables-container {
        grid-template-columns: 1fr;
    }

    .tables-header {
        grid-template-columns: 1fr;
    }

    .tables-header h2:last-child {
        margin-top: var(--spacing-md);
    }
}

@media (max-width: 768px) {
    .header {
        flex-wrap: wrap;
        gap: var(--spacing-sm);
    }

    .logo-container {
        width: 50px;
        height: 50px;
    }

    .header-title {
        font-size: 1.2rem;
    }

    .datetime-display {
        font-size: 0.8rem;
    }

    .summary-boxes {
        grid-template-columns: repeat(2, 1fr);
    }

    .summary-box .value {
        font-size: 1.3rem;
    }

    .data-table {
        font-size: 0.65rem;
    }
}

@media (max-width: 480px) {
    .main-container {
        padding: var(--spacing-xs);
    }

    .summary-boxes {
        grid-template-columns: 1fr;
    }

    .header {
        justify-content: center;
    }

    .logo-container:first-child {
        order: 1;
    }

    .header-center {
        order: 0;
        width: 100%;
        margin-bottom: var(--spacing-sm);
    }

    .logo-container:last-child {
        order: 2;
    }
}