@charset "UTF-8";

/* ====== RESET ====== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; color: #111827; background: #f9fafb; min-height: 100vh; }
a { color: #1a56db; text-decoration: none; }
img { display: block; max-width: 100%; }
input, select, textarea, button { font-family: inherit; font-size: 1rem; }

/* ====== HEADER ====== */
.site-header { background: #ffffff; border-bottom: 1.5px solid #e5e7eb; position: sticky; top: 0; z-index: 100; box-shadow: 0 1px 6px rgba(0,0,0,.07); }
.header-inner { max-width: 1400px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; height: 64px; }
.logo-area { display: flex; align-items: center; gap: 12px; }
.logo-img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.logo-text { display: flex; flex-direction: column; line-height: 1.1; }
.logo-name { font-weight: 700; font-size: 1rem; color: #1a56db; }
.logo-tagline { font-size: .72rem; color: #6b7280; }
.header-nav { display: flex; align-items: center; gap: 8px; }
.nav-link { padding: 6px 14px; border-radius: 6px; font-size: .9rem; color: #374151; transition: background .15s; }
.nav-link:hover, .nav-link.active { background: #e8f0fe; color: #1a56db; }
.nav-user { display: flex; align-items: center; gap: 6px; font-size: .9rem; color: #374151; padding: 6px 12px; background: #f3f4f6; border-radius: 20px; }
.user-dot { width: 8px; height: 8px; background: #38a169; border-radius: 50%; display: inline-block; }
.btn-logout { padding: 6px 14px; background: #f3f4f6; border-radius: 6px; font-size: .9rem; color: #374151; transition: background .15s; }
.btn-logout:hover { background: #e53e3e; color: #ffffff; }

/* ====== MAIN + FOOTER ====== */
.main-content { max-width: 1400px; margin: 0 auto; padding: 28px 24px; }
.site-footer { background: #ffffff; border-top: 1px solid #e5e7eb; margin-top: 40px; }
.footer-inner { max-width: 1400px; margin: 0 auto; padding: 16px 24px; text-align: center; font-size: .85rem; color: #6b7280; }

/* ====== BUTTONS ====== */
.btn-primary { display: inline-flex; align-items: center; gap: 6px; background: #1a56db; color: #ffffff; padding: 10px 20px; border-radius: 6px; border: none; cursor: pointer; font-weight: 600; font-size: .9rem; transition: background .15s, transform .1s; }
.btn-primary:hover { background: #1340a8; color: #ffffff; transform: translateY(-1px); }
.btn-secondary { display: inline-flex; align-items: center; background: #f3f4f6; color: #374151; padding: 10px 20px; border-radius: 6px; border: none; cursor: pointer; font-weight: 600; font-size: .9rem; }
.btn-secondary:hover { background: #e5e7eb; color: #111827; }
.btn-full { width: 100%; justify-content: center; padding: 13px; font-size: 1rem; }
.btn-sm { padding: 4px 12px; font-size: .82rem; border-radius: 4px; cursor: pointer; border: none; display: inline-block; }
.btn-edit { background: #e8f0fe; color: #1a56db; }
.btn-edit:hover { background: #1a56db; color: #ffffff; }
.btn-delete { background: #fee2e2; color: #e53e3e; }
.btn-delete:hover { background: #e53e3e; color: #ffffff; }
.btn-view { background: #dcfce7; color: #38a169; }
.btn-disabled { display: inline-block; padding: 10px 20px; background: #e5e7eb; color: #6b7280; border-radius: 6px; font-size: .9rem; font-weight: 600; text-align: center; cursor: not-allowed; }
.btn-back { padding: 7px 16px; background: rgba(255,255,255,.15); color: #ffffff; border-radius: 6px; font-size: .9rem; border: 1px solid rgba(255,255,255,.3); }
.btn-back:hover { background: rgba(255,255,255,.25); color: #ffffff; }

/* ====== ALERTS ====== */
.alert { padding: 12px 18px; border-radius: 6px; margin-bottom: 18px; font-size: .95rem; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* ====== LOGIN PAGE ====== */
.login-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1340a8 0%, #1a56db 60%, #2563eb 100%); }
.login-page { width: 100%; min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { background: #ffffff; border-radius: 18px; padding: 44px 40px; width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo img { width: 80px; height: 80px; border-radius: 50%; margin: 0 auto 12px; object-fit: cover; }
.login-logo h1 { font-size: 1.4rem; font-weight: 700; color: #1a56db; margin-bottom: 4px; }
.login-logo p { color: #6b7280; font-size: .9rem; }
.login-form .form-group { margin-bottom: 18px; }
.login-form label { display: block; margin-bottom: 6px; font-weight: 600; font-size: .9rem; color: #374151; }
.login-form input[type="text"],
.login-form input[type="password"] { width: 100%; padding: 11px 14px; border: 1.5px solid #d1d5db; border-radius: 6px; font-size: .95rem; transition: border-color .2s; }
.login-form input:focus { outline: none; border-color: #1a56db; box-shadow: 0 0 0 3px rgba(26,86,219,.12); }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 60px; }
.toggle-pass { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; color: #1a56db; cursor: pointer; font-size: .85rem; }
.login-footer-text { text-align: center; color: #9ca3af; font-size: .8rem; margin-top: 20px; }

/* ====== DASHBOARD ====== */
.dashboard-wrap { max-width: 1100px; margin: 0 auto; }
.welcome-banner { background: linear-gradient(135deg, #1a56db 0%, #1340a8 100%); color: #ffffff; border-radius: 10px; padding: 28px 32px; display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.welcome-banner h2 { font-size: 1.4rem; margin-bottom: 8px; }
.welcome-banner p { opacity: .85; }
.welcome-icon { font-size: 3rem; }
.badge-category { background: rgba(255,255,255,.2); padding: 3px 12px; border-radius: 20px; font-size: .85rem; font-weight: 600; }
.live-alert { background: #dc2626; color: #ffffff; padding: 14px 20px; border-radius: 10px; display: flex; align-items: center; gap: 14px; margin-bottom: 20px; animation: pulseBg 2s infinite; }
.live-alert > div { flex: 1; min-width: 0; }
@keyframes pulseBg { 0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,.4); } 50% { box-shadow: 0 0 0 8px rgba(220,38,38,0); } }
.live-pulse { width: 14px; height: 14px; background: #ffffff; border-radius: 50%; flex-shrink: 0; animation: pulseAnim 1.2s infinite; }
@keyframes pulseAnim { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.4); opacity: .6; } }
.btn-join-now { background: #ffffff; color: #e53e3e; padding: 10px 22px; border-radius: 6px; font-weight: 700; white-space: nowrap; }
.btn-join-now:hover { background: #f3f4f6; color: #b91c1c; }
.countdown-card { background: #ffffff; border: 1.5px solid #e5e7eb; border-radius: 10px; padding: 20px 24px; margin-bottom: 20px; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.countdown-card h3 { color: #6b7280; font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.session-info { flex: 1; }
.session-info strong { display: block; font-size: 1rem; color: #111827; margin-bottom: 4px; }
.session-info span { color: #6b7280; font-size: .9rem; }
.countdown-timer { font-size: 2rem; font-weight: 700; color: #1a56db; font-variant-numeric: tabular-nums; letter-spacing: .05em; }
.sessions-section { margin-bottom: 32px; }
.section-title { font-size: 1rem; font-weight: 700; color: #374151; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.live-dot { width: 10px; height: 10px; background: #e53e3e; border-radius: 50%; display: inline-block; animation: pulseAnim 1s infinite; }
.session-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.session-card { background: #ffffff; border: 1.5px solid #e5e7eb; border-radius: 10px; padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.session-live { border-color: #fca5a5; box-shadow: 0 0 0 3px rgba(239,68,68,.08); }
.session-upcoming { border-color: #bfdbfe; }
.session-ended { opacity: .7; }
.card-header { display: flex; align-items: center; justify-content: space-between; }
.live-badge { background: #e53e3e; color: #ffffff; padding: 3px 10px; border-radius: 20px; font-size: .78rem; font-weight: 700; animation: pulseAnim 1.5s infinite; }
.viewer-count { color: #6b7280; font-size: .82rem; }
.session-card h4 { font-size: 1rem; font-weight: 700; color: #111827; }
.card-desc { color: #6b7280; font-size: .88rem; line-height: 1.5; }
.card-meta { display: flex; gap: 12px; flex-wrap: wrap; color: #6b7280; font-size: .83rem; }
.btn-join { margin-top: auto; text-align: center; }
.empty-state { text-align: center; padding: 64px 24px; background: #ffffff; border-radius: 10px; border: 1.5px dashed #d1d5db; }
.empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state h3 { font-size: 1.1rem; color: #374151; margin-bottom: 8px; }
.empty-state p { color: #6b7280; font-size: .9rem; }

/* ====== ADMIN PANEL ====== */
.admin-wrap { display: flex; gap: 0; min-height: calc(100vh - 140px); }
.admin-sidebar { width: 220px; flex-shrink: 0; background: #ffffff; border-right: 1.5px solid #e5e7eb; padding: 20px 0; }
.admin-nav { display: flex; flex-direction: column; gap: 2px; padding: 0 12px; }
.admin-nav-item { display: block; padding: 10px 14px; border-radius: 6px; color: #374151; font-size: .9rem; font-weight: 500; transition: background .15s; }
.admin-nav-item:hover, .admin-nav-item.active { background: #e8f0fe; color: #1a56db; font-weight: 600; }
.admin-main { flex: 1; padding: 28px; overflow: auto; }
.admin-page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.admin-page-header h2 { font-size: 1.4rem; font-weight: 700; }
.record-count { background: #f3f4f6; padding: 5px 12px; border-radius: 20px; font-size: .85rem; color: #6b7280; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card { background: #ffffff; border: 1.5px solid #e5e7eb; border-radius: 10px; padding: 20px 18px; display: flex; align-items: center; gap: 14px; }
.stat-card.stat-live { border-color: #fca5a5; background: #fff5f5; }
.stat-icon { font-size: 1.8rem; }
.stat-num { font-size: 1.8rem; font-weight: 800; color: #1a56db; line-height: 1; }
.stat-label { font-size: .8rem; color: #6b7280; margin-top: 2px; }
.admin-sections-row { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.admin-section { background: #ffffff; border: 1.5px solid #e5e7eb; border-radius: 10px; padding: 20px; }
.section-hdr { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-hdr h3 { font-size: 1rem; font-weight: 700; }
.quick-actions { display: flex; flex-direction: column; gap: 10px; }
.quick-action-btn { display: block; padding: 12px 16px; background: #e8f0fe; color: #1a56db; border-radius: 6px; font-weight: 600; font-size: .9rem; transition: background .15s; }
.quick-action-btn:hover { background: #1a56db; color: #ffffff; }

/* ====== TABLE ====== */
.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.admin-table th { text-align: left; padding: 10px 14px; background: #f9fafb; border-bottom: 2px solid #e5e7eb; font-weight: 700; color: #4b5563; white-space: nowrap; }
.admin-table td { padding: 10px 14px; border-bottom: 1px solid #f3f4f6; vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: #f9fafb; }
.action-btns { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.empty-row { text-align: center; color: #9ca3af; padding: 32px !important; }

/* ====== FORMS ====== */
.form-card { background: #ffffff; border: 1.5px solid #e5e7eb; border-radius: 10px; padding: 28px; max-width: 700px; }
.admin-form .form-group { margin-bottom: 18px; }
.admin-form .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.admin-form label { display: block; margin-bottom: 6px; font-weight: 600; font-size: .88rem; color: #374151; }
.admin-form input[type="text"],
.admin-form input[type="email"],
.admin-form input[type="password"],
.admin-form input[type="date"],
.admin-form input[type="time"],
.admin-form input[type="number"],
.admin-form select,
.admin-form textarea { width: 100%; padding: 10px 13px; border: 1.5px solid #d1d5db; border-radius: 6px; font-size: .92rem; transition: border-color .2s; background: #ffffff; }
.admin-form input:focus, .admin-form select:focus, .admin-form textarea:focus { outline: none; border-color: #1a56db; box-shadow: 0 0 0 3px rgba(26,86,219,.1); }
.admin-form textarea { resize: vertical; }
.form-hint { font-size: .8rem; color: #9ca3af; margin-top: 5px; }
.duration-wrap { display: flex; align-items: center; gap: 8px; }

/* ====== BADGES ====== */
.role-badge { padding: 3px 10px; border-radius: 20px; font-size: .78rem; font-weight: 700; }
.role-admin { background: #fef3c7; color: #92400e; }
.role-user { background: #e8f0fe; color: #1a56db; }
.cat-badge { background: #f3f4f6; color: #374151; padding: 3px 10px; border-radius: 20px; font-size: .78rem; white-space: nowrap; }
.status-badge { padding: 3px 10px; border-radius: 20px; font-size: .78rem; font-weight: 700; }
.status-live { background: #fee2e2; color: #e53e3e; }
.status-upcoming { background: #dbeafe; color: #1d4ed8; }
.status-ended { background: #f3f4f6; color: #6b7280; }
.badge-yes { color: #38a169; font-weight: 700; }
.badge-no { color: #9ca3af; }
.log-action { padding: 2px 8px; border-radius: 4px; font-size: .8rem; font-weight: 600; background: #f3f4f6; color: #4b5563; }
.log-login { background: #dcfce7; color: #166534; }
.log-logout { background: #f3f4f6; color: #4b5563; }
.log-login_failed { background: #fee2e2; color: #e53e3e; }

/* ====== LIVE PAGE ====== */
.live-body { background: #0a0a0f; color: #ffffff; min-height: 100vh; margin: 0; }
.live-header { background: rgba(255,255,255,.05); border-bottom: 1px solid rgba(255,255,255,.1); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 50; }
.live-header-inner { display: flex; align-items: center; gap: 16px; padding: 0 24px; height: 60px; max-width: 1600px; margin: 0 auto; }
.logo-img-sm { width: 32px; height: 32px; border-radius: 50%; }
.logo-name-sm { font-weight: 700; font-size: .9rem; color: rgba(255,255,255,.9); }
.live-title-area { flex: 1; padding: 0 16px; }
.live-session-title { font-size: 1rem; font-weight: 700; color: #ffffff; margin-bottom: 2px; }
.live-category-tag { background: rgba(255,255,255,.12); color: rgba(255,255,255,.8); padding: 2px 10px; border-radius: 20px; font-size: .78rem; }
.live-header-right { display: flex; align-items: center; gap: 12px; }
.live-badge-header { display: flex; align-items: center; gap: 6px; background: #e53e3e; padding: 4px 12px; border-radius: 20px; font-weight: 700; font-size: .82rem; animation: pulseAnim 1.5s infinite; }
.live-dot-anim { width: 8px; height: 8px; background: #ffffff; border-radius: 50%; animation: pulseAnim 1s infinite; }
.viewer-count-display { color: rgba(255,255,255,.8); font-size: .85rem; }
.live-layout { display: flex; gap: 0; max-width: 1600px; margin: 0 auto; height: calc(100vh - 60px); }
.video-panel { flex: 1; display: flex; flex-direction: column; overflow: auto; }
.chat-panel { width: 340px; flex-shrink: 0; border-left: 1px solid rgba(255,255,255,.08); display: flex; flex-direction: column; height: 100%; }
.video-container { position: relative; background: #000; aspect-ratio: 16/9; width: 100%; max-height: 75vh; }
.live-video { width: 100%; height: 100%; object-fit: contain; display: block; }
.video-overlay { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(0,0,0,.6); z-index: 10; }
.play-overlay-btn { background: #1a56db; color: #ffffff; border: none; padding: 16px 32px; border-radius: 50px; font-size: 1.1rem; font-weight: 700; cursor: pointer; }
.video-watermark { position: absolute; top: 12px; right: 16px; z-index: 20; color: rgba(255,255,255,.25); font-size: .8rem; pointer-events: none; font-weight: 600; letter-spacing: .05em; }
.video-loading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #000; z-index: 5; gap: 16px; color: rgba(255,255,255,.7); }
.spinner { width: 44px; height: 44px; border: 4px solid rgba(255,255,255,.15); border-top-color: #1a56db; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.video-controls-bar { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px; background: rgba(0,0,0,.8); }
.vctrl-left { display: flex; align-items: center; gap: 12px; }
.live-badge-player { display: flex; align-items: center; gap: 5px; background: #e53e3e; padding: 2px 8px; border-radius: 4px; font-size: .75rem; font-weight: 700; }
.live-dot-sm { width: 6px; height: 6px; background: #ffffff; border-radius: 50%; animation: pulseAnim 1s infinite; }
.duration-display { color: rgba(255,255,255,.7); font-size: .82rem; font-variant-numeric: tabular-nums; }
.vctrl-right { display: flex; align-items: center; gap: 8px; }
.ctrl-btn { background: rgba(255,255,255,.1); color: #ffffff; border: none; padding: 5px 10px; border-radius: 4px; cursor: pointer; font-size: 1rem; }
.ctrl-btn:hover { background: rgba(255,255,255,.2); }
.video-desc-panel { padding: 20px 24px; background: rgba(255,255,255,.04); border-top: 1px solid rgba(255,255,255,.08); }
.video-desc-panel h3 { font-size: .9rem; color: rgba(255,255,255,.6); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .05em; }
.video-desc-panel p { color: rgba(255,255,255,.8); font-size: .9rem; line-height: 1.6; }
.preclass-screen, .ended-screen { flex: 1; display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at center, #1e1b4b 0%, #0a0a0f 70%); min-height: 400px; }
.preclass-inner, .ended-inner { text-align: center; max-width: 480px; padding: 32px; }
.preclass-icon, .ended-icon { font-size: 4rem; margin-bottom: 16px; }
.preclass-inner h2, .ended-inner h2 { font-size: 1.8rem; margin-bottom: 12px; }
.preclass-date { color: rgba(255,255,255,.7); font-size: 1rem; margin-bottom: 20px; }
.preclass-countdown { font-size: 3rem; font-weight: 700; color: #1a56db; font-variant-numeric: tabular-nums; letter-spacing: .1em; margin: 16px 0; }
.preclass-hint { color: rgba(255,255,255,.4); font-size: .85rem; }
.ended-inner p { color: rgba(255,255,255,.7); margin-bottom: 24px; }
.chat-header { padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,.08); display: flex; align-items: center; justify-content: space-between; }
.chat-title { font-weight: 700; font-size: .95rem; }
.chat-count { font-size: .78rem; color: rgba(255,255,255,.4); }
.chat-messages { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }
.chat-msg { display: flex; align-items: flex-start; gap: 8px; }
.chat-msg-own { flex-direction: row-reverse; }
.chat-avatar { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .72rem; font-weight: 700; flex-shrink: 0; color: #ffffff; }
.chat-bubble { background: rgba(255,255,255,.07); border-radius: 10px; padding: 8px 12px; max-width: 75%; }
.chat-msg-own .chat-bubble { background: rgba(26,86,219,.3); }
.chat-uname { display: block; font-size: .72rem; color: rgba(255,255,255,.5); margin-bottom: 2px; font-weight: 600; }
.chat-bubble p { font-size: .88rem; color: rgba(255,255,255,.9); line-height: 1.4; }
.chat-input-area { padding: 12px; border-top: 1px solid rgba(255,255,255,.08); display: flex; gap: 8px; }
.chat-input-area input { flex: 1; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); border-radius: 6px; padding: 8px 12px; color: #ffffff; font-size: .88rem; }
.chat-input-area input:focus { outline: none; border-color: #1a56db; }
.btn-send { background: #1a56db; color: #ffffff; border: none; padding: 8px 14px; border-radius: 6px; cursor: pointer; font-size: .88rem; font-weight: 600; }
.mobile-block { display: none; position: fixed; inset: 0; background: #0a0a0f; z-index: 9999; align-items: center; justify-content: center; }
.mobile-block-inner { text-align: center; padding: 32px; max-width: 360px; }
.mb-logo { width: 70px; height: 70px; border-radius: 50%; margin: 0 auto 20px; }
.mobile-icon { font-size: 3rem; margin-bottom: 12px; }
.mobile-block-inner h2 { font-size: 1.5rem; color: #ffffff; margin-bottom: 10px; }
.mobile-block-inner p { color: rgba(255,255,255,.7); margin-bottom: 24px; line-height: 1.6; }
.error-page { text-align: center; padding: 64px 24px; }
.error-page h2 { font-size: 1.8rem; margin-bottom: 12px; }
.error-page p { color: #6b7280; margin-bottom: 24px; }
#countdown-timer { font-size: 1.6rem; font-weight: 700; color: #1a56db; font-variant-numeric: tabular-nums; }

@media (max-width: 900px) {
    .admin-sections-row { grid-template-columns: 1fr; }
    .admin-form .form-row { grid-template-columns: 1fr; }
    .admin-sidebar { display: none; }
}
@media (max-width: 768px) {
    .header-inner { padding: 0 14px; }
    .main-content { padding: 16px 14px; }
    .live-layout { flex-direction: column; height: auto; }
    .chat-panel { width: 100%; height: 300px; border-left: none; border-top: 1px solid rgba(255,255,255,.08); }
}
