/* ===== Z14 DUAL THEME SYSTEM (DARK & LIGHT) ===== */

/* DARK THEME (default) */
body[data-z14-theme="dark"],
body:not([data-z14-theme]) {
    --z14-bg: #07111f;
    --z14-bg-2: #0f1d32;
    --z14-panel: rgba(255, 255, 255, 0.08);
    --z14-panel-border: rgba(255, 255, 255, 0.12);
    --z14-text: #ecf2ff;
    --z14-muted: #a8b4c8;
    --z14-accent: #6fe7dd;
    --z14-accent-2: #ffb86b;
    --z14-success: #5fe18c;
    --z14-danger: #ff6b7a;
    --z14-navbar-bg: rgba(6, 12, 24, 0.72);
}

/* LIGHT THEME */
body[data-z14-theme="light"] {
    --z14-bg: #f8f9fb;
    --z14-bg-2: #eef1f5;
    --z14-panel: rgba(0, 0, 0, 0.04);
    --z14-panel-border: rgba(0, 0, 0, 0.08);
    --z14-text: #1a1f35;
    --z14-muted: #6b7280;
    --z14-accent: #0891b2;
    --z14-accent-2: #f97316;
    --z14-success: #16a34a;
    --z14-danger: #dc2626;
    --z14-navbar-bg: rgba(255, 255, 255, 0.96);
}

/* BODY & BASE */
html, body {
    min-height: 100%;
}

body[data-z14-theme="dark"],
body:not([data-z14-theme]) {
    background:
        radial-gradient(circle at top left, rgba(111, 231, 221, 0.16), transparent 30%),
        radial-gradient(circle at top right, rgba(255, 184, 107, 0.12), transparent 26%),
        linear-gradient(160deg, var(--z14-bg) 0%, var(--z14-bg-2) 100%);
}

body[data-z14-theme="light"] {
    background:
        radial-gradient(circle at top left, rgba(8, 145, 178, 0.08), transparent 40%),
        radial-gradient(circle at top right, rgba(249, 115, 22, 0.08), transparent 40%),
        linear-gradient(160deg, var(--z14-bg) 0%, var(--z14-bg-2) 100%);
}

body {
    color: var(--z14-text);
    font-family: 'Segoe UI', 'Trebuchet MS', sans-serif;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Bootstrap tokens used by .text-muted, .text-body-secondary, etc. */
body[data-z14-theme="dark"],
body:not([data-z14-theme]) {
    --bs-secondary-rgb: 168, 180, 200;
}

body[data-z14-theme="light"] {
    --bs-secondary-rgb: 107, 114, 128;
}

.text-muted,
.text-body-secondary {
    color: var(--z14-muted) !important;
}

body[data-z14-theme="light"] .text-white-50 {
    color: var(--z14-muted) !important;
}

body[data-z14-theme="dark"] .text-white-50,
body:not([data-z14-theme]) .text-white-50 {
    color: rgba(236, 242, 255, 0.72) !important;
}

/* LINKS */
a {
    color: var(--z14-accent);
    text-decoration: none;
    transition: color 0.2s ease;
}

body[data-z14-theme="dark"] a:hover,
body:not([data-z14-theme]) a:hover {
    color: #b6fff8;
}

body[data-z14-theme="light"] a:hover {
    color: #0e7490;
}

/* NAVBAR */
.z14-navbar {
    background: var(--z14-navbar-bg);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--z14-panel-border);
    transition: background-color 0.3s ease;
}

.z14-navbar .navbar-brand,
.z14-navbar .nav-link {
    color: var(--z14-text);
}

.z14-navbar .nav-link.active,
.z14-navbar .nav-link:hover {
    color: var(--z14-accent);
}

body[data-z14-theme="light"] .z14-navbar .navbar-toggler {
    border-color: rgba(0, 0, 0, 0.18);
}

body[data-z14-theme="light"] .z14-navbar .navbar-toggler-icon {
    filter: invert(1) grayscale(100%);
}

body[data-z14-theme="light"] .z14-navbar {
    border-bottom-color: rgba(0, 0, 0, 0.1);
}

.z14-theme-toggle {
    cursor: pointer;
    padding: 0.4rem 0.6rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: inherit;
    transition: all 0.2s ease;
    font-size: 1rem;
}

.z14-theme-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

body[data-z14-theme="light"] .z14-theme-toggle {
    border-color: rgba(0, 0, 0, 0.15);
    background: rgba(0, 0, 0, 0.05);
    color: var(--z14-text);
}

body[data-z14-theme="light"] .z14-theme-toggle:hover {
    background: rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.2);
}

/* LAYOUT */
.z14-shell {
    max-width: 1600px;
}

.z14-panel {
    background: var(--z14-panel);
    border: 1px solid var(--z14-panel-border);
    border-radius: 1.25rem;
    padding: 1rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.22);
    color: var(--z14-text);
    transition: all 0.3s ease;
}

/* FORM CONTROLS INSIDE THEMED PANELS */
.z14-panel .form-control,
.z14-panel .form-select,
.z14-mini-card .form-control,
.z14-mini-card .form-select {
    color: var(--z14-text);
    border-color: var(--z14-panel-border);
    background: rgba(255, 255, 255, 0.06);
}

body[data-z14-theme="light"] .z14-panel .form-control,
body[data-z14-theme="light"] .z14-panel .form-select,
body[data-z14-theme="light"] .z14-mini-card .form-control,
body[data-z14-theme="light"] .z14-mini-card .form-select {
    background: #ffffff;
    border-color: rgba(0, 0, 0, 0.12);
}

.z14-panel .form-control::placeholder,
.z14-mini-card .form-control::placeholder {
    color: var(--z14-muted);
}

.z14-panel .form-check-label,
.z14-mini-card .form-check-label {
    color: var(--z14-text);
}

.z14-panel-header {
    padding-bottom: 0.8rem;
    margin-bottom: 0.9rem;
    border-bottom: 1px solid var(--z14-panel-border);
}

.z14-sticky-panel {
    top: 1rem;
}

/* COURSE LIST */
.z14-course-list {
    display: grid;
    gap: 0.75rem;
}

.z14-course-card {
    border: 1px solid var(--z14-panel-border);
    border-radius: 1rem;
    padding: 0.85rem 0.9rem;
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

body[data-z14-theme="dark"] .z14-course-card,
body:not([data-z14-theme]) .z14-course-card {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
}

body[data-z14-theme="light"] .z14-course-card {
    border-color: rgba(0, 0, 0, 0.08);
    background: rgba(0, 0, 0, 0.02);
}

.z14-course-card:hover,
.z14-course-card.active {
    transform: translateY(-2px);
}

body[data-z14-theme="dark"] .z14-course-card:hover,
body[data-z14-theme="dark"] .z14-course-card.active,
body:not([data-z14-theme]) .z14-course-card:hover,
body:not([data-z14-theme]) .z14-course-card.active {
    border-color: rgba(111, 231, 221, 0.45);
    background: rgba(111, 231, 221, 0.12);
}

body[data-z14-theme="light"] .z14-course-card:hover,
body[data-z14-theme="light"] .z14-course-card.active {
    border-color: rgba(8, 145, 178, 0.5);
    background: rgba(8, 145, 178, 0.08);
}

.z14-course-title {
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.z14-course-meta,
.z14-small-muted {
    color: var(--z14-muted);
    font-size: 0.88rem;
}

/* CARDS & PANELS */
.z14-mini-card,
.z14-adsense-slot {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--z14-panel-border);
    border-radius: 1rem;
    padding: 1rem;
    transition: all 0.3s ease;
}

body[data-z14-theme="dark"] .z14-mini-card,
body[data-z14-theme="dark"] .z14-adsense-slot,
body:not([data-z14-theme]) .z14-mini-card,
body:not([data-z14-theme]) .z14-adsense-slot {
    background: rgba(255, 255, 255, 0.05);
}

body[data-z14-theme="light"] .z14-mini-card,
body[data-z14-theme="light"] .z14-adsense-slot {
    background: rgba(0, 0, 0, 0.02);
}

.ad-placeholder {
    min-height: 180px;
    border-radius: 0.9rem;
    border: 1px dashed var(--z14-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--z14-muted);
    background: rgba(0, 0, 0, 0.12);
    transition: all 0.3s ease;
}

body[data-z14-theme="light"] .ad-placeholder {
    border-color: rgba(0, 0, 0, 0.2);
    background: rgba(0, 0, 0, 0.04);
}

/* AUTH PAGE */
.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1rem;
}

.auth-card {
    width: min(520px, 100%);
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid var(--z14-panel-border);
    border-radius: 1.4rem;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25);
    padding: 1.5rem;
    color: var(--z14-text);
    transition: background-color 0.3s ease, color 0.3s ease;
}

body[data-z14-theme="light"] .auth-card {
    background: rgba(255, 255, 255, 1);
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.auth-card .form-control,
.auth-card .form-select {
    background: rgba(255, 255, 255, 0.95);
    color: #1f2937;
    transition: background-color 0.2s ease;
}

body[data-z14-theme="light"] .auth-card .form-control,
body[data-z14-theme="light"] .auth-card .form-select {
    background: #f9fafb;
    border-color: #e5e7eb;
}

.form-floating > label {
    color: #4a5568;
}

/* TABLES & CARDS */
.card, .table {
    background: rgba(255, 255, 255, 0.07);
    color: var(--z14-text);
    border-color: var(--z14-panel-border);
    transition: all 0.3s ease;
}

body[data-z14-theme="light"] .card,
body[data-z14-theme="light"] .table {
    background: #ffffff;
    border-color: #e5e7eb;
}

.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--z14-text);
}

/* BUTTONS */
.btn-primary {
    background: linear-gradient(135deg, var(--z14-accent), #4d8dff);
    border: 0;
    font-weight: 700;
    transition: all 0.2s ease;
}

body[data-z14-theme="dark"] .btn-primary,
body:not([data-z14-theme]) .btn-primary {
    color: #06111f;
}

body[data-z14-theme="light"] .btn-primary {
    color: #ffffff;
    background: linear-gradient(135deg, #0ea5b7, #2563eb);
}

body[data-z14-theme="dark"] .btn-primary:hover,
body:not([data-z14-theme]) .btn-primary:hover {
    background: linear-gradient(135deg, #7af8ee, #5f9bff);
    transform: translateY(-1px);
}

body[data-z14-theme="light"] .btn-primary:hover {
    background: linear-gradient(135deg, #22c7db, #3b82f6);
    transform: translateY(-1px);
}

.btn-enroll[disabled] {
    opacity: 0.75;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(0.2);
}

.btn-outline-light {
    border-color: rgba(255, 255, 255, 0.35);
}

body[data-z14-theme="light"] .btn-outline-light {
    color: var(--z14-text);
    border-color: var(--z14-text);
}

body[data-z14-theme="light"] .btn-outline-light:hover {
    background-color: var(--z14-text);
    color: var(--z14-bg);
}

/* PROGRESS BAR */
.progress {
    background: rgba(255, 255, 255, 0.12);
    transition: background-color 0.3s ease;
}

body[data-z14-theme="light"] .progress {
    background: rgba(0, 0, 0, 0.08);
}

.progress-bar {
    background: linear-gradient(90deg, var(--z14-accent), #7dffba);
    color: #07111f;
    font-weight: 700;
}

body[data-z14-theme="light"] .progress-bar {
    color: #ffffff;
}

/* SECTIONS */
.z14-section-title {
    font-size: 1.15rem;
    font-weight: 700;
}

.z14-lesson-box,
.z14-summary-box,
.z14-test-box,
.z14-notes-box {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--z14-panel-border);
    border-radius: 1.1rem;
    padding: 1rem;
    transition: all 0.3s ease;
}

body[data-z14-theme="dark"] .z14-lesson-box,
body[data-z14-theme="dark"] .z14-summary-box,
body[data-z14-theme="dark"] .z14-test-box,
body[data-z14-theme="dark"] .z14-notes-box,
body:not([data-z14-theme]) .z14-lesson-box,
body:not([data-z14-theme]) .z14-summary-box,
body:not([data-z14-theme]) .z14-test-box,
body:not([data-z14-theme]) .z14-notes-box {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.08);
}

body[data-z14-theme="light"] .z14-lesson-box,
body[data-z14-theme="light"] .z14-summary-box,
body[data-z14-theme="light"] .z14-test-box,
body[data-z14-theme="light"] .z14-notes-box {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.08);
}

.z14-chip {
    display: inline-flex;
    gap: 0.35rem;
    align-items: center;
    padding: 0.38rem 0.7rem;
    border-radius: 999px;
    background: rgba(111, 231, 221, 0.16);
    color: var(--z14-text);
    font-size: 0.82rem;
    transition: all 0.3s ease;
}

body[data-z14-theme="light"] .z14-chip {
    background: rgba(8, 145, 178, 0.12);
}

.z14-chart-wrap {
    height: 340px;
}

.z14-muted-box {
    color: var(--z14-muted);
}

/* COACH ACCORDION */
.z14-panel .accordion-item {
    background: transparent;
    border-color: var(--z14-panel-border) !important;
}

.z14-panel .accordion-button {
    color: var(--z14-text);
    background: transparent;
    box-shadow: none;
}

.z14-panel .accordion-button:not(.collapsed) {
    color: var(--z14-text);
    background: rgba(255, 255, 255, 0.04);
}

body[data-z14-theme="light"] .z14-panel .accordion-button:not(.collapsed) {
    background: rgba(0, 0, 0, 0.04);
}

.z14-panel .accordion-button:focus {
    box-shadow: 0 0 0 0.2rem rgba(111, 231, 221, 0.25);
}

body[data-z14-theme="light"] .z14-panel .accordion-button:focus {
    box-shadow: 0 0 0 0.2rem rgba(8, 145, 178, 0.25);
}

/* RESPONSIVE */
@media (max-width: 1199px) {
    .z14-sticky-panel {
        position: static !important;
    }
}
