:root {
  --bg-dark: #090d16;
  --bg-card: #131a29;
  --bg-card-hover: #1c263b;
  --border-color: #232f48;
  --accent-primary: #38bdf8;
  --accent-secondary: #818cf8;
  --accent-gradient: linear-gradient(135deg, #0284c7 0%, #4f46e5 100%);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --success: #22c55e;
  --warning: #eab308;
  --radius: 0.75rem;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Inter', sans-serif; }
body { background-color: var(--bg-dark); color: var(--text-main); min-height: 100vh; display: flex; flex-direction: column; overflow-x: hidden; }

/* Header */
.app-header { background: rgba(19, 26, 41, 0.85); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border-color); position: sticky; top: 0; z-index: 100; }
.header-container { max-width: 1300px; margin: 0 auto; padding: 0.85rem 1.5rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }

.brand { display: flex; align-items: center; gap: 0.75rem; }
.logo-icon { width: 40px; height: 40px; background: var(--accent-gradient); border-radius: 0.6rem; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; color: white; box-shadow: 0 4px 15px rgba(2, 132, 199, 0.4); }
.brand-title { font-family: 'Outfit', sans-serif; font-size: 1.25rem; font-weight: 800; background: linear-gradient(135deg, #38bdf8, #a5b4fc); -webkit-background-clip: text; -webkit-text-fill-color: transparent; display: block; }
.brand-subtitle { font-size: 0.75rem; color: var(--text-muted); font-family: monospace; }

.batch-selector-wrapper { display: flex; align-items: center; gap: 0.5rem; background: #0b111e; border: 1px solid var(--border-color); padding: 0.35rem 0.5rem; border-radius: 0.6rem; }
.select-icon { color: var(--accent-primary); margin-left: 0.5rem; }
select, input[type="text"] { background: transparent; border: none; color: white; font-size: 0.88rem; padding: 0.4rem 0.6rem; outline: none; }
select option { background: var(--bg-card); color: white; }
input[type="text"] { border-left: 1px solid var(--border-color); width: 170px; }

.btn-primary { background: var(--accent-gradient); color: white; border: none; padding: 0.45rem 1rem; border-radius: 0.4rem; font-weight: 600; font-size: 0.85rem; cursor: pointer; transition: transform 0.15s, opacity 0.15s; }
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }

.gateway-badge { display: flex; align-items: center; gap: 0.5rem; background: rgba(34, 197, 94, 0.1); border: 1px solid rgba(34, 197, 94, 0.25); padding: 0.35rem 0.85rem; border-radius: 2rem; font-size: 0.8rem; color: var(--success); font-weight: 600; }
.pulse-dot { width: 8px; height: 8px; background: var(--success); border-radius: 50%; box-shadow: 0 0 8px var(--success); animation: pulse 1.5s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* Main Container */
.app-main { flex: 1; padding: 2rem 1.5rem; }
.main-container { max-width: 1300px; margin: 0 auto; }

/* Batch Hero */
.batch-hero { background: linear-gradient(135deg, rgba(19, 26, 41, 0.9), rgba(15, 23, 42, 0.9)), url('https://i.ytimg.com/vi/5sA9uo8qtUs/maxresdefault.jpg') center/cover; border: 1px solid var(--border-color); border-radius: var(--radius); padding: 2rem; display: flex; justify-content: space-between; align-items: center; gap: 2rem; margin-bottom: 2rem; position: relative; overflow: hidden; }
.hero-content { flex: 1; z-index: 2; }
.hero-badge { display: inline-block; background: rgba(56, 189, 248, 0.15); color: var(--accent-primary); border: 1px solid rgba(56, 189, 248, 0.3); padding: 0.25rem 0.75rem; border-radius: 0.4rem; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; margin-bottom: 0.75rem; }
.batch-hero h1 { font-family: 'Outfit', sans-serif; font-size: 2rem; font-weight: 800; margin-bottom: 0.5rem; }
.hero-desc { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 1rem; max-width: 650px; line-height: 1.5; }
.hero-meta { display: flex; gap: 1rem; flex-wrap: wrap; }
.meta-chip { background: #0b111e; border: 1px solid var(--border-color); padding: 0.35rem 0.75rem; border-radius: 0.4rem; font-size: 0.8rem; color: #cbd5e1; display: flex; align-items: center; gap: 0.4rem; }

.hero-image-box { width: 220px; height: 130px; border-radius: 0.6rem; overflow: hidden; border: 2px solid var(--border-color); flex-shrink: 0; box-shadow: 0 10px 25px rgba(0,0,0,0.5); }
.hero-image-box img { width: 100%; height: 100%; object-fit: cover; }

/* Tabs Nav */
.nav-tabs { display: flex; gap: 0.5rem; border-bottom: 1px solid var(--border-color); margin-bottom: 2rem; overflow-x: auto; padding-bottom: 0.25rem; }
.tab-btn { background: transparent; border: none; color: var(--text-muted); padding: 0.75rem 1.25rem; font-weight: 600; font-size: 0.95rem; cursor: pointer; border-bottom: 2px solid transparent; transition: color 0.2s, border-color 0.2s; white-space: nowrap; display: flex; align-items: center; gap: 0.5rem; }
.tab-btn:hover { color: var(--text-main); }
.tab-btn.active { color: var(--accent-primary); border-bottom-color: var(--accent-primary); }

/* Tab Content */
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s ease-in-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.section-header h2 { font-size: 1.25rem; font-weight: 700; display: flex; align-items: center; gap: 0.6rem; }
.count-badge { background: #1c263b; border: 1px solid var(--border-color); padding: 0.25rem 0.75rem; border-radius: 1rem; font-size: 0.8rem; font-weight: 600; color: var(--accent-primary); }

/* Cards Grid */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.25rem; }
.card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius); overflow: hidden; transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s; display: flex; flex-direction: column; }
.card:hover { transform: translateY(-4px); border-color: var(--accent-primary); box-shadow: 0 12px 25px rgba(2, 132, 199, 0.15); }

.card-img-wrapper { position: relative; width: 100%; aspect-ratio: 16/9; background: #000; overflow: hidden; }
.card-img-wrapper img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.card:hover .card-img-wrapper img { transform: scale(1.05); }

.play-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.2s; cursor: pointer; }
.card-img-wrapper:hover .play-overlay { opacity: 1; }
.play-btn-circle { width: 50px; height: 50px; background: var(--accent-gradient); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; color: white; box-shadow: 0 4px 20px rgba(0,0,0,0.6); }

.card-body { padding: 1.25rem; flex: 1; display: flex; flex-direction: column; justify-content: space-between; }
.card-tag { display: inline-block; background: rgba(129, 140, 248, 0.15); color: var(--accent-secondary); font-size: 0.7rem; font-weight: 700; padding: 0.2rem 0.5rem; border-radius: 0.3rem; margin-bottom: 0.5rem; }
.card-title { font-size: 1rem; font-weight: 700; margin-bottom: 0.5rem; line-height: 1.4; color: #f1f5f9; }
.card-desc { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1rem; line-height: 1.4; }

.card-footer { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--border-color); padding-top: 0.75rem; font-size: 0.8rem; color: var(--text-muted); }
.btn-card { width: 100%; padding: 0.6rem; background: rgba(56, 189, 248, 0.1); color: var(--accent-primary); border: 1px solid rgba(56, 189, 248, 0.25); border-radius: 0.4rem; font-weight: 600; cursor: pointer; text-align: center; text-decoration: none; display: inline-block; transition: background 0.2s; }
.btn-card:hover { background: var(--accent-gradient); color: white; border-color: transparent; }

/* Subjects Layout */
.subjects-layout { display: grid; grid-template-columns: 280px 1fr; gap: 1.5rem; }
.subjects-sidebar { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius); padding: 1.25rem; }
.subjects-sidebar h3 { font-size: 1rem; font-weight: 700; margin-bottom: 1rem; color: var(--accent-primary); display: flex; align-items: center; gap: 0.5rem; }
.subject-list-grid { display: flex; flex-direction: column; gap: 0.5rem; }
.subject-item { padding: 0.75rem 1rem; background: #0b111e; border: 1px solid var(--border-color); border-radius: 0.5rem; cursor: pointer; transition: background 0.2s, border-color 0.2s; font-size: 0.9rem; font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.subject-item:hover { background: var(--bg-card-hover); border-color: var(--accent-primary); }
.subject-item.active { background: var(--accent-gradient); color: white; border-color: transparent; }

.topics-bar { display: flex; align-items: center; gap: 1rem; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius); padding: 0.75rem 1.25rem; margin-bottom: 1.25rem; }
.topics-bar label { font-size: 0.9rem; font-weight: 600; color: var(--text-muted); display: flex; align-items: center; gap: 0.5rem; }
.topics-bar select { flex: 1; background: #0b111e; border: 1px solid var(--border-color); border-radius: 0.4rem; padding: 0.5rem; font-size: 0.9rem; }

.content-subtabs { display: flex; gap: 0.5rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.subtab-btn { background: var(--bg-card); border: 1px solid var(--border-color); color: var(--text-muted); padding: 0.5rem 1rem; border-radius: 0.5rem; font-weight: 600; font-size: 0.85rem; cursor: pointer; display: flex; align-items: center; gap: 0.4rem; transition: background 0.2s, color 0.2s; }
.subtab-btn:hover { color: white; }
.subtab-btn.active { background: var(--accent-gradient); color: white; border-color: transparent; }

/* Announcements Feed */
.announcements-list { display: flex; flex-direction: column; gap: 1rem; }
.announcement-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius); padding: 1.5rem; }
.announcement-date { font-size: 0.8rem; color: var(--accent-primary); font-weight: 600; margin-bottom: 0.5rem; }
.announcement-text { font-size: 0.95rem; line-height: 1.6; color: #cbd5e1; }

/* Modal Overlay */
.modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.85); backdrop-filter: blur(8px); display: none; align-items: center; justify-content: center; z-index: 1000; padding: 1.5rem; }
.modal-overlay.active { display: flex; animation: modalFade 0.25s ease-out; }
@keyframes modalFade { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: scale(1); } }

.modal-content { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius); width: 100%; max-width: 900px; overflow: hidden; position: relative; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.7); }
.modal-close { position: absolute; top: 1rem; right: 1rem; z-index: 10; width: 36px; height: 36px; background: rgba(0,0,0,0.6); color: white; border: none; border-radius: 50%; font-size: 1.2rem; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.modal-close:hover { background: var(--danger); }

.video-container { width: 100%; aspect-ratio: 16/9; background: #000; position: relative; }
.video-container video, .video-container iframe { width: 100%; height: 100%; border: none; }

.player-fallback { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem; text-align: center; color: var(--text-muted); gap: 1rem; }
.player-fallback i { font-size: 3rem; color: var(--warning); }

.modal-info { padding: 1.5rem; }
.modal-info h3 { font-size: 1.2rem; font-weight: 700; margin-bottom: 0.25rem; }
.modal-subtitle { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1rem; }

/* Loading & Empty States */
.loading-state, .empty-state { grid-column: 1 / -1; padding: 3rem; text-align: center; color: var(--text-muted); font-size: 1rem; background: var(--bg-card); border: 1px dashed var(--border-color); border-radius: var(--radius); }
.loading-state i { margin-right: 0.5rem; color: var(--accent-primary); }

/* Footer */
.app-footer { background: #0b111e; border-top: 1px solid var(--border-color); padding: 1.5rem; text-align: center; color: var(--text-muted); font-size: 0.85rem; margin-top: auto; }

@media (max-width: 850px) {
  .subjects-layout { grid-template-columns: 1fr; }
  .batch-hero { flex-direction: column; text-align: center; }
  .hero-image-box { width: 100%; height: 180px; }
  .batch-selector-wrapper { width: 100%; }
}
