/* ==========================================================================
   Creador de horario escolar y calendario de asignaturas - Estilos canónicos
   fijate.com
   ========================================================================== */

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-title: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Tema oscuro por defecto (Midnight Slate) */
  --bg-app: #0b0f17;
  --bg-card: #131b2c;
  --bg-card-hover: #192339;
  --bg-input: #0e1422;
  --border-color: #1f2d45;
  --border-light: #2a3d5e;
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-blue: #3b82f6;
  --accent-blue-hover: #2563eb;
  --accent-teal: #0d9488;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --accent-purple: #8b5cf6;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.4);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 22px;
}

[data-theme="light"] {
  --bg-app: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-input: #f8fafc;
  --border-color: #e2e8f0;
  --border-light: #cbd5e1;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 10px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.08);
}

/* Reset y estructura general */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
  width: 100%;
}

.tool-layout {
  max-width: 1200px;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
  width: 100%;
  flex: 1 0 auto;
}

/* Tipografía */
h1, h2, h3, h4, .brand-title {
  font-family: var(--font-title);
  color: var(--text-primary);
  font-weight: 700;
  letter-spacing: -0.015em;
}

/* Barra de introducción de la herramienta */
.tool-hero-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: linear-gradient(135deg, var(--bg-card) 0%, rgba(37, 99, 235, 0.08) 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.tool-hero-info h1 {
  font-size: 1.65rem;
  line-height: 1.25;
  margin-bottom: 0.35rem;
}

.tool-hero-info p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  max-width: 900px;
  line-height: 1.55;
  margin: 0;
}

.tool-badges-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.badge-tag.highlight {
  background: rgba(37, 99, 235, 0.12);
  border-color: rgba(37, 99, 235, 0.35);
  color: #60a5fa;
}

[data-theme="light"] .badge-tag.highlight {
  background: rgba(37, 99, 235, 0.1);
  border-color: rgba(37, 99, 235, 0.25);
  color: #1d4ed8;
}

/* Barra de pestañas de navegación interna */
.tool-nav-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.tool-nav-tabs::-webkit-scrollbar {
  display: none;
}

.nav-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  font-family: var(--font-title);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.nav-tab-btn:hover {
  color: var(--text-primary);
}

.nav-tab-btn.active {
  color: var(--accent-blue);
  border-bottom-color: var(--accent-blue);
}

.tab-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
  border-radius: 9999px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
}

/* Selector de presets rápidos */
.presets-strip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  padding: 0.85rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.presets-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-preset-chip {
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-preset-chip:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-light);
}

.btn-preset-chip.active {
  background: rgba(37, 99, 235, 0.15);
  color: #60a5fa;
  border-color: var(--accent-blue);
  font-weight: 600;
}

[data-theme="light"] .btn-preset-chip.active {
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
}

/* Paleta de asignaturas flotante / superior */
.subjects-palette-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.palette-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.palette-title {
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.palette-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-sm-action {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 36px;
}

.btn-sm-action:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
}

.btn-sm-action.primary {
  background: var(--accent-blue);
  color: #ffffff;
  border-color: var(--accent-blue);
}

.btn-sm-action.primary:hover {
  background: var(--accent-blue-hover);
}

/* Lista horizontal de chips de asignaturas */
.subjects-chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.subject-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-md);
  background: var(--bg-input);
  border: 1.5px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.subject-chip:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
  transform: translateY(-1px);
}

.subject-chip.selected {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.35);
  font-weight: 600;
}

.subject-chip-color {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}

.subject-chip-code {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.78rem;
}

.subject-chip-name {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.subject-chip-room {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-secondary);
  background: var(--bg-card);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

.subject-chip.tool-eraser {
  background: rgba(244, 63, 94, 0.08);
  border-color: rgba(244, 63, 94, 0.25);
  color: #fda4af;
}

.subject-chip.tool-eraser.selected {
  border-color: var(--accent-rose);
  box-shadow: 0 0 0 2px rgba(244, 63, 94, 0.35);
}

/* Contenedor de la cuadrícula del horario */
.schedule-grid-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.grid-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.grid-status-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.hours-counter-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-primary);
}

/* Tabla del horario interactivo */
.schedule-table-scroll {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  -webkit-overflow-scrolling: touch;
}

.schedule-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  table-layout: fixed;
}

.schedule-table th,
.schedule-table td {
  padding: 0.65rem 0.5rem;
  text-align: center;
  border: 1px solid var(--border-color);
  vertical-align: middle;
}

.schedule-table th {
  background: var(--bg-card);
  font-family: var(--font-title);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
}

.col-time-header {
  width: 105px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.time-slot-cell {
  background: var(--bg-card);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.3;
}

.time-slot-start {
  font-weight: 700;
  color: var(--text-primary);
}

.time-slot-label {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Fila de recreo / descanso */
.row-break td {
  background: rgba(148, 163, 184, 0.08);
  padding: 0.5rem;
}

.break-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.03em;
}

/* Celdas lectivas interactivas */
.class-cell {
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  height: 68px;
  background: var(--bg-input);
}

.class-cell:hover {
  background: var(--bg-card-hover);
}

.class-card-inner {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.2rem;
  height: 100%;
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  transition: transform 0.1s ease;
}

.class-card-inner:hover {
  transform: scale(1.02);
}

.cell-subject-code {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.cell-classroom-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.28);
  padding: 0.08rem 0.35rem;
  border-radius: 3px;
  white-space: nowrap;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cell-empty-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  opacity: 0.6;
}

/* ==========================================================================
   PESTAÑA 2: TABLÓN DE TAREAS Y ENTREGAS CLASSROOM
   ========================================================================== */
.tasks-board-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
}

.tasks-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.tasks-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.tasks-card-title {
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Formulario para añadir tarea */
.add-task-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding: 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.form-group-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

/* Inputs y Selects canónicos */
.styled-input,
.styled-select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 42px;
  min-height: 42px;
  padding: 0 0.85rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s ease;
}

.styled-input:focus,
.styled-select:focus {
  border-color: var(--accent-blue);
}

.styled-select {
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

.styled-select option,
.styled-select optgroup {
  background-color: var(--bg-card);
  color: var(--text-primary);
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-blue);
  cursor: pointer;
}

/* Lista de tareas */
.tasks-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.task-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent-blue);
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.task-item.completed {
  opacity: 0.6;
}

.task-item.completed .task-title {
  text-decoration: line-through;
}

.task-checkbox {
  width: 20px;
  height: 20px;
  accent-color: var(--accent-blue);
  cursor: pointer;
  margin-top: 2px;
  flex-shrink: 0;
}

.task-body {
  flex: 1;
  min-width: 0;
}

.task-meta-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.25rem;
}

.task-subject-badge {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.72rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  color: #ffffff;
}

.task-badge-exam {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.35);
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
}

.task-badge-classroom {
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(13, 148, 136, 0.15);
  color: #2dd4bf;
  border: 1px solid rgba(13, 148, 136, 0.35);
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
}

.task-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-word;
}

.task-meta-bottom {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.btn-task-delete {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
}

.btn-task-delete:hover {
  color: var(--accent-rose);
}

/* Tarjetas de material escolar por día */
.backpack-days-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.backpack-day-card {
  padding: 0.85rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.backpack-day-header {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-blue);
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.backpack-day-items {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ==========================================================================
   PESTAÑA 3: EXPORTACIONES Y FONDOS DE PANTALLA
   ========================================================================== */
.export-workspace-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.5rem;
}

@media (max-width: 900px) {
  .export-workspace-grid {
    grid-template-columns: 1fr;
  }
}

.export-options-column {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.export-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.export-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.export-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(37, 99, 235, 0.12);
  color: var(--accent-blue);
  flex-shrink: 0;
}

.export-card-icon.green {
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-emerald);
}

.export-card-icon.purple {
  background: rgba(139, 92, 246, 0.12);
  color: var(--accent-purple);
}

.export-card-title {
  font-size: 1.1rem;
}

.export-card-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

/* Selector de estilos visuales para fondo */
.theme-selector-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.btn-theme-choice {
  padding: 0.65rem 0.85rem;
  background: var(--bg-input);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-theme-choice:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.btn-theme-choice.active {
  border-color: var(--accent-blue);
  background: rgba(37, 99, 235, 0.1);
  color: #60a5fa;
  font-weight: 600;
}

.theme-bullet {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.btn-large-action {
  width: 100%;
  height: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--accent-blue);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-title);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.btn-large-action:hover {
  background: var(--accent-blue-hover);
}

.btn-large-action.green {
  background: var(--accent-emerald);
}

.btn-large-action.green:hover {
  background: #059669;
}

.btn-large-action.secondary {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-large-action.secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-light);
}

/* Columna de vista previa del móvil */
.phone-mockup-column {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.phone-mockup-frame {
  width: 280px;
  height: 570px;
  border-radius: 40px;
  border: 10px solid #1f293d;
  background: #000000;
  box-shadow: var(--shadow-lg), 0 0 0 2px rgba(255, 255, 255, 0.08);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.phone-notch {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 90px;
  height: 18px;
  background: #090d16;
  border-radius: 12px;
  z-index: 10;
}

.phone-preview-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.phone-preview-caption {
  margin-top: 0.75rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
}

/* ==========================================================================
   MODALES ACCESIBLES (CERO WINDOW.ALERT)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow: hidden;
  transform: translateY(15px);
  transition: transform 0.2s ease;
}

.modal-overlay.active .modal-card {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-title {
  font-size: 1.15rem;
}

.btn-modal-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-modal-close:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  background: var(--bg-input);
}

.field-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

/* Fila de color picker estilizado */
.color-picker-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.color-input-styled {
  width: 46px;
  height: 42px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
}

.quick-colors-row {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.color-dot-choice {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.15s ease;
}

.color-dot-choice:hover {
  transform: scale(1.15);
}

.color-dot-choice.selected {
  border-color: #ffffff;
  box-shadow: 0 0 0 2px var(--accent-blue);
}

/* Filas editables de tramos horarios */
.slot-edit-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.65rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: background-color 0.15s ease;
}

.slot-edit-row:hover {
  background: var(--bg-card-hover);
}

.slot-edit-row.break {
  border-left: 4px solid var(--accent-amber);
}

.slot-edit-row.class {
  border-left: 4px solid var(--accent-blue);
}

.slot-type-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  width: 58px;
  text-align: center;
  flex-shrink: 0;
}

.slot-type-badge.class {
  background: rgba(37, 99, 235, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(37, 99, 235, 0.3);
}

.slot-type-badge.break {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.slot-input-label {
  flex: 1.2;
  min-width: 0;
  height: 38px;
  min-height: 38px;
}

.slot-input-time {
  width: 118px;
  min-width: 118px;
  flex-shrink: 0;
  height: 38px;
  min-height: 38px;
  padding: 0 0.35rem 0 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  text-align: center;
}

.slot-input-time::-webkit-calendar-picker-indicator {
  cursor: pointer;
  padding: 0;
  margin-left: 2px;
  opacity: 0.65;
}

.slot-input-time::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

.btn-slot-delete {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.35rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
  flex-shrink: 0;
}

.btn-slot-delete:hover {
  color: var(--accent-rose);
}

.print-only-title {
  display: none;
}

/* ==========================================================================
   WIDGET EN VIVO: AHORA Y SIGUIENTE (LIVE CLASSROOM STATUS)
   ========================================================================== */
.live-status-card {
  background: linear-gradient(135deg, var(--bg-card) 0%, rgba(37, 99, 235, 0.08) 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.4rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease;
}

.live-status-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

[data-theme="light"] .live-status-header {
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.live-status-indicator {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.live-pulse-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  display: inline-block;
  animation: pulseDot 2s infinite ease-in-out;
}

.live-pulse-dot.break {
  background: #f59e0b;
  box-shadow: 0 0 8px #f59e0b;
}

.live-pulse-dot.idle {
  background: #64748b;
  box-shadow: none;
  animation: none;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}

.live-status-mode {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.live-status-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.live-day-tag {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.live-clock-text {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--accent-blue);
}

.live-status-content {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 1rem;
}

@media (max-width: 768px) {
  .live-status-content {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
}

.live-sublabel {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.live-current-box {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
}

.live-current-subject {
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.25;
  margin-bottom: 0.35rem;
}

.live-current-details {
  font-size: 0.86rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.live-progress-bar-wrap {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  margin-top: 0.75rem;
  overflow: hidden;
}

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

.live-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-blue) 0%, #60a5fa 100%);
  border-radius: 9999px;
  transition: width 0.4s ease;
}

.live-next-box {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.live-next-subject {
  font-family: var(--font-title);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}

.live-next-details {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Buscador rápido de asignaturas y aulas */
.grid-search-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.6rem;
  transition: border-color 0.2s ease;
}

.grid-search-wrap:focus-within {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.grid-search-wrap input {
  background: transparent;
  border: none;
  outline: none;
  font-size: 0.82rem;
  color: var(--text-primary);
  width: 170px;
}

.btn-clear-search {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.2rem;
}

.btn-clear-search:hover {
  color: var(--text-primary);
}

/* Efecto de filtrado en celdas de cuadrícula */
.class-cell.is-dimmed {
  opacity: 0.2;
  filter: grayscale(0.7);
  transition: opacity 0.2s ease, filter 0.2s ease;
}

.class-cell.is-match .class-card-inner {
  outline: 2px solid #60a5fa;
  box-shadow: 0 0 14px rgba(96, 165, 250, 0.6);
  transform: scale(1.03);
  z-index: 2;
}

/* Badges de tareas y exámenes en celda semanal */
.cell-task-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.05rem 0.35rem;
  border-radius: 3px;
  line-height: 1.2;
  margin-top: 1px;
}

.cell-task-badge.exam {
  background: rgba(244, 63, 94, 0.32);
  border: 1px solid rgba(244, 63, 94, 0.6);
  color: #ffffff;
}

.cell-task-badge.classroom {
  background: rgba(37, 99, 235, 0.35);
  border: 1px solid rgba(37, 99, 235, 0.6);
  color: #ffffff;
}

/* Modal de Compartir Horario con QR */
.modal-card-share {
  max-width: 580px;
}

.share-grid-layout {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 1.25rem;
  align-items: center;
}

@media (max-width: 580px) {
  .share-grid-layout {
    grid-template-columns: 1fr;
    justify-items: center;
  }
}

.share-qr-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
}

.share-qr-box {
  width: 160px;
  height: 160px;
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.share-qr-box canvas,
.share-qr-box svg {
  max-width: 100% !important;
  max-height: 100% !important;
  display: block;
}

.share-qr-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

.share-link-column {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}

.share-input-group {
  display: flex;
  gap: 0.5rem;
}

.share-input-group input {
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

/* ==========================================================================
   ESTILOS DE IMPRESIÓN A4 HORIZONTAL (@media print)
   ========================================================================== */
@page {
  size: landscape;
  margin: 8mm 12mm;
}

@media print {
  html, body {
    background: #ffffff !important;
    color: #000000 !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }

  /* Ocultar elementos institucionales, navegación, banners, modales y la GUÍA PEDAGÓGICA */
  .app-header,
  .tools-ad-banner-section,
  .tool-ad-sidebar,
  .fijate-footer,
  .tool-hero-bar,
  .tool-nav-tabs,
  .live-status-card,
  .presets-strip,
  .subjects-palette-card,
  .grid-toolbar,
  .btn-sm-action,
  .export-workspace-grid,
  .modal-overlay,
  .guide-pedagogica-section,
  .tasks-card,
  #pane-tasks,
  #pane-export {
    display: none !important;
  }

  /* Forzar visualización de la cuadrícula horaria independientemente de la pestaña activa */
  #pane-schedule {
    display: block !important;
  }

  .tool-layout {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .schedule-grid-container {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #ffffff !important;
  }

  /* Cabecera limpia de impresión */
  .print-only-title {
    display: flex !important;
    justify-content: space-between;
    align-items: baseline;
    border-bottom: 2px solid #000000;
    padding-bottom: 4px;
    margin-bottom: 12px;
  }

  .print-only-title h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: #000000;
    margin: 0;
  }

  .print-only-title .print-subtitle {
    font-size: 0.82rem;
    color: #475569;
    font-family: var(--font-mono);
  }

  .schedule-table-scroll {
    border: 1.5px solid #000000 !important;
    background: #ffffff !important;
    overflow: visible !important;
  }

  .schedule-table {
    min-width: 100% !important;
    width: 100% !important;
    border-collapse: collapse !important;
  }

  .schedule-table th,
  .schedule-table td {
    border: 1px solid #000000 !important;
    color: #000000 !important;
    padding: 5px 6px !important;
  }

  .schedule-table th {
    background: #f1f5f9 !important;
    color: #000000 !important;
    font-weight: 700 !important;
    font-size: 0.85rem !important;
  }

  .time-slot-cell {
    background: #f8fafc !important;
    color: #000000 !important;
    padding: 4px 6px !important;
  }

  .time-slot-start {
    color: #000000 !important;
    font-weight: 700 !important;
  }

  .time-slot-label {
    color: #475569 !important;
  }

  .row-break td {
    background: #e2e8f0 !important;
    padding: 4px !important;
  }

  .break-banner {
    color: #000000 !important;
    font-weight: 700 !important;
    font-size: 0.8rem !important;
  }

  .class-cell {
    height: auto !important;
    min-height: 44px !important;
    background: #ffffff !important;
    padding: 3px !important;
  }

  .class-card-inner {
    border: 1px solid #334155 !important;
    color: #000000 !important;
    background: #f8fafc !important;
    box-shadow: none !important;
    padding: 4px 2px !important;
  }

  .cell-subject-code {
    text-shadow: none !important;
    color: #000000 !important;
    font-size: 0.85rem !important;
    font-weight: 700 !important;
  }

  .cell-classroom-tag {
    background: #e2e8f0 !important;
    color: #000000 !important;
    border: 1px solid #64748b !important;
    font-size: 0.65rem !important;
    font-weight: 600 !important;
  }

  .cell-empty-text {
    display: none !important;
  }
}
