/* =========================================
   Live Dashboard Immersive Overhaul
   Optimized for high-end School Displays
   ========================================= */

:root {
    --live-bg: #0b0d17;
    --live-card-bg: rgba(26, 31, 58, 0.85);
    --live-glass-border: rgba(255, 255, 255, 0.08);
    --live-text: #f8fafc;
    --live-accent-pink: #cf1c5e;
    --live-accent-purple: #71195d;
    --live-neon-green: #22c55e;
    --live-light-blue: #3b82f6;
    --live-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

/* Fullscreen Immersive Mode */
.live-dashboard-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
    background: radial-gradient(circle at 50% 50%, #1c1f3a, #0b0d17) !important;
    overflow-y: auto !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    font-family: 'Tajawal', 'Inter', sans-serif !important;
    color: white;
}

/* Main Content Padding */
.live-dashboard-content-wrap {
    padding: 60px 50px 30px; /* Increased top padding to lower the board start */
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Grade Group Header as per Image */
.grade-group-divider {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(to left, #cf1c5e, #71195d);
    padding: 12px 30px;
    border-radius: 12px;
    margin: 40px 0 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.1);
    animation: slideInDown 0.6s ease-out;
}

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

.grade-group-divider .grade-info-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.grade-group-divider .grade-info-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.grade-class-count {
    background: rgba(255, 255, 255, 0.15);
    padding: 5px 20px;
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 800;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
}

.grade-title-text {
    font-size: 1.8rem;
    font-weight: 900;
    text-shadow: 0 4px 15px rgba(0,0,0,0.4);
    letter-spacing: 0.5px;
}

.grade-number-badge {
    width: 45px;
    height: 45px;
    background: #5b114d;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 950;
    font-size: 1.4rem;
    border: 3px solid rgba(255,255,255,0.25);
    box-shadow: 0 0 15px rgba(0,0,0,0.3);
}

/* Grid Layout */
#live-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
    padding: 10px 0;
}

/* Class Card Redesign - Glassmorphism */
.live-card {
    background: rgba(15, 17, 30, 0.7);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    position: relative;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 15px 35px rgba(0,0,0,0.4);
}

.live-card:hover {
    transform: translateY(-8px) scale(1.02);
    background: rgba(30, 35, 60, 0.85);
    border-color: rgba(255,255,255,0.2);
    box-shadow: 0 25px 60px rgba(0,0,0,0.6);
}

.live-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    padding-bottom: 12px;
}

.live-card .class-name {
    font-size: 2.1rem;
    font-weight: 950;
    color: #f8fafc;
    line-height: 1;
}

.live-card .status-icon {
    font-size: 1.4rem;
    opacity: 0.9;
}

.card-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.subject-row {
    font-size: 1.5rem;
    font-weight: 900;
    line-height: 1.2;
}

.teacher-row {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #94a3b8;
    font-size: 1.1rem;
    font-weight: 700;
}

.teacher-row i {
    opacity: 0.6;
}

/* Status variants */
.live-card.substitute {
    background: rgba(15, 23, 42, 0.8);
    border-bottom: 4px solid #3b82f6;
}

.live-card.vacant {
    background: rgba(15, 17, 30, 0.5);
    opacity: 0.8;
}

/* Footer Ticker as per Image */
.live-dashboard-ticker {
    background: #5b114d;
    padding: 12px 30px;
    display: flex;
    align-items: center;
    gap: 25px;
    border-top: 3px solid #cf1c5e;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.4);
}

.ticker-label {
    background: #fbbf24;
    color: #0b0d17;
    padding: 4px 15px;
    border-radius: 6px;
    font-weight: 900;
    font-size: 0.9rem;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ticker-content {
    flex: 1;
    overflow: hidden;
    position: relative;
    height: 24px;
}

.ticker-scroll {
    position: absolute;
    width: 100%;
    height: 100%;
    margin: 0;
    line-height: 24px;
    text-align: right;
    font-weight: 800;
    color: white;
    transform: translateX(100%);
    animation: tickerAnim 15s linear infinite;
}

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

/* Absolute Footer */
.live-dashboard-footer {
    padding: 8px 30px;
    background: #020617;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: #94a3b8;
}

.footer-live-badge {
    color: #ef4444;
    font-weight: 900;
    display: flex;
    align-items: center;
    gap: 6px;
}

.footer-live-badge::after {
    content: '';
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 10px #ef4444;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 0.4; }
    50% { opacity: 1; }
    100% { opacity: 0.4; }
}

/* Fullscreen/Header integration */
.live-dashboard-fullscreen .live-header-premium {
    display: none;
}

/* Fix Ticker and Footer at the bottom in Full Screen */
.live-dashboard-fullscreen .live-dashboard-ticker {
    position: fixed !important;
    bottom: 34px !important; /* Above the footer */
    left: 0;
    right: 0;
    z-index: 999;
}

.live-dashboard-fullscreen .live-dashboard-footer {
    position: fixed !important;
    bottom: 0 !important;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 34px;
    box-sizing: border-box;
}

/* Add bottom padding so the last row of classes does not hide behind the fixed ticker */
.live-dashboard-fullscreen .live-dashboard-content-wrap {
    padding-bottom: 90px !important; 
}

/* Hide Floating Toolbar in Presentation Mode (Full Screen) */
.live-dashboard-fullscreen .live-toolbar-floating {
    display: none !important;
}

/* Floating Toolbar Overhaul - Shrinked Version */
.live-toolbar-floating {
    position: absolute;
    top: 172px; 
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 6px 18px; /* Reduced from 10px 25px */
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 12px; /* Reduced from 15px */
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    transition: all 0.3s ease;
}

.live-toolbar-floating:hover {
    background: rgba(15, 23, 42, 0.6);
    border-color: rgba(255, 255, 255, 0.2);
}

.live-toolbar-floating select {
    background: rgba(255, 255, 255, 0.05);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='white' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 8px center; /* Nudged left */
    background-size: 16px;
    padding: 6px 12px 6px 30px; /* Reduced padding */
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    font-size: 0.8rem; /* Smaller font */
    font-weight: 700;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 100px; /* Smaller min-width */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.toolbar-section {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-right: 15px;
    border-right: 1px solid rgba(255,255,255,0.1);
    margin-right: 5px;
}

.toolbar-label {
    font-weight: 700;
    color: #94a3b8;
    font-size: 0.8rem;
    white-space: nowrap;
}

.live-toolbar-floating select:hover {
    background: rgba(255, 255, 255, 0.1);
}

.live-toolbar-floating select option {
    background: #1c1f3a;
    color: white;
}

.live-toolbar-floating .fullscreen-btn {
    background: linear-gradient(135deg, var(--live-accent-pink), var(--live-accent-purple));
    color: white;
    border: none;
    padding: 6px 15px; /* Reduced padding */
    border-radius: 6px;
    font-size: 0.8rem; /* Smaller font */
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 15px rgba(207, 28, 94, 0.3);
    transition: all 0.2s ease;
}

.live-toolbar-floating .fullscreen-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(207, 28, 94, 0.5);
}

/* Custom Switch for Auto-Refresh - Resized */
.live-toolbar-floating .switch {
    position: relative;
    display: inline-block;
    width: 32px; /* Reduced */
    height: 16px; /* Reduced */
}

.live-toolbar-floating .switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.live-toolbar-floating .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255,255,255,0.1);
    transition: .4s;
}

.live-toolbar-floating .slider:before {
    position: absolute;
    content: "";
    height: 10px; /* Reduced */
    width: 10px; /* Reduced */
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}

.live-toolbar-floating input:checked + .slider {
    background-color: var(--live-neon-green);
}

.live-toolbar-floating input:checked + .slider:before {
    transform: translateX(16px); /* Adjusted for smaller width */
}

.live-toolbar-floating .slider.round {
    border-radius: 34px;
}

.live-toolbar-floating .slider.round:before {
    border-radius: 50%;
}

/* Responsive */
@media (max-width: 768px) {
    #live-grid-container {
        grid-template-columns: 1fr;
    }
}

/* =========================================
   Live Dashboard Banner - Left Time Block Reorganization
   ========================================= */

/* 1. Vertical Stacking & Alignment */
.live-header-premium .live-header-left {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-end !important; /* Left aligned relative axis in RTL */
    justify-content: center;
    gap: 4px !important;
    margin-right: auto !important; /* Pushes the entire block to the far LEFT edge */
}

/* 2. Clock Scaling (Shrink by 25%) */
.live-header-premium .digital-clock-modern {
    font-size: 1.875rem !important; /* Originally 2.5rem */
    line-height: 1 !important;
    transform: scale(1); /* Reset any accidental transforms */
    white-space: nowrap;
}
.live-header-premium .digital-clock-modern .clock-ampm {
    font-size: 0.8rem !important;
}

/* 3. Timer Styling */
.live-header-premium .live-countdown-timer {
    font-size: 0.85rem !important; /* Smaller than the clock */
    color: #a3e635 !important; /* Phosphorescent Green / Light Yellow blend */
    font-weight: 800 !important;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(163, 230, 53, 0.08); /* Subtle glow background */
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid rgba(163, 230, 53, 0.2);
    box-shadow: 0 0 10px rgba(163, 230, 53, 0.1);
    white-space: nowrap;
}

.live-header-premium .live-countdown-timer i {
    font-size: 0.8rem !important;
    color: inherit;
}

/* =========================================
   Live Dashboard Banner - Optimized Slim Layout
   ========================================= */

/* 1. Shrink Banner Height drastically since Titles are removed */
.live-header-premium {
    padding: 12px 30px !important; /* Slim padding */
    min-height: 60px !important; /* Reduced from default */
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
}

/* 2. Adjust Toolbar Position dynamically (Move it to the right wing inside banner flow instead of absolute!) */
.live-dashboard-container {
    position: relative;
}

/* Revert the floating absolute toolbar to sit inside the header if possible, 
   but since it's outside in HTML, we'll fix it to top left using absolute */
.live-toolbar-floating {
    position: absolute !important;
    top: 20px !important; /* Push it to the top within the banner */
    right: 30px !important; /* Place it on right edge since title is removed */
    left: auto !important;
    transform: none !important;
    margin: 0 !important;
    z-index: 100 !important;
}
