/* Teacher-friendly optional themes for ChannelKids
   Scoped under body.teacher-theme-<name> to avoid affecting admin panel or other areas
*/

/* Soft pastel theme focused for docentes */
body.teacher-theme-soft {
    --primary-color: #2563eb; /* blue */
    --secondary-color: #0ea5a4; /* teal */
    --accent-color: #f59e0b; /* amber */
    --success-color: #10b981;
    --warning-color: #f97316;
    --danger-color: #ef4444;
    --dark-color: #0f172a;
    --light-color: #f8fafc;
}

/* High-contrast accessible theme */
body.teacher-theme-contrast {
    --primary-color: #0b3d91; /* strong blue */
    --secondary-color: #0b6623; /* strong green */
    --accent-color: #ffb703; /* vivid amber */
    --success-color: #017a3b;
    --warning-color: #b45309;
    --danger-color: #b91c1c;
    --dark-color: #071133;
    --light-color: #ffffff;
}

/* Kidsoo/Synphony removed: styles retired */
/* The Kidsoo theme has been removed from the system. Any legacy references should be cleaned.
   If you need to restore it, recreate the marketplace item and associated assets. */

/* Icon tweaks: substitute some emoji-like indicators with clearer glyphs for teacher theme */
body.teacher-theme-soft .ck-logo { filter: none; }
body.teacher-theme-soft .ck-header { background: linear-gradient(90deg, rgba(37,99,235,0.95), rgba(14,165,164,0.95)) !important; }
body.teacher-theme-contrast .ck-header { background: linear-gradient(90deg, rgba(11,61,145,0.98), rgba(11,102,35,0.98)) !important; }

/* Make cards easier on the eyes */
body.teacher-theme-soft .ck-item-card { background: linear-gradient(180deg,#ffffff,#f6f9fb); }
body.teacher-theme-contrast .ck-item-card { background: linear-gradient(180deg,#ffffff,#f3f6ff); box-shadow: 0 8px 30px rgba(2,6,23,0.12); }

/* Buttons */
body.teacher-theme-soft .btn-primary { background: linear-gradient(90deg,var(--primary-color), #38bdf8); }
body.teacher-theme-contrast .btn-primary { background: var(--primary-color); color: #fff; }

/* Navigation link hover tweaks for teacher themes */
body.teacher-theme-soft .ck-nav a:hover, body.teacher-theme-soft .ck-nav button:hover { background: rgba(255,255,255,0.12); }
body.teacher-theme-contrast .ck-nav a:hover, body.teacher-theme-contrast .ck-nav button:hover { background: rgba(255,255,255,0.08); }

/* Ensure footer uses theme dark color */
body.teacher-theme-soft .ck-footer, body.teacher-theme-contrast .ck-footer { background: var(--dark-color); }

/* Small icon replacement via pseudo elements for key header emojis (removed) */
/* Icons removed to avoid cluttering the logo across themes */

/* Apply theme variables broadly so most components pick up theme colors */
body.teacher-theme-soft,
body.teacher-theme-contrast {
    color-scheme: light;
}

/* Root-level variable fallbacks when theme applied on body */
body[class^="teacher-theme-"] {
    --ck-primary: var(--primary-color);
    --ck-secondary: var(--secondary-color);
    --ck-accent: var(--accent-color);
    --ck-success: var(--success-color);
    --ck-warning: var(--warning-color);
    --ck-danger: var(--danger-color);
    --ck-dark: var(--dark-color);
    --ck-light: var(--light-color);
}

/* Page background overrides so theme affects the whole page */
body.teacher-theme-soft { background: linear-gradient(135deg, #e6f0ff 0%, #f0fcfb 100%) !important; }
body.teacher-theme-contrast { background: linear-gradient(135deg, #e9eefc 0%, #eefef2 100%) !important; }

/* Module headers, panels and common layout elements */
body[class^="teacher-theme-"] .ck-module-header { background: linear-gradient(90deg,var(--ck-primary), rgba(255,255,255,0.95)); color: var(--ck-dark); }
body[class^="teacher-theme-"] .form-container, body[class^="teacher-theme-"] .ck-empty-state { background: linear-gradient(180deg,#ffffff, var(--ck-light)); border: 1px solid rgba(15,23,42,0.04); }

/* Ensure planeacion and prose content uses readable colors */
body[class^="teacher-theme-"] .planeacion-prose, body[class^="teacher-theme-"] .prose { color: rgba(15,23,42,0.9); }
body[class^="teacher-theme-"] .planeacion-prose table th, body[class^="teacher-theme-"] .planeacion-prose table td { border-color: rgba(15,23,42,0.06); }

/* Common badges and small UI elements */
body[class^="teacher-theme-"] .ck-badge { background: linear-gradient(90deg,var(--ck-primary), var(--ck-secondary)); color: white; }

/* Ensure icons inside module cards adapt */
body[class^="teacher-theme-"] .ck-item-cover { background: linear-gradient(90deg,var(--ck-primary), rgba(0,0,0,0.06)); }

/* Specific: make wide containers (main content) adopt softer bg to contrast header/footer */
body[class^="teacher-theme-"] .ck-main-content { background: transparent; }


/* Header, nav and logo */
body[class^="teacher-theme-"] .ck-header { background: linear-gradient(90deg,var(--ck-primary), var(--ck-secondary)) !important; }
body[class^="teacher-theme-"] .ck-logo { color: white; }
body[class^="teacher-theme-"] .ck-nav a, body[class^="teacher-theme-"] .ck-nav button { color: rgba(255,255,255,0.95); }

/* Footer */
body[class^="teacher-theme-"] .ck-footer { background: var(--ck-dark); color: white; }

/* Cards and module areas */
body[class^="teacher-theme-"] .ck-item-card { background: linear-gradient(180deg,#ffffff, var(--ck-light)); border: 1px solid rgba(15,23,42,0.03); }
body[class^="teacher-theme-"] .ck-item-title { color: var(--ck-dark); }
body[class^="teacher-theme-"] .ck-item-description { color: rgba(15,23,42,0.7); }

/* Buttons and CTAs */
body[class^="teacher-theme-"] .btn-primary, body[class^="teacher-theme-"] .ck-create-btn, body[class^="teacher-theme-"] .ck-action-btn.primary { background: linear-gradient(90deg,var(--ck-primary), var(--ck-secondary)); color: white; }
body[class^="teacher-theme-"] .btn-secondary { background: var(--ck-secondary); color: white; }

/* Badges */
body[class^="teacher-theme-"] .credits-badge, body[class^="teacher-theme-"] .premium-badge, body[class^="teacher-theme-"] .free-badge { background: linear-gradient(90deg,var(--ck-accent), #ffd873); color: #111; }

/* Nav dropdowns and panels - ensure readable contrast per theme */
body.teacher-theme-soft .ck-nav-dropdown-content { background: rgba(255,255,255,0.98); border-radius:10px; box-shadow:0 10px 30px rgba(2,6,23,0.08); }
body.teacher-theme-soft .ck-nav-dropdown-content a { color: var(--ck-dark) !important; }
body.teacher-theme-soft .ck-nav-dropdown-content a:hover { background: rgba(0,0,0,0.04); }

body.teacher-theme-contrast .ck-nav-dropdown-content { background: rgba(5,10,25,0.95); border-radius:10px; box-shadow:0 10px 40px rgba(2,6,23,0.25); }
body.teacher-theme-contrast .ck-nav-dropdown-content a { color: #fff !important; }
body.teacher-theme-contrast .ck-nav-dropdown-content a:hover { background: rgba(255,255,255,0.04); }

/* Fallback generic: keep links dark when dropdown is light */
body[class^="teacher-theme-"] .ck-nav-dropdown-content a { color: var(--ck-dark); }

/* Action buttons inside cards */
body[class^="teacher-theme-"] .ck-action-btn.secondary { background: rgba(0,0,0,0.06); color: var(--ck-dark); }

/* Icon color adjustments for FontAwesome icons used across the app */
body[class^="teacher-theme-"] i.fas, body[class^="teacher-theme-"] i.far, body[class^="teacher-theme-"] i.fab { color: white; filter: none; }

/* Make inputs and form accents use accent color */
body[class^="teacher-theme-"] input:focus, body[class^="teacher-theme-"] select:focus, body[class^="teacher-theme-"] textarea:focus { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--ck-accent) 12%, transparent); border-color: var(--ck-accent); }

/* Ensure mobile menu matches theme */
body[class^="teacher-theme-"] .mobile-menu { background: linear-gradient(135deg, var(--ck-primary), var(--ck-secondary)); }

/* Slightly stronger shadows for theme for better separation */
body[class^="teacher-theme-"] .ck-item-card { box-shadow: 0 8px 26px rgba(15,23,42,0.06); }

/* Keep everything else intact; these rules are intentionally scoped to body.teacher-theme-* */

/* Responsive component layer for teacher and classroom pages */
:where(.saas-dashboard, .saas-full-content, .saas-embed-content, .saas-container, .ck-main-content) {
    min-width: 0;
}

:where(.saas-dashboard, .saas-full-content, .saas-embed-content, .saas-container, .ck-main-content) :where(img, svg, video, canvas, iframe) {
    max-width: 100%;
    height: auto;
}

:where(.table-responsive, .saas-table-shell, .responsive-table-shell, .overflow-x-auto) {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 1024px) {
    .saas-container {
        padding: 28px 18px;
    }

    .saas-title {
        font-size: clamp(26px, 4vw, 32px);
    }

    .saas-subtitle {
        margin-bottom: 24px;
    }

    .saas-card,
    .form-container,
    .ck-empty-state {
        border-radius: 18px;
    }
}

@media (max-width: 768px) {
    .saas-container {
        padding: 22px 12px;
    }

    .saas-card {
        overflow: auto;
        -webkit-overflow-scrolling: touch;
    }

    .saas-table {
        min-width: 640px;
    }

    .saas-table thead th,
    .saas-table td {
        padding: 14px 16px;
    }

    .form-container,
    .ck-empty-state {
        padding: 20px 16px;
    }

    :where(.btn, .btn-primary, .btn-secondary, .btn-danger, .btn-link, .btn-action) {
        width: 100%;
        justify-content: center;
        white-space: normal;
    }

    :where(input, select, textarea, button) {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .saas-container {
        padding: 18px 10px;
    }

    .saas-card,
    .form-container,
    .ck-empty-state {
        border-radius: 16px;
    }

    .saas-title {
        font-size: clamp(22px, 6vw, 28px);
    }

    .saas-subtitle {
        font-size: 14px;
    }
}

/* ═══════════════════════════════════════════════════════════
   GLOBAL TEACHER / CLASSROOM BUTTON SYSTEM
   These rules apply on ALL classroom sub-pages regardless
   of theme (app or saas layout).
═══════════════════════════════════════════════════════════ */

/* ── Base button reset ── */
.btn,
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-link,
.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    line-height: 1.4;
    text-decoration: none !important;
    border: none;
    cursor: pointer;
    transition: all .2s ease;
    white-space: nowrap;
    vertical-align: middle;
    font-family: inherit;
}

/* ── Primary ── */
.btn-primary {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    color: #fff !important;
    box-shadow: 0 2px 10px rgba(16,185,129,0.25);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(16,185,129,0.35);
    filter: brightness(1.06);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled, .btn-primary.disabled {
    opacity: .55; cursor: not-allowed;
    transform: none !important; box-shadow: none !important;
    filter: grayscale(40%);
}

/* ── Secondary ── */
.btn-secondary {
    background: #f1f5f9 !important;
    color: #475569 !important;
    border: 1px solid #e2e8f0 !important;
}
.btn-secondary:hover { background: #e2e8f0 !important; color: #334155 !important; }

/* ── Danger ── */
.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
    color: #fff !important;
    box-shadow: 0 2px 10px rgba(239,68,68,0.25);
}
.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(239,68,68,0.35);
}

/* ── Link button ── */
.btn-link {
    background: transparent !important;
    color: #64748b !important;
    padding: 8px 18px;
    border: 1px solid #e2e8f0 !important;
}
.btn-link:hover { background: #f8fafc !important; color: #334155 !important; }

/* ── Action (small) ── */
.btn-action {
    padding: 8px 14px;
    font-size: 13px;
    border-radius: 10px;
}

/* ── Tiny / xs ── */
.btn-sm { padding: 7px 16px !important; font-size: 13px !important; border-radius: 10px !important; }
.btn-xs { padding: 5px 12px !important; font-size: 12px !important; border-radius: 8px !important; }

/* ── Ensure button groups have breathing room ── */
.btn + .btn,
.btn-primary + .btn-secondary,
.btn-primary + .btn-link,
.btn-danger + .btn-secondary,
.btn-danger + .btn-link,
.flex.gap-2 > *,
.flex.gap-3 > *,
.flex.gap-4 > *,
form button + a,
form a + button,
form button + button {
    margin-left: 12px;
}

/* ═══════════════════════════════════════════════════════════
   SAAS MODERN DESIGN SYSTEM (Notion / Stripe / Airtable)
═══════════════════════════════════════════════════════════ */

/* ── Layout Containers ── */
.saas-container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 40px 24px;
}

/* ── Typography & Hierarchy ── */
.saas-title {
    font-size: 32px;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}
.saas-subtitle {
    font-size: 16px;
    color: #64748b;
    margin-bottom: 32px;
    line-height: 1.6;
}

/* ── Modern Table System ── */
.saas-card {
    background: #ffffff;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    overflow: hidden;
    margin-bottom: 32px;
}

.saas-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.saas-table thead th {
    background: #f8fafc;
    color: #475569;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.1em;
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
}

.saas-table tbody tr {
    transition: background 0.2s ease;
}

.saas-table tbody tr:hover {
    background: #f8fafc;
}

.saas-table td {
    padding: 18px 24px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    color: #334155;
    font-size: 14px;
}

/* Row height requirement: min 60px */
.saas-table tbody tr td {
    height: 64px;
}

/* Actions in tables */
.saas-table .actions-cell {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

/* ── Action Buttons separation ── */
.action-buttons-group {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* ── Subtle Shadows & Borders ── */
.saas-shadow {
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.04), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
}

.saas-border {
    border: 1px solid #e2e8f0;
}


/* Forms — inline confirm dialogs, delete forms */
form[onsubmit*="confirm"] button,
form.inline button,
form.inline-flex button {
    padding: 8px 18px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 13px;
}

/* SweetAlert & browser dialogs */
.swal2-actions { gap: 14px !important; }
.swal2-confirm, .swal2-cancel {
    padding: 10px 26px !important;
    border-radius: 12px !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    min-width: 110px;
}

