/* Tokens de tema. El resto de CSS debe usar estas variables, no hex sueltos.
   Oscuro es el default actual. El claro se activa con html[data-theme="light"]. */

:root,
html[data-theme="dark"] {
    color-scheme: dark;

    --font-sans: 'Poppins', 'Segoe UI', system-ui, sans-serif;
    --font-ui: 'Inter', 'Segoe UI', sans-serif;
    --font-mono: 'Courier New', monospace;
    --font-code: 'Consolas', 'Monaco', 'Courier New', monospace;

    --nav-height: 58px;
    --sidebar-width: 300px;
    --subject-bar-height: 42px;
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 10px;
    --radius-pill: 20px;
    --radius-full: 999px;

    --color-accent: #4f46e5;
    --color-accent-hover: #4338ca;
    --color-accent-soft: #818cf8;
    --color-accent-muted: #a5b4fc;
    --color-success: #10b981;
    --color-success-strong: #059669;
    --color-success-deeper: #047857;
    --color-success-text: #6ee7b7;
    --color-warning: #F59E0B;
    --color-warning-strong: #d97706;
    --color-danger: #ef4444;
    --color-danger-strong: #dc2626;
    --color-danger-strong-hover: #b91c1c;
    --color-info: #3b82f6;
    --color-warning-text: #fcd34d;
    --color-info-text: #93c5fd;

    --color-lang-php: #777BB4;
    --color-lang-php-deep: #5a5e8a;
    --color-lang-html: #E34F26;
    --color-lang-html-deep: #b03d1e;
    --color-lang-js: #c9a800;
    --color-lang-js-deep: #a38700;
    --color-lang-js-bright: #F7DF1E;
    --color-lang-mysql: #00758F;
    --color-lang-mysql-deep: #005a6e;
    --color-lang-python: #3776AB;
    --color-lang-python-deep: #285d87;
    --color-lang-css: #264DE4;
    --color-lang-css-deep: #1a35a8;
    --color-lang-guia: #374151;
    --color-lang-guia-deep: #1f2937;
    --color-lang-guia-border: rgba(229, 231, 235, .2);

    --color-bg: #1a1a1a;
    --color-bg-elevated: #1e1e1e;
    --color-bg-sunken: #000;
    --color-subject-bar: #111;
    --color-subject-bar-hover: #202020;
    --color-surface: #252525;
    --color-surface-2: #2d2d2d;
    --color-surface-hover: #3d3d3d;
    --color-nav: #4e4e4e;
    --color-search: #2f3640;
    --color-search-hover: #414b57;
    --color-sidebar-active: #28303b;

    --color-text: #f5f6f4;
    --color-text-strong: #fff;
    --color-text-heading: #f8fafc;
    --color-text-menu: #e5e7eb;
    --color-text-body: #d4d4d4;
    --color-text-soft: #a0a0a0;
    --color-text-muted: #94a3b8;
    --color-text-subtle: #666;
    --color-text-faint: #555;
    --color-text-nav: rgb(184, 187, 191);
    --color-text-link: #cbd5e1;
    --color-text-placeholder: #6b7280;
    --color-text-blockquote: #aaa;
    --color-text-copy: #888;
    --color-text-on-brand: #fff;
    --color-text-tutorial: #B6BABE;
    --color-text-caption: #9ca3af;
    --color-text-dim: #4b5563;
    --color-text-readable: #ffffff; /* antes #6b7280: mal contraste sobre fondo oscuro */
    --color-btn-edit: #e5e7eb;       /* botones Modificar: gris muy claro */
    --color-btn-edit-hover: #ffffff; /* hover: blanco puro */
    --color-ui-white: #ffffff;       /* filtro del aula e input del chat: letras y bordes */

    --color-border: #333;
    --color-border-item: #262626;
    --color-border-strong: #404040;
    --color-border-footer: #273244;
    --color-border-copy: #444;
    --color-border-image: #343b48;
    --color-border-soft: rgba(148, 163, 184, .22);
    --color-border-softer: rgba(148, 163, 184, .18);
    --color-border-control: #3d3d3d;

    --color-card: #1a2030;
    --color-code-inset: #0d0d0d;
    --color-note-info-bg: #1e2a3a;
    --color-note-warning-bg: #2a2010;
    --color-note-tip-bg: #0f2a1e;

    --color-overlay-white: rgba(255, 255, 255, .08);
    --color-overlay-white-soft: rgba(255, 255, 255, .05);
    --color-overlay-white-strong: rgba(255, 255, 255, .1);
    --color-overlay-dim: rgba(0, 0, 0, .6);
    --color-scrollbar: #4b5563;
    --color-accent-overlay: rgba(79, 70, 229, .16);
    --color-accent-overlay-strong: rgba(79, 70, 229, .22);
    --color-accent-glow: rgba(79, 70, 229, .4);
    --color-success-overlay: rgba(16, 185, 129, .08);
    --color-success-strong-overlay: rgba(5, 150, 105, .12);
    --color-success-strong-border: rgba(5, 150, 105, .25);
    --color-danger-overlay: rgba(239, 68, 68, .08);
    --color-danger-overlay-strong: rgba(239, 68, 68, .1);
    --color-danger-border: rgba(239, 68, 68, .2);

    --color-menu-bg: rgba(15, 23, 42, .98);
    --color-shadow: rgba(0, 0, 0, .35);
    --color-shadow-search: rgba(0, 0, 0, .12);
    --color-shadow-toast: rgba(0, 0, 0, .5);

    --color-error-bg: #2d1515;
    --color-error-border: #7f1d1d;
    --color-error-text: #fca5a5;
    --color-table-alt: #1a1a2e;

    --color-aula: #1e2535;
    --color-aula-sunken: #151b28;
    --color-aula-inset: #182131;
    --color-aula-hover: #202a3d;
    --color-aula-card-hover: #222b3c;
    --color-aula-border: #2d3748;
    --color-aula-border-input: #1e293b;
    --color-aula-border-search: #3d4a60;
    --color-slate: #334155;
    --color-text-slate: #64748b;
    --color-text-indigo: #c7d2fe;
    --color-text-filter-hover: #e2e8f0;
    --color-accent-bright: #6366f1;
    --color-accent-ring: rgba(99, 102, 241, .15);
    --color-accent-overlay-faint: rgba(79, 70, 229, .04);
    --color-accent-overlay-mid: rgba(79, 70, 229, .18);
    --color-accent-shadow: rgba(79, 70, 229, .28);
    --color-overlay-modal: rgba(0, 0, 0, .75);
    --color-danger-soft: #f87171;
    --color-aula-ok-text: #a7f3d0;
    --color-status-default-bg: rgba(99, 102, 241, .16);
    --color-status-ok-bg: rgba(5, 150, 105, .17);
    --color-status-anuncio-bg: rgba(14, 165, 233, .15);
    --color-status-anuncio-text: #bae6fd;
    --color-status-recurso-bg: rgba(168, 85, 247, .15);
    --color-status-recurso-text: #e9d5ff;
    --color-status-actividad-bg: rgba(245, 158, 11, .14);
    --color-status-actividad-text: #fde68a;
    --color-examen: #8b5cf6;
    --color-status-examen-bg: rgba(139, 92, 246, .16);
    --color-status-examen-text: #ddd6fe;
    --color-deadline: #fcd34d;
    --color-file-ok: #16a34a;
    --color-file-ok-bg: rgba(22, 163, 74, .08);
    --color-file-ok-text: #86efac;
    --color-notif-new-bg: #3730a3;
    --color-notif-new-text: #ddd6fe;

    --icon-filter: invert(1);
    --icon-filter-muted: invert(1) opacity(.75);
    --icon-filter-soft: invert(1) opacity(.7);
    --icon-filter-faint: invert(1) opacity(.18);
    --icon-calendar-filter: invert(.7) sepia(0) saturate(1) hue-rotate(0deg);
    --icon-calendar-filter-hover: invert(1);
    --icon-select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://w3.org' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
}

html[data-theme="light"] {
    color-scheme: light;

    --color-bg: #f4f5f7;
    --color-bg-elevated: #ffffff;
    --color-bg-sunken: #e8eaed;
    --color-subject-bar: #f1f5f9;
    --color-subject-bar-hover: #e2e8f0;
    --color-surface: #eef0f3;
    --color-surface-2: #e5e7eb;
    --color-surface-hover: #d1d5db;
    --color-nav: #e5e7eb;
    --color-search: #ffffff;
    --color-search-hover: #e5e7eb;
    --color-sidebar-active: #dbe0ea;

    --color-text: #1f2937;
    --color-text-strong: #111827;
    --color-text-heading: #0f172a;
    --color-text-menu: #1f2937;
    --color-text-body: #334155;
    --color-text-soft: #6b7280;
    --color-text-muted: #64748b;
    --color-text-subtle: #6b7280;
    --color-text-faint: #9ca3af;
    --color-text-nav: #4b5563;
    --color-text-link: #334155;
    --color-text-placeholder: #6b7280;
    --color-text-blockquote: #64748b;
    --color-text-copy: #6b7280;
    --color-text-on-brand: #fff;
    --color-text-tutorial: #475569;
    --color-text-caption: #6b7280;
    --color-text-dim: #9ca3af;
    --color-text-readable: #6b7280; /* tema claro: el gris original se lee bien sobre fondo claro */
    --color-btn-edit: #4b5563;       /* tema claro: el blanco no se vería, se invierte */
    --color-btn-edit-hover: #111827;
    --color-ui-white: #111827;       /* tema claro: el blanco no se vería, se invierte */

    --color-border: #d1d5db;
    --color-border-item: #e2e8f0;
    --color-border-strong: #cbd5e1;
    --color-border-footer: #e2e8f0;
    --color-border-copy: #cbd5e1;
    --color-border-image: #cbd5e1;
    --color-border-soft: rgba(15, 23, 42, .12);
    --color-border-softer: rgba(15, 23, 42, .1);
    --color-border-control: #cbd5e1;

    --color-card: #ffffff;
    --color-code-inset: #f1f5f9;
    --color-note-info-bg: #e8eef8;
    --color-note-warning-bg: #fff7ed;
    --color-note-tip-bg: #ecfdf5;
    --color-lang-guia-border: rgba(15, 23, 42, .12);

    --color-overlay-white: rgba(15, 23, 42, .08);
    --color-overlay-white-soft: rgba(15, 23, 42, .05);
    --color-overlay-white-strong: rgba(15, 23, 42, .1);
    --color-overlay-dim: rgba(15, 23, 42, .4);
    --color-scrollbar: #94a3b8;
    --color-menu-bg: rgba(255, 255, 255, .98);
    --color-shadow: rgba(15, 23, 42, .18);
    --color-shadow-search: rgba(15, 23, 42, .08);
    --color-shadow-toast: rgba(15, 23, 42, .22);
    --color-accent-glow: rgba(79, 70, 229, .28);

    --color-error-bg: #fee2e2;
    --color-error-border: #fca5a5;
    --color-error-text: #991b1b;
    --color-table-alt: #eef2ff;
    --color-success-text: #047857;
    --color-warning-text: #b45309;
    --color-info-text: #1d4ed8;

    --color-aula: #ffffff;
    --color-aula-sunken: #f1f5f9;
    --color-aula-inset: #f8fafc;
    --color-aula-hover: #e8eef6;
    --color-aula-card-hover: #eef2f7;
    --color-aula-border: #e2e8f0;
    --color-aula-border-input: #cbd5e1;
    --color-aula-border-search: #cbd5e1;
    --color-slate: #cbd5e1;
    --color-text-slate: #64748b;
    --color-text-indigo: #4338ca;
    --color-text-filter-hover: #0f172a;
    --color-overlay-modal: rgba(15, 23, 42, .55);
    --color-aula-ok-text: #047857;
    --color-status-default-bg: rgba(99, 102, 241, .12);
    --color-status-ok-bg: rgba(5, 150, 105, .12);
    --color-status-anuncio-bg: rgba(14, 165, 233, .12);
    --color-status-anuncio-text: #0369a1;
    --color-status-recurso-bg: rgba(168, 85, 247, .12);
    --color-status-recurso-text: #7e22ce;
    --color-status-actividad-bg: rgba(245, 158, 11, .14);
    --color-status-actividad-text: #b45309;
    --color-examen: #7c3aed;
    --color-status-examen-bg: rgba(124, 58, 237, .12);
    --color-status-examen-text: #6d28d9;
    --color-deadline: #b45309;
    --color-file-ok: #16a34a;
    --color-file-ok-bg: rgba(22, 163, 74, .08);
    --color-file-ok-text: #166534;
    --color-notif-new-bg: #e0e7ff;
    --color-notif-new-text: #3730a3;
    --color-danger-soft: #dc2626;

    --icon-filter: none;
    --icon-filter-muted: opacity(.75);
    --icon-filter-soft: opacity(.7);
    --icon-filter-faint: opacity(.35);
    --icon-calendar-filter: none;
    --icon-calendar-filter-hover: opacity(.85);
    --icon-select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23475569'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
}