/* === Temp Dashboard CSS === */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Cairo', sans-serif;
    direction: rtl;
    background-color: #18191a;
    color: #e4e6eb;
    -webkit-user-select: none;
    -ms-user-select: none;
    user-select: none;
    min-height: 100vh;
}

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #242526; border-radius: 10px; }
::-webkit-scrollbar-thumb { background: #3b82f6; border-radius: 10px; }

/* === Maintenance Banner === */
#maintenance-banner {
    background: linear-gradient(135deg, #1e3a5f 0%, #0f1f3d 100%);
    border-bottom: 1px solid rgba(59, 130, 246, 0.3);
    padding: 16px 20px 12px;
    position: relative;
    overflow: hidden;
}
#maintenance-banner::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 200%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(59,130,246,0.05), transparent);
    animation: bannerShimmer 3s infinite;
}
@keyframes bannerShimmer {
    0% { transform: translateX(-50%); }
    100% { transform: translateX(50%); }
}
.maintenance-content {
    display: flex;
    align-items: center;
    gap: 16px;
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}
.maintenance-icon {
    width: 48px; height: 48px;
    background: rgba(59,130,246,0.2);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    animation: iconPulse 2s ease-in-out infinite;
}
@keyframes iconPulse {
    0%,100% { transform: scale(1); }
    50% { transform: scale(1.1) rotate(10deg); }
}
.maintenance-icon i { color: #60a5fa; font-size: 22px; }
.maintenance-text h3 { font-size: 15px; font-weight: 700; color: #93c5fd; margin-bottom: 2px; }
.maintenance-text p { font-size: 12px; color: #9ca3af; line-height: 1.5; }
.maintenance-progress {
    max-width: 800px; margin: 12px auto 0;
    height: 4px; background: rgba(255,255,255,0.1);
    border-radius: 4px; overflow: hidden;
    position: relative; z-index: 1;
}
.maintenance-progress-bar {
    height: 100%; width: 30%;
    background: linear-gradient(90deg, #3b82f6, #60a5fa, #93c5fd, #60a5fa, #3b82f6);
    background-size: 200% 100%;
    border-radius: 4px;
    animation: progressMove 2s ease-in-out infinite, progressShine 1.5s linear infinite;
}
@keyframes progressMove {
    0% { width: 15%; margin-right: 0; }
    50% { width: 45%; margin-right: 30%; }
    100% { width: 15%; margin-right: 85%; }
}
@keyframes progressShine {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* === Header === */
.main-header {
    background-color: #242526;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    padding: 12px 20px;
    position: sticky; top: 0; z-index: 50;
}
.header-container {
    max-width: 1200px; margin: 0 auto;
    display: flex; align-items: center; justify-content: space-between;
}
.header-right { display: flex; align-items: center; gap: 10px; }
.header-logo { width: 40px; height: 40px; border-radius: 30%; }
.header-title { font-size: 20px; font-weight: 700; color: #e4e6eb; display: flex; align-items: center; gap: 8px; }
.temp-badge {
    font-size: 10px; background: #ef4444; color: white;
    padding: 2px 8px; border-radius: 20px; font-weight: 600;
    animation: badgePulse 2s ease-in-out infinite;
}
@keyframes badgePulse { 0%,100% { opacity: 1; } 50% { opacity: 0.6; } }
.header-left { display: flex; align-items: center; gap: 10px; }
#selected-grade-text {
    background: #3a3b3c; padding: 6px 14px; border-radius: 20px;
    font-size: 13px; font-weight: 600; color: #93c5fd;
}
.reset-btn {
    background: #3a3b3c; border: none; color: #9ca3af;
    width: 34px; height: 34px; border-radius: 50%;
    cursor: pointer; transition: all 0.2s; display: flex;
    align-items: center; justify-content: center; font-size: 14px;
}
.reset-btn:hover { background: #4e4f50; color: #60a5fa; }

/* === Main Content === */
.main-content { max-width: 1200px; margin: 0 auto; padding: 24px 16px; }
.section-title { text-align: center; font-size: 26px; font-weight: 800; color: #e4e6eb; margin-bottom: 8px; }
.section-subtitle { text-align: center; font-size: 14px; color: #9ca3af; margin-bottom: 32px; }

/* === Grade Cards === */
.grades-grid {
    display: grid; grid-template-columns: repeat(2, 1fr);
    gap: 20px; max-width: 700px; margin: 0 auto;
}
@media (max-width: 500px) { .grades-grid { grid-template-columns: 1fr; max-width: 360px; } }
.grade-card {
    position: relative; border-radius: 16px; overflow: hidden;
    cursor: pointer; transition: all 0.3s;
    border: 2px solid transparent; min-height: 200px;
}
.grade-card:hover { transform: translateY(-6px); border-color: rgba(255,255,255,0.2); }
.grade-card:active { transform: scale(0.97); }
.grade-card-bg { position: absolute; inset: 0; opacity: 0.85; }
.grade-card-content {
    position: relative; z-index: 2; padding: 28px 24px;
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; height: 100%; text-align: center;
}
.grade-number {
    font-size: 52px; font-weight: 800; color: rgba(255,255,255,0.9);
    line-height: 1; margin-bottom: 8px;
    text-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.grade-card h3 { font-size: 22px; font-weight: 700; color: white; margin-bottom: 4px; text-shadow: 0 2px 8px rgba(0,0,0,0.3); }
.grade-card p { font-size: 13px; color: rgba(255,255,255,0.8); }

/* === Subjects Grid === */
.subjects-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px; max-width: 1200px; margin: 0 auto;
}
.subject-card {
    background-color: #3a3b3c; border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    padding: 16px; text-align: center; cursor: pointer;
    transition: all 0.3s ease-in-out; border: 1px solid #6b7280;
    display: flex; flex-direction: column; justify-content: flex-end;
    align-items: center; position: relative; overflow: hidden;
    height: 12rem;
}
.subject-card:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    border-color: #3b82f6; transform: scale(1.03);
}
.subject-card .subject-img {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: cover; z-index: 0; border-radius: 12px;
}
.subject-card h3 {
    font-size: 1.25rem; font-weight: 700; color: white;
    margin-bottom: 0.25rem; z-index: 10; position: relative;
    text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.8);
}
.subject-card p {
    color: #d1d5db; font-size: 0.875rem; z-index: 10;
    position: relative; margin-bottom: 0;
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.8);
}
.subject-card::before {
    content: ''; position: absolute; inset: 0;
    background-image: linear-gradient(to top, black, rgba(0, 0, 0, 0.6), transparent);
    z-index: 5; border-radius: 12px; opacity: 0.9;
}

/* === Back Button === */
.back-btn {
    background: #3a3b3c; color: #e4e6eb; border: 1px solid #4e4f50;
    padding: 8px 16px; border-radius: 8px; font-weight: 600;
    cursor: pointer; transition: all 0.2s; display: inline-flex;
    align-items: center; gap: 8px; margin-bottom: 20px;
    font-family: 'Cairo';
}
.back-btn:hover { background: #4e4f50; color: #60a5fa; }


/* === Videos Grid === */
.videos-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}
@media (max-width: 640px) { .videos-grid { grid-template-columns: 1fr; } }

.video-card {
    background: #242526; border-radius: 12px;
    overflow: hidden; border: 1px solid #3a3b3c;
    transition: all 0.3s; cursor: pointer;
}
.video-card:hover { border-color: #3b82f6; transform: translateY(-4px); box-shadow: 0 8px 25px rgba(0,0,0,0.4); }
.video-thumbnail {
    position: relative; width: 100%; aspect-ratio: 16/9;
    background: #3a3b3c; overflow: hidden;
}
.video-thumbnail img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform 0.3s;
}
.video-card:hover .video-thumbnail img { transform: scale(1.05); }
.play-overlay {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.1);
    transition: background 0.3s;
}
.video-card:hover .play-overlay { background: rgba(0,0,0,0.35); }
.play-overlay i {
    font-size: 48px; color: rgba(255,255,255,0.7);
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5));
    transition: all 0.3s;
}
.video-card:hover .play-overlay i { color: rgba(255,255,255,0.95); transform: scale(1.15); }
.video-info { padding: 14px; }
.video-title { font-size: 15px; font-weight: 700; color: #e4e6eb; margin-bottom: 6px; line-height: 1.5; }
.video-meta { font-size: 12px; color: #8a8d91; display: flex; align-items: center; gap: 6px; }

/* === Video Modal === */
.video-modal {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.95);
    z-index: 9999; display: flex;
    align-items: center; justify-content: center;
    padding: 0;
}
.video-modal-container {
    width: 100%; height: auto;
    background: #000; border-radius: 0;
    overflow: hidden; display: flex; flex-direction: column;
}
@media (min-width: 768px) {
    .video-modal-container { width: 80vw; max-width: 1400px; border-radius: 12px; margin: auto; }
}
.video-modal-header {
    padding: 10px 16px; border-bottom: 1px solid #333;
    display: flex; align-items: center; justify-content: space-between;
    background: #000;
}
.video-modal-title { font-size: 14px; font-weight: 600; color: #e4e6eb; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-left: 12px; }
.video-close-btn {
    color: #9ca3af; font-size: 28px; background: none;
    border: none; cursor: pointer; transition: color 0.2s;
    width: 36px; height: 36px; display: flex;
    align-items: center; justify-content: center;
}
.video-close-btn:hover { color: #ef4444; }

.video-player-wrapper {
    position: relative; width: 100%;
    background: #000; overflow: hidden;
}
.video-player-wrapper #player { width: 100%; }

/* Plyr overrides */
:root {
    --plyr-color-main: #3b82f6;
    --plyr-video-background: #000;
    --plyr-font-family: 'Cairo', sans-serif;
    --plyr-range-thumb-height: 14px;
    --plyr-range-thumb-background: #3b82f6;
    --plyr-range-track-height: 4px;
    --plyr-range-fill-background: #3b82f6;
}
.plyr { border-radius: 0; overflow: hidden; }
.plyr__controls {
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 60%, transparent 100%) !important;
    padding: 15px 10px; z-index: 20 !important; pointer-events: auto !important;
}
.plyr__control--overlaid { background: rgba(59,130,246,0.9) !important; z-index: 25 !important; }
.plyr__control--overlaid:hover { background: rgba(59,130,246,1) !important; transform: scale(1.1); }
.plyr__control { pointer-events: auto !important; }
.plyr__volume, button[data-plyr="mute"] { display: none !important; }
.plyr__time { font-size: 14px; font-weight: 600; color: #e4e6eb !important; }
.plyr__menu__container {
    background: #1a1a1a !important; border: 1px solid #3b82f6;
    border-radius: 10px; z-index: 30 !important;
}
.plyr__menu__container .plyr__control,
.plyr__menu__container [role=menuitemradio] { color: #e4e6eb !important; }
.plyr__menu__container [role=menuitemradio]:hover { background: #3b82f6 !important; }
.plyr__menu__container [role=menuitemradio][aria-checked="true"] { background: rgba(59,130,246,0.3) !important; color: #60a5fa !important; }

/* Video overlay protection */
.plyr__video-wrapper::after {
    content: ''; position: absolute; top: 0; left: 0;
    width: 100%; height: 100%; z-index: 10;
    background: transparent; pointer-events: auto !important;
}
.plyr video { pointer-events: none !important; }
.plyr__video-wrapper { pointer-events: auto !important; }

/* Auto-hide controls */
.plyr--video.plyr--hide-controls .plyr__controls {
    opacity: 0 !important; pointer-events: none !important;
    transform: translateY(100%) !important;
    transition: opacity 0.35s, transform 0.35s !important;
}
.plyr--video .plyr__controls {
    opacity: 1; pointer-events: auto; transform: translateY(0);
    transition: opacity 0.35s, transform 0.35s !important;
}
.plyr--video.plyr--hide-controls .plyr__control--overlaid {
    opacity: 0 !important; transform: scale(0.8) !important;
}

/* Plyr Seek Buttons */
.plyr-ctrl-seek-back, .plyr-ctrl-seek-fwd {
    display: inline-flex !important; align-items: center; justify-content: center;
    position: relative; background: transparent !important; border: none !important;
    color: rgba(255,255,255,0.85) !important; cursor: pointer;
    padding: 7px !important; margin: 0 1px; border-radius: 4px;
    transition: all 0.15s; min-width: 34px; height: 34px; flex-shrink: 0;
}
.plyr-ctrl-seek-back:hover, .plyr-ctrl-seek-fwd:hover { color: #fff !important; background: rgba(255,255,255,0.15) !important; }
.plyr-ctrl-seek-back:active, .plyr-ctrl-seek-fwd:active { color: #60a5fa !important; transform: scale(0.85); }
.plyr-seek-label {
    font-size: 8px; font-weight: 800; position: absolute; bottom: 2px;
    left: 50%; transform: translateX(-50%); pointer-events: none; color: inherit;
}

/* Touch Guard */
.plyr-touch-guard {
    position: absolute; top: 0; left: 0; right: 0; bottom: 48px;
    z-index: 3; background: transparent; cursor: pointer;
}
/* Swipe Indicator */
.swipe-seek-indicator {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%,-50%); z-index: 10;
    pointer-events: none; opacity: 0; transition: opacity 0.2s;
}
.swipe-seek-indicator.active { opacity: 1; }
.swipe-seek-time {
    background: rgba(0,0,0,0.75); backdrop-filter: blur(8px);
    color: #fff; padding: 10px 22px; border-radius: 12px;
    font-size: 14px; text-align: center; min-width: 120px;
}
.swipe-seek-delta { font-size: 18px; font-weight: 700; color: #60a5fa; }
.swipe-seek-position { font-size: 12px; color: #9ca3af; }

@media (max-width: 768px) {
    .plyr-ctrl-seek-back, .plyr-ctrl-seek-fwd { min-width: 38px; height: 38px; }
    .plyr-seek-label { font-size: 9px; }
    .video-modal-container { max-height: 100vh; }
    .video-player-wrapper { max-height: 70vh; }
    .maintenance-content { flex-direction: column; text-align: center; gap: 10px; }
    .maintenance-text h3 { font-size: 14px; }
    .maintenance-text p { font-size: 11px; }
    .section-title { font-size: 22px; }
}

/* === Confirm Modal === */
.confirm-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.85);
    z-index: 10000; display: flex;
    align-items: center; justify-content: center;
    padding: 20px;
}
.confirm-box {
    background: #242526; border-radius: 16px;
    padding: 32px; max-width: 400px; width: 100%;
    text-align: center; border: 1px solid #3a3b3c;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    animation: confirmIn 0.3s ease;
}
@keyframes confirmIn { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.confirm-icon { font-size: 48px; color: #f59e0b; margin-bottom: 16px; }
.confirm-box h3 { font-size: 20px; font-weight: 700; color: #e4e6eb; margin-bottom: 8px; }
.confirm-box p { font-size: 14px; color: #9ca3af; margin-bottom: 24px; }
.confirm-actions { display: flex; gap: 12px; justify-content: center; }
.confirm-btn-yes {
    padding: 10px 28px; border-radius: 10px; border: none;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white; font-weight: 700; font-size: 15px;
    cursor: pointer; transition: all 0.2s; font-family: 'Cairo';
}
.confirm-btn-yes:hover { transform: scale(1.05); box-shadow: 0 4px 15px rgba(59,130,246,0.4); }
.confirm-btn-no {
    padding: 10px 28px; border-radius: 10px; border: 1px solid #4e4f50;
    background: #3a3b3c; color: #e4e6eb; font-weight: 600;
    font-size: 15px; cursor: pointer; transition: all 0.2s; font-family: 'Cairo';
}
.confirm-btn-no:hover { background: #4e4f50; }

/* No videos message */
.no-videos {
    text-align: center; padding: 60px 20px;
    background: #242526; border-radius: 16px;
    border: 1px solid #3a3b3c;
}
.no-videos i { font-size: 56px; color: #4e4f50; margin-bottom: 16px; }
.no-videos p { color: #8a8d91; font-size: 16px; }
