@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800;900&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Tajawal', system-ui, sans-serif; }

*:focus { outline: none !important; }

body { background-color: #020617; color: #f8fafc; overflow: hidden; transition: background-color 0.5s ease-in-out; }

body.TheaterMode { background-color: #000; }

.NavBar { background: rgba(2, 6, 23, 0.85); backdrop-filter: blur(12px); padding: 18px 40px; display: flex; justify-content: center; align-items: center; border-bottom: 1px solid #1e293b; position: sticky; top: 0; z-index: 100; box-shadow: 0 4px 20px rgba(0,0,0,0.4); transition: opacity 0.4s ease-in-out; }

.LogoText { font-size: 28px; font-weight: 900; color: #fff; letter-spacing: -1px; transition: opacity 0.2s ease-in-out; cursor: pointer; }
.LogoText:hover { opacity: 0.8; }
.LogoText span { color: #0ea5e9; }

.AppContainer { display: flex; flex-wrap: wrap; max-width: 1500px; margin: 40px auto; gap: 40px; padding: 0 20px; align-items: flex-start; justify-content: center; position: relative; }

.VideoSection { flex: 1 1 60%; min-width: 60%; max-width: 1000px; display: flex; flex-direction: column; gap: 24px; order: 2; z-index: 50; }

.SidebarPlaylist { flex: 1 1 350px; min-width: 350px; max-width: 420px; background: #0f172a; border-radius: 16px; padding: 25px; height: calc(100vh - 140px); display: flex; flex-direction: column; border: 1px solid #1e293b; position: sticky; top: 100px; box-shadow: 0 10px 25px rgba(0,0,0,0.3); order: 1; z-index: 10; transition: opacity 0.4s ease-in-out; }

@media (max-width: 1050px) {
    .VideoSection { order: 1; max-width: 100%; min-width: 100%; }
    .SidebarPlaylist { order: 2; max-width: 100%; min-width: 100%; height: 500px; position: static; }
}

.PlayerWrapper { position: relative; width: 100%; background: #000; border-radius: 16px; overflow: hidden; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.6); aspect-ratio: 16/9; display: flex; align-items: center; justify-content: center; transform-origin: center center; transition: transform 0.6s ease-in-out, box-shadow 0.6s ease-in-out, border-radius 0.6s ease-in-out; z-index: 10; }

.PlayerWrapper.InTheater { z-index: 9999; box-shadow: 0 0 150px 80px rgba(0,0,0,0.9); border-radius: 8px; }

.PlayerWrapper:fullscreen { transition: none !important; transform: none !important; border-radius: 0 !important; border: none !important; width: 100% !important; height: 100% !important; max-width: none !important; max-height: none !important; }

video { width: 100%; height: 100%; display: block; object-fit: contain; }

.SeekFeedback { position: absolute; top: 50%; transform: translateY(-50%) scale(0.9); background: rgba(0,0,0,0.7); padding: 15px 20px; border-radius: 50px; display: flex; align-items: center; gap: 8px; color: #fff; font-weight: bold; font-size: 16px; opacity: 0; pointer-events: none; transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out; backdrop-filter: blur(5px); z-index: 10; }
.SeekFeedback.Left { left: 10%; }
.SeekFeedback.Right { right: 10%; }
.SeekFeedback.Active { opacity: 1; transform: translateY(-50%) scale(1); }
.SeekFeedback svg { width: 24px; height: 24px; fill: #fff; }

.PlayerControls { position: absolute; bottom: -2px; left: 0; right: 0; width: 100%; background: linear-gradient(0deg, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.5) 60%, transparent 100%); padding: 60px 25px 27px 25px; opacity: 0; transition: opacity 0.3s ease-in-out; display: flex; flex-direction: column; gap: 15px; pointer-events: none; }
.PlayerWrapper:hover .PlayerControls, .PlayerWrapper.Paused .PlayerControls { opacity: 1; pointer-events: auto; }

.ProgressArea { width: 100%; height: 6px; background: rgba(255,255,255,0.2); border-radius: 4px; cursor: pointer; position: relative; transition: height 0.2s ease-in-out; }
.ProgressArea:hover { height: 10px; }

.ProgressBar { height: 100%; background: #0ea5e9; border-radius: 4px; width: 0%; position: relative; pointer-events: none; }
.ProgressBar::after { content: ''; position: absolute; right: -6px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; background: #fff; border-radius: 50%; opacity: 0; transition: opacity 0.2s ease-in-out; box-shadow: 0 0 10px rgba(0,0,0,0.5); }
.ProgressArea:hover .ProgressBar::after { opacity: 1; }

.ControlPanel { display: flex; justify-content: space-between; align-items: center; }
.ControlGroup { display: flex; align-items: center; gap: 15px; }
.ControlGroup.Right { gap: 24px; }

.ControlBtn { background: none; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: transform 0.2s ease-in-out; padding: 0; }
.ControlBtn svg { width: 28px; height: 28px; fill: #cbd5e1; transition: fill 0.2s ease-in-out; }
.ControlBtn:hover { transform: scale(1.15); }
.ControlBtn:hover svg { fill: #0ea5e9; }

input[type="range"] { -webkit-appearance: none; appearance: none; width: 100px; height: 5px; background: rgba(255,255,255,0.2); border-radius: 4px; cursor: pointer; outline: none; transition: background 0.3s ease-in-out; }
input[type="range"]:hover { background: rgba(255,255,255,0.3); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 14px; height: 14px; background: #fff; border-radius: 50%; transition: background 0.2s ease-in-out; box-shadow: 0 0 5px rgba(0,0,0,0.5); }
input[type="range"]::-webkit-slider-thumb:hover { background: #0ea5e9; }

.TimeDisplay { color: #cbd5e1; font-size: 14px; font-variant-numeric: tabular-nums; font-weight: 700; letter-spacing: 0.5px; margin-left: 5px; }

.SettingsContainer { position: relative; display: flex; align-items: center; }
.SettingsMenu { position: absolute; bottom: 50px; right: -20px; background: rgba(15, 23, 42, 0.95); backdrop-filter: blur(15px); border: 1px solid #334155; border-radius: 12px; padding: 18px; display: flex; flex-direction: column; gap: 18px; width: 240px; opacity: 0; transform: translateY(15px); pointer-events: none; transition: all 0.25s ease-in-out; box-shadow: 0 15px 35px rgba(0,0,0,0.6); }
.SettingsMenu.Open { opacity: 1; transform: translateY(0); pointer-events: auto; }

.SettingItem { display: flex; justify-content: space-between; align-items: center; font-size: 14px; color: #cbd5e1; font-weight: 700; }

.ToolSelect { background: rgba(255,255,255,0.1); color: #fff; border: 1px solid transparent; padding: 6px 12px; border-radius: 6px; outline: none; cursor: pointer; font-size: 13px; font-weight: 700; -webkit-appearance: none; -moz-appearance: none; appearance: none; transition: all 0.2s ease-in-out; }
.ToolSelect:hover { border: 1px solid #0ea5e9; background: rgba(255,255,255,0.15); }
.ToolSelect option { background: #0f172a; color: #fff; }

.MenuBtn { background: rgba(255,255,255,0.1); color: #fff; border: 1px solid transparent; padding: 6px 14px; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 700; transition: all 0.2s ease-in-out; }
.MenuBtn:hover { background: #0ea5e9; color: #fff; }
.MenuBtn.ActiveState { background: rgba(14, 165, 233, 0.2); color: #38bdf8; border: 1px solid #0ea5e9; }

.DetailsBox { background: #0f172a; padding: 28px; border-radius: 16px; border: 1px solid #1e293b; box-shadow: 0 10px 25px rgba(0,0,0,0.3); transition: opacity 0.4s ease-in-out; }
.DetailsBox h2 { color: #f8fafc; margin-bottom: 12px; font-size: 24px; font-weight: 800; letter-spacing: -0.5px; }
.DetailsBox p { color: #94a3b8; line-height: 1.8; font-size: 15px; font-weight: 600; }

.SidebarPlaylist h3 { margin-bottom: 20px; font-size: 16px; color: #64748b; text-transform: uppercase; letter-spacing: 1.5px; font-weight: 900; padding-bottom: 15px; border-bottom: 1px solid #1e293b; }

.ListContainer { direction: ltr; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding-right: 8px; }

.ListContainer::-webkit-scrollbar { width: 6px; }
.ListContainer::-webkit-scrollbar-track { background: transparent; }
.ListContainer::-webkit-scrollbar-thumb { background: #334155; border-radius: 10px; }
.ListContainer::-webkit-scrollbar-thumb:hover { background: #475569; }

.VideoCard { direction: rtl; position: relative; display: flex; gap: 18px; padding: 16px; background: #020617; border-radius: 12px; cursor: pointer; transition: all 0.2s ease-in-out; border: 1px solid #0f172a; }
.VideoCard:hover { background: #1e293b; transform: translateY(-3px); box-shadow: 0 5px 15px rgba(0,0,0,0.4); border-color: #334155; }
.VideoCard.IsActive { background: rgba(14, 165, 233, 0.1); border: 1px solid rgba(14, 165, 233, 0.4); border-right: 4px solid #0ea5e9; transform: translateY(0); box-shadow: none; }

.VideoCard.MissingEpisode { opacity: 0.3; pointer-events: none; filter: grayscale(100%); }

.CardNumber { font-weight: 900; color: #475569; font-size: 24px; display: flex; align-items: center; min-width: 35px; justify-content: center; transition: color 0.3s ease-in-out; }
.VideoCard.IsActive .CardNumber { color: #0ea5e9; }

.CardInfo { display: flex; flex-direction: column; justify-content: center; padding-left: 35px; }
.CardInfo h4 { font-size: 14px; color: #e2e8f0; margin-bottom: 6px; line-height: 1.5; font-weight: 700; }
.CardInfo p { font-size: 12px; color: #64748b; font-variant-numeric: tabular-nums; font-weight: 600; }

.EyeIcon { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; fill: none; stroke: #475569; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; cursor: pointer; transition: all 0.2s ease-in-out; z-index: 5; }
.EyeIcon:hover { stroke: #94a3b8; transform: translateY(-50%) scale(1.1); }

.VideoCard.Watched { background: rgba(16, 185, 129, 0.08); border: 1px solid rgba(16, 185, 129, 0.4); box-shadow: inset 0 0 20px rgba(16, 185, 129, 0.05); }
.VideoCard.Watched .CardNumber { color: #10b981; }
.VideoCard.Watched .EyeIcon { stroke: #10b981; fill: rgba(16, 185, 129, 0.15); }
.VideoCard.Watched:hover { background: rgba(16, 185, 129, 0.15); border-color: rgba(16, 185, 129, 0.6); }

body.TheaterMode .NavBar,
body.TheaterMode .DetailsBox,
body.TheaterMode .SidebarPlaylist {
    opacity: 0.15;
}