/**
 * RB Matka - Premium Aesthetic Stylesheet
 * Fully custom design featuring:
 * 1. Global design tokens & CSS Custom Properties for Dark/Light Themes
 * 2. Glassmorphism cards & Neon gold gradients
 * 3. Exact custom table layouts with mobile horizontal scrolls
 * 4. Micro-animations, keyframes, toast indicators, and toggle inputs
 */

/* ==========================================================================
   1. Theme Custom Variables & Global Settings
   ========================================================================== */
:root {
    /* Font Stack */
    --font-primary: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    /* Core Transitions */
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);

    /* Colors Shared */
    --color-gold-light: #f1c40f;
    --color-gold: #f39c12;
    --color-gold-dark: #d35400;
    --gold-gradient: linear-gradient(135deg, #f39c12 0%, #f1c40f 100%);
    --gold-glow: 0 0 15px rgba(243, 156, 18, 0.3);

    --color-danger: #e74c3c;
    --color-success: #2ecc71;
    --color-info: #3498db;

    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 8px 16px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 16px 32px rgba(0, 0, 0, 0.15);

    /* Default Theme Variables (Light Theme by Default) */
    --bg-primary: #f7f8fc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #eef2f7;

    --border-color: rgba(0, 0, 0, 0.08);
    --border-highlight: rgba(243, 156, 18, 0.3);

    --text-primary: #2d3436;
    --text-secondary: #636e72;
    --text-muted: #b2bec3;

    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(0, 0, 0, 0.05);

    --table-header-bg: #eef2f7;
    --table-cell-bg: #fffdf5;
    --table-cell-locked: #f1f3f6;
    --table-border: rgba(0, 0, 0, 0.07);
    --table-text-locked: #b2bec3;

    --hover-bg: rgba(0, 0, 0, 0.02);
    --accent-glow: 0 0 25px rgba(243, 156, 18, 0.08);
}

/* Dark Theme */
.dark-theme {
    --bg-primary: #0d0e12;
    --bg-secondary: #161822;
    --bg-tertiary: #1f2232;

    --border-color: rgba(255, 255, 255, 0.08);
    --border-highlight: rgba(243, 156, 18, 0.2);

    --text-primary: #f5f6fa;
    --text-secondary: #a4b0be;
    --text-muted: #747d8c;

    --glass-bg: rgba(22, 24, 34, 0.7);
    --glass-border: rgba(255, 255, 255, 0.05);

    --table-header-bg: #1f2232;
    --table-cell-bg: #1a1c27;
    --table-cell-locked: #13141c;
    --table-border: rgba(255, 255, 255, 0.05);
    --table-text-locked: #475069;

    --hover-bg: rgba(255, 255, 255, 0.03);
    --accent-glow: 0 0 25px rgba(243, 156, 18, 0.15);
}

/* Light Theme */
.light-theme {
    --bg-primary: #f7f8fc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #eef2f7;

    --border-color: rgba(0, 0, 0, 0.08);
    --border-highlight: rgba(243, 156, 18, 0.3);

    --text-primary: #2d3436;
    --text-secondary: #636e72;
    --text-muted: #b2bec3;

    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(0, 0, 0, 0.05);

    --table-header-bg: #eef2f7;
    --table-cell-bg: #fffdf5;
    --table-cell-locked: #f1f3f6;
    --table-border: rgba(0, 0, 0, 0.07);
    --table-text-locked: #b2bec3;

    --hover-bg: rgba(0, 0, 0, 0.02);
    --accent-glow: 0 0 25px rgba(243, 156, 18, 0.08);
}

/* Base resets */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-primary);
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color var(--transition-normal), color var(--transition-normal);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

input:focus,
button:focus,
textarea:focus {
    outline: none;
}

/* ==========================================================================
   2. Shared & Component UI Layouts
   ========================================================================== */
.top-accent-bar {
    height: 4px;
    background: var(--gold-gradient);
    width: 100%;
}

a {
    color: var(--color-gold);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-gold-light);
}

/* Logo and Animation */
.animated-logo {
    color: var(--color-gold);
    text-shadow: var(--gold-glow);
    animation: pulseLogo 3s infinite ease-in-out;
}

@keyframes pulseLogo {

    0%,
    100% {
        transform: scale(1);
        filter: brightness(1);
    }

    50% {
        transform: scale(1.15);
        filter: brightness(1.2);
    }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
}

.btn-primary {
    background: var(--gold-gradient);
    color: #121212;
    box-shadow: var(--gold-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(243, 156, 18, 0.5);
    filter: brightness(1.1);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--hover-bg);
    transform: translateY(-2px);
}

.btn-danger {
    background-color: var(--color-danger);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.btn-success {
    background-color: var(--color-success);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
    box-shadow: 0 4px 12px rgba(46, 204, 113, 0.3);
}

.btn-outline-gold {
    background-color: transparent;
    border: 1.5px solid var(--color-gold);
    color: var(--color-gold);
}

.btn-outline-gold:hover {
    background: var(--gold-gradient);
    color: #121212;
    box-shadow: var(--gold-glow);
    transform: translateY(-2px);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 6px;
}

.btn-lg {
    padding: 12px 28px;
    font-size: 1.05rem;
}

/* Form Groups */
.form-group {
    margin-bottom: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="date"] {
    padding: 12px 14px;
    border-radius: 8px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all var(--transition-fast);
}

.form-group input:focus {
    border-color: var(--color-gold);
    box-shadow: 0 0 8px rgba(243, 156, 18, 0.25);
}

/* ==========================================================================
   3. Public Interface & Responsive Charts (`index.php`)
   ========================================================================== */
.app-header {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 15px 30px;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background-color var(--transition-normal);
}

.header-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-gem {
    font-size: 2.2rem;
}

.brand-details h1 {
    font-size: 1.4rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.5px;
}

.brand-details .sub-logo {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 600;
}

.header-meta {
    display: flex;
    align-items: center;
    gap: 20px;
}

.live-clock-card {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 1px;
}

.clock-pulse {
    color: var(--color-gold);
    animation: clockBlink 1.5s infinite ease-in-out;
}

@keyframes clockBlink {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.4;
        transform: scale(0.9);
    }
}

.theme-toggle-btn {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all var(--transition-fast);
}

.theme-toggle-btn:hover {
    border-color: var(--color-gold);
    color: var(--color-gold);
    transform: rotate(15deg);
}

.dark-theme .icon-sun,
.light-theme .icon-moon {
    display: none;
}

.pulse-glow {
    animation: buttonPulse 0.4s ease-out;
}

@keyframes buttonPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(243, 156, 18, 0.4);
    }

    100% {
        box-shadow: 0 0 0 15px rgba(243, 156, 18, 0);
    }
}

/* Hero Banner */
.hero-banner {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 50px 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -20%;
    width: 140%;
    height: 200%;
    background: radial-gradient(circle, rgba(243, 156, 18, 0.05) 0%, rgba(0, 0, 0, 0) 70%);
    pointer-events: none;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.hero-content h2 {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
    background: var(--gold-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-content p {
    font-size: 1.05rem;
    color: var(--text-secondary);
    margin-bottom: 25px;
    font-weight: 300;
}

.hero-indicators {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.stat-bubble {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    padding: 10px 24px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 120px;
}

.stat-bubble .stat-number {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--color-gold);
}

.stat-bubble .stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
    margin-top: 2px;
    letter-spacing: 1px;
}

/* Public Main Panel Display */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    flex: 1;
    width: 100%;
}

.section-title {
    margin-bottom: 30px;
    text-align: left;
}

.section-title h2 {
    font-size: 1.6rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
}

.title-icon {
    color: var(--color-gold);
}

.title-line {
    width: 60px;
    height: 4px;
    background: var(--gold-gradient);
    border-radius: 2px;
    margin-top: 8px;
}

/* Chart display card */
.charts-display-list {
    display: flex;
    flex-direction: column;
    gap: 16px; /* Greatly reduced gap between cards */
}

.chart-card {
    background-color: var(--bg-secondary);
    border: none;
    border-radius: 12px;
    box-shadow: none;
    overflow: hidden;
    transition: all var(--transition-normal);
}

.chart-card:hover {
    border-color: transparent;
    box-shadow: none;
}

.today-glow {
    border: none;
    box-shadow: none;
}

.chart-card-header {
    background-color: var(--table-header-bg);
    padding: 6px 12px; /* Greatly reduced header padding */
    display: flex;
    justify-content: center;
    align-items: center;
    border-bottom: none;
}

.header-date-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

.calendar-icon {
    color: var(--color-gold);
    font-size: 1rem;
}

.header-date-title h3 {
    font-size: 1rem;
    font-weight: 800;
}

.live-indicator {
    background-color: rgba(46, 204, 113, 0.15);
    color: var(--color-success);
    font-size: 0.75rem;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 30px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.day-label {
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 30px;
}

.ping-dot {
    width: 8px;
    height: 8px;
    background-color: var(--color-success);
    border-radius: 50%;
    display: inline-block;
    animation: pingIndicator 1.5s infinite ease-in-out;
}

@keyframes pingIndicator {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.6);
        opacity: 0.3;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.scroll-helper {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    background-color: var(--bg-primary);
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    transition: opacity var(--transition-fast);
}

.scroll-helper.hide-helper {
    opacity: 0;
    pointer-events: none;
}

.animate-arrow {
    animation: arrowSwipe 1.5s infinite ease-in-out;
}

@keyframes arrowSwipe {

    0%,
    100% {
        transform: translateX(0);
    }

    50% {
        transform: translateX(5px);
    }
}

/* The Beautiful 3x8 Panel Table */
.grid-scroll-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

.panel-grid-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 320px; /* Perfect standard mobile width! No unnecessary scroll */
    table-layout: fixed;
    border: none;
}

/* Setup columns widths: 8 equal columns */
.panel-grid-table colgroup col.data-col {
    width: 12.5%;
}

.panel-grid-table th,
.panel-grid-table td {
    border: none; /* No border! */
    padding: 4px 2px; /* Super tight padding for maximum compactness */
    text-align: center;
    transition: all var(--transition-fast);
}

/* Main Golden Orange Date Header from Image - applied dynamically */
.panel-grid-table thead th {
    background-color: #f39c12;
    background: var(--gold-gradient);
    color: #121212;
    font-weight: 800;
    font-size: 0.7rem; /* Tiny size */
    border-bottom: none;
    height: 24px; /* Shorter height */
    text-transform: capitalize;
}

.panel-grid-table thead th i {
    font-size: 0.65rem;
    opacity: 0.8;
}

/* Cells Styling */
.panel-grid-table td.panel-cell {
    font-size: 0.85rem; /* Shrunk size */
    height: 24px; /* Shorter height */
}

.panel-grid-table td.single-cell {
    font-size: 0.85rem; /* Shrunk size */
    height: 24px; /* Shorter height */
}

/* Active Published Cells (Creamy gold as in attachment) */
.dark-theme .active-cell {
    background-color: rgba(243, 156, 18, 0.08);
}

.light-theme .active-cell {
    background-color: #fffde9;
}

.active-cell:hover {
    background-color: rgba(243, 156, 18, 0.15);
}

.font-bold {
    font-weight: 700;
    color: var(--text-primary);
}

.font-extra-bold {
    font-weight: 800;
    color: var(--color-gold);
    font-size: 0.95rem; /* Shrunk size */
}

/* Locked Cells */
.locked-cell {
    background-color: var(--table-cell-locked);
    color: var(--table-text-locked);
}

.locked-icon {
    font-size: 0.75rem;
    opacity: 0.3;
}

.locked-dash {
    opacity: 0.2;
}

/* Interactive Column Hover Highlight classes added via JS */
.column-highlight {
    background-color: rgba(243, 156, 18, 0.18) !important;
    transform: scale(1.02);
    box-shadow: inset 0 0 0 1px rgba(243, 156, 18, 0.3);
    z-index: 5;
}

.column-highlight-header {
    filter: brightness(1.15);
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.2);
}

/* Redirect Floating Footer Bar */
.admin-redirect-bar {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: 24px 20px;
    margin-top: 60px;
    text-align: center;
}

.redirect-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.redirect-wrapper span {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 300;
}

/* ==========================================================================
   4. Secure Login Styles (`login.php`)
   ========================================================================== */
.login-body {
    background-color: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-wrapper {
    width: 100%;
    max-width: 420px;
    animation: cardEntrance var(--transition-slow) cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cardEntrance {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.96);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.login-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    padding: 40px 30px;
    text-align: center;
}

.login-logo-container {
    margin-bottom: 30px;
}

.admin-icon {
    font-size: 3rem;
    color: var(--color-gold);
    margin-bottom: 12px;
    text-shadow: var(--gold-glow);
}

.login-logo-container h1 {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 4px;
}

.login-logo-container .subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 600;
}

.login-alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 22px;
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
}

.login-alert.danger {
    background-color: rgba(231, 76, 60, 0.15);
    border: 1px solid rgba(231, 76, 60, 0.3);
    color: #ff6b6b;
}

.login-form {
    display: flex;
    flex-direction: column;
}

.login-footer {
    margin-top: 24px;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

.back-link {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.back-link:hover {
    color: var(--color-gold);
}

/* ==========================================================================
   5. Administrative Management Dashboard (`admin.php`)
   ========================================================================== */
.admin-body {
    background-color: var(--bg-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.admin-header {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 24px;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

.gold-icon {
    font-size: 1.8rem;
    color: var(--color-gold);
}

.logo-text h1 {
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.1;
}

.logo-text .badge {
    font-size: 0.65rem;
    color: var(--color-gold);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 1px;
}

.nav-area {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.user-greeting {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.nav-btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition-fast);
}

.nav-btn:hover {
    border-color: var(--color-gold);
    color: var(--color-gold);
}

.nav-btn.danger-btn {
    background-color: rgba(231, 76, 60, 0.1);
    color: #ff6b6b;
    border-color: rgba(231, 76, 60, 0.2);
}

.nav-btn.danger-btn:hover {
    background-color: var(--color-danger);
    color: white;
    border-color: var(--color-danger);
}

/* Administrative layout structure */
.admin-main {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 30px 20px;
    flex: 1;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 30px;
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* Sidebar controls */
.sidebar-panel {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.control-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.control-card h2 {
    font-size: 1.15rem;
    font-weight: 800;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-card h2 i {
    color: var(--color-gold);
}

.control-card .description {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.sidebar-form {
    display: flex;
    flex-direction: column;
}

/* Main Panel for active charts */
.main-panel {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 30px 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    min-height: 500px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
    margin-bottom: 24px;
}

.panel-header h2 {
    font-size: 1.3rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-header h2 i {
    color: var(--color-gold);
}

.count-badge {
    background: var(--gold-gradient);
    color: #121212;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 4px 12px;
    border-radius: 20px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 4rem;
    opacity: 0.15;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.empty-state p {
    font-size: 0.85rem;
    max-width: 320px;
}

/* Admin Grid Card Managers */
.charts-management-list {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.manage-chart-card {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: all var(--transition-normal);
}

.manage-chart-card.save-success-glow {
    box-shadow: 0 0 20px rgba(46, 204, 113, 0.4);
    border-color: var(--color-success);
}

.manage-chart-card.fade-out-card {
    opacity: 0;
    transform: scale(0.95);
    height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin: 0;
    border: none;
    overflow: hidden;
}

.card-header {
    background-color: rgba(0, 0, 0, 0.15);
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.card-date-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.date-icon {
    color: var(--color-gold);
}

.card-date-info h3 {
    font-size: 1.05rem;
    font-weight: 700;
}

.db-date-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: monospace;
    background-color: rgba(0, 0, 0, 0.15);
    padding: 2px 8px;
    border-radius: 4px;
}

/* Administrative Editable Grid Table */
.scrollable-table {
    overflow-x: auto;
    width: 100%;
}

.admin-grid-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 900px;
    table-layout: fixed;
}

/* Fix columns: 1 indent header col + 8 entry cols */
.admin-grid-table colgroup col.header-col {
    width: 150px;
}

.admin-grid-table colgroup col.input-col {
    width: calc((100% - 150px) / 8);
}

.admin-grid-table th,
.admin-grid-table td {
    border: 1px solid var(--table-border);
    padding: 10px;
    text-align: center;
    vertical-align: middle;
}

.admin-grid-table th {
    background-color: rgba(0, 0, 0, 0.1);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
}

.admin-grid-table th.row-header-th {
    width: 150px;
    text-align: left;
    padding-left: 15px;
}

.admin-grid-table td.row-label {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
    font-weight: 700;
    font-size: 0.8rem;
    text-align: left;
    padding-left: 15px;
    width: 150px;
}

.admin-grid-table td.row-label i {
    color: var(--color-gold);
    margin-right: 4px;
}

/* Inputs styling inside cell */
.admin-grid-table td input[type="text"] {
    width: 100%;
    padding: 8px 6px;
    border-radius: 5px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    text-align: center;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all var(--transition-fast);
}

.admin-grid-table td input[type="text"]:focus {
    border-color: var(--color-gold);
    background-color: var(--bg-primary);
    box-shadow: 0 0 5px rgba(243, 156, 18, 0.3);
}

.admin-grid-table td input.time-input {
    font-size: 0.8rem;
}

.admin-grid-table td input.digit3-input {
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 1px;
}

.admin-grid-table td input.digit1-input {
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--color-gold);
}

/* Highlight flashes upon auto-calculating */
.highlight-flash {
    animation: flashGreen 0.8s ease-out;
}

@keyframes flashGreen {
    0% {
        background-color: rgba(46, 204, 113, 0.4);
        border-color: var(--color-success);
        transform: scale(1.08);
    }

    100% {
        background-color: var(--bg-secondary);
        border-color: var(--border-color);
        transform: scale(1);
    }
}

/* Custom Styled Toggle Switches for Publishing */
.toggle-switch {
    position: relative;
    width: 48px;
    height: 24px;
    margin: 0 auto 4px auto;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch label {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    transition: .3s;
    border-radius: 24px;
}

.toggle-switch label:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-muted);
    transition: .3s;
    border-radius: 50%;
}

.toggle-switch input:checked+label {
    background-color: rgba(46, 204, 113, 0.2);
    border-color: var(--color-success);
}

.toggle-switch input:checked+label:before {
    transform: translateX(24px);
    background-color: var(--color-success);
}

.toggle-status-text {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
}

.toggle-status-text.live {
    color: var(--color-success);
}

/* Grid editor footer */
.grid-card-footer {
    background-color: rgba(0, 0, 0, 0.1);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    border-top: 1px solid var(--border-color);
}

.helper-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.helper-text i {
    color: var(--color-gold);
}

/* ==========================================================================
   6. Custom Toast Messaging System & Footers
   ========================================================================== */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 350px;
    width: 100%;
}

.toast {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 16px 20px;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    animation: toastEntrance 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border-left: 4px solid var(--color-gold);
}

.toast.success {
    border-left-color: var(--color-success);
}

.toast.danger {
    border-left-color: var(--color-danger);
}

.toast.info {
    border-left-color: var(--color-info);
}

@keyframes toastEntrance {
    0% {
        transform: translateY(-20px) scale(0.9);
        opacity: 0;
    }

    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.toast.fade-out {
    animation: toastExit 0.4s forwards ease-in;
}

@keyframes toastExit {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }

    100% {
        transform: translateY(-20px) scale(0.9);
        opacity: 0;
    }
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toast-content i {
    font-size: 1.15rem;
}

.toast.success i {
    color: var(--color-success);
}

.toast.danger i {
    color: var(--color-danger);
}

.toast.info i {
    color: var(--color-info);
}

.toast-message {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.toast-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

.toast-close:hover {
    color: var(--text-primary);
}

/* Footers */
.app-footer,
.admin-footer-bar {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 40px 24px;
    font-size: 0.85rem;
    transition: background-color var(--transition-normal);
}

.footer-wrapper {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
}

.footer-disclaimer {
    text-align: left;
    width: 100%;
    line-height: 1.6;
    font-weight: 700;
    /* bold */
    font-size: 0.88rem;
    color: #111111;
    /* dark font */
    margin: 0;
}

.copyright {
    text-align: left;
    width: 100%;
    font-weight: 700;
    /* bold */
    font-size: 0.92rem;
    color: #111111;
    /* dark font */
    margin-top: 8px;
    letter-spacing: 0.3px;
}

/* Dark theme high-contrast overrides */
.dark-theme .footer-disclaimer,
.dark-theme .copyright {
    color: #ffffff;
    /* bright font for dark theme visibility */
}

.admin-footer-bar {
    text-align: center;
    color: var(--text-muted);
    padding: 20px;
}

/* ==========================================================================
   7. Mobile & Media Query Adjustments
   ========================================================================== */
@media (max-width: 768px) {
    .app-header {
        padding: 12px 16px;
    }

    .brand-details h1 {
        font-size: 1.15rem;
    }

    .logo-gem {
        font-size: 1.8rem;
    }

    .live-clock-card {
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    .hero-banner {
        padding: 30px 16px;
    }

    .hero-content h2 {
        font-size: 1.65rem;
    }

    .hero-content p {
        font-size: 0.9rem;
    }

    .main-content {
        padding: 20px 12px;
    }

    .section-title h2 {
        font-size: 1.3rem;
    }

    .chart-card-header {
        padding: 12px 16px;
    }

    .header-date-title h3 {
        font-size: 1rem;
    }

    .admin-header {
        padding: 12px 16px;
    }

    .header-container {
        flex-direction: column;
        align-items: flex-start;
    }

    .nav-area {
        width: 100%;
        justify-content: space-between;
    }

    .control-card {
        padding: 16px;
    }

    .main-panel {
        padding: 16px 10px;
    }

    /* Table Responsive Optimizations for Mobile (No Side-Scrolling!) */
    .grid-scroll-wrapper {
        overflow-x: hidden !important; /* Completely disable side scroll */
    }
    
    .panel-grid-table {
        min-width: 100% !important; /* Force table to fit screen width */
    }

    .panel-grid-table thead th {
        padding: 4px 1px !important;
        font-size: 0.62rem !important;
        height: auto !important;
    }

    .panel-grid-table thead th i {
        display: none !important; /* Hide clock/check icons to save space */
    }

    .time-num {
        display: block !important;
        font-weight: 800;
        font-size: 0.65rem !important;
    }

    .time-ampm {
        display: block !important;
        font-size: 0.52rem !important;
        opacity: 0.8;
    }

    .panel-grid-table td.panel-cell {
        padding: 4px 1px !important;
        font-size: 0.8rem !important;
        height: 24px !important;
    }

    .panel-grid-table td.single-cell {
        padding: 4px 1px !important;
        font-size: 0.8rem !important;
        height: 24px !important;
    }

    .font-extra-bold {
        font-size: 0.85rem !important;
    }

    /* Admin Grid Responsive Optimizations for Mobile (No Side-Scrolling!) */
    .grid-table-container.scrollable-table {
        overflow-x: hidden !important; /* Disable horizontal scroll */
    }

    .admin-grid-table {
        min-width: 100% !important; /* Force table to fit screen */
    }

    /* Column size overrides on mobile */
    .admin-grid-table th.row-header-th {
        width: 65px !important;
        padding-left: 4px !important;
        font-size: 0.65rem !important;
    }

    .admin-grid-table td.row-label {
        width: 65px !important;
        padding-left: 4px !important;
        font-size: 0.6rem !important;
        font-weight: 700 !important;
        word-break: break-word !important; /* Wrap long labels */
        line-height: 1.1 !important;
        background-color: rgba(0, 0, 0, 0.03) !important;
    }

    .admin-grid-table th,
    .admin-grid-table td {
        font-size: 0.65rem !important;
        padding: 4px 1px !important;
    }

    /* Hide the icons inside row labels on mobile to save space */
    .admin-grid-table td.row-label i {
        display: none !important;
    }

    /* Make the text inputs extremely compact and fit the tight cells */
    .admin-grid-table td input[type="text"] {
        padding: 4px 0px !important; /* Zero horizontal padding to maximize text space */
        font-size: 0.85rem !important;
        height: 24px !important;
        border-radius: 4px !important;
        width: 100% !important;
        min-width: 0 !important; /* Force browser to let inputs shrink to table column width */
        box-sizing: border-box !important;
        text-align: center !important;
        font-family: var(--font-primary) !important;
        font-weight: 800 !important;
    }

    .admin-grid-table td input.digit3-input {
        font-size: 0.82rem !important;
        font-weight: 800 !important;
        letter-spacing: 0.2px !important;
    }

    .admin-grid-table td input.digit1-input {
        font-size: 0.82rem !important;
        font-weight: 800 !important;
    }

    /* Make toggle switches smaller on mobile */
    .toggle-switch {
        width: 30px !important;
        height: 15px !important;
        margin: 0 auto !important;
    }

    .toggle-switch label {
        border-radius: 15px !important;
    }

    .toggle-switch label:before {
        height: 9px !important;
        width: 9px !important;
        left: 2px !important;
        bottom: 2px !important;
    }

    .toggle-switch input:checked + label:before {
        transform: translateX(15px) !important;
    }

    .toggle-status-text {
        font-size: 0.48rem !important;
        display: block !important;
        margin-top: 1px !important;
    }

    /* Dashboard structure adjustment for cleaner mobile display */
    .admin-main {
        padding: 10px 8px !important;
    }

    .dashboard-grid {
        gap: 15px !important;
    }

    .main-panel {
        padding: 12px 6px !important;
    }

    .panel-header h2 {
        font-size: 1rem !important;
    }
}