/* ==========================================================================
   Thesis Studio - Estructurador y Cronograma de TFG / TFM
   Estilos corporativos Fíjate Tools con soporte para temas claro / oscuro
   ========================================================================== */

:root {
  /* Tipografías corporativas */
  --font-main: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Outfit', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Paleta Tema Oscuro (Predeterminado) */
  --bg-page: #080d1a;
  --bg-card: #0f172a;
  --bg-card-alt: #17223b;
  --bg-card-hover: #1e2d4d;
  --bg-input: #0b1120;
  --border-color: #1e293b;
  --border-focus: #3b82f6;
  --border-highlight: #334155;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-glow: rgba(59, 130, 246, 0.25);
  --primary-text: #ffffff;

  --accent-gold: #f59e0b;
  --accent-gold-bg: rgba(245, 158, 11, 0.12);
  --accent-emerald: #10b981;
  --accent-emerald-bg: rgba(16, 185, 129, 0.12);
  --accent-cyan: #06b6d4;
  --accent-cyan-bg: rgba(6, 182, 212, 0.12);
  --accent-purple: #8b5cf6;
  --accent-purple-bg: rgba(139, 92, 246, 0.12);
  --accent-rose: #f43f5e;
  --accent-rose-bg: rgba(244, 63, 94, 0.12);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.15);
}

[data-theme="light"] {
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-alt: #f1f5f9;
  --bg-card-hover: #e2e8f0;
  --bg-input: #ffffff;
  --border-color: #cbd5e1;
  --border-focus: #2563eb;
  --border-highlight: #94a3b8;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-glow: rgba(37, 99, 235, 0.15);
  --primary-text: #ffffff;

  --accent-gold: #d97706;
  --accent-gold-bg: rgba(217, 119, 6, 0.1);
  --accent-emerald: #059669;
  --accent-emerald-bg: rgba(5, 150, 105, 0.1);
  --accent-cyan: #0891b2;
  --accent-cyan-bg: rgba(8, 145, 178, 0.1);
  --accent-purple: #7c3aed;
  --accent-purple-bg: rgba(124, 58, 237, 0.1);
  --accent-rose: #e11d48;
  --accent-rose-bg: rgba(225, 29, 72, 0.1);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 20px rgba(37, 99, 235, 0.1);
}

/* ==========================================================================
   Estilos base y Layout
   ========================================================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-page);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.25;
}

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

.tool-with-sidebar {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
}

@media (min-width: 1536px) {
  .tool-with-sidebar {
    grid-template-columns: minmax(0, 1fr) 300px;
  }
}

.tool-main-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-width: 0;
}

/* ==========================================================================
   Tarjetas y contenedores
   ========================================================================== */

.card-main {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.card-main:hover {
  border-color: var(--border-highlight);
}

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

.section-title {
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}

.section-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  max-width: 760px;
}

.header-tools-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

/* ==========================================================================
   Configuración del proyecto académico (Setup Card)
   ========================================================================== */

.project-setup-card {
  background: linear-gradient(145deg, var(--bg-card), var(--bg-card-alt));
  border: 1px solid var(--border-highlight);
}

.project-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.project-title-group {
  flex: 1;
  min-width: 260px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background-color: var(--primary-glow);
  color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 999px;
  white-space: nowrap;
}

.project-title-input {
  width: 100%;
  background: transparent;
  border: 1px dashed transparent;
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.project-title-input:hover {
  border-color: var(--border-highlight);
  background-color: var(--bg-input);
}

.project-title-input:focus {
  outline: none;
  border-color: var(--border-focus);
  background-color: var(--bg-input);
  box-shadow: var(--shadow-glow);
}

.setup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* Formularios y controles */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-label {
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-select,
.form-input,
.form-textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0.5rem 0.75rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.9rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-select {
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
}

.form-textarea {
  height: auto;
  min-height: 80px;
  resize: vertical;
}

.form-select:focus,
.form-input:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Barra de métricas y resumen rápido */
.project-stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-color);
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.stat-icon-wrap {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-days .stat-icon-wrap { background: var(--accent-gold-bg); color: var(--accent-gold); }
.stat-progress .stat-icon-wrap { background: var(--accent-emerald-bg); color: var(--accent-emerald); }
.stat-words .stat-icon-wrap { background: var(--accent-cyan-bg); color: var(--accent-cyan); }
.stat-pace .stat-icon-wrap { background: var(--accent-purple-bg); color: var(--accent-purple); }

.stat-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   Pestañas de navegación
   ========================================================================== */

.tool-tabs {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border-color);
  scrollbar-width: thin;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: transparent;
  border: 1px solid transparent;
  border-bottom: 2px solid transparent;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  color: var(--text-muted);
  font-family: var(--font-main);
  font-size: 0.925rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  min-height: 44px;
}

.tab-btn:hover {
  color: var(--text-main);
  background-color: var(--bg-card-alt);
}

.tab-btn.active {
  color: var(--primary);
  background-color: var(--bg-card);
  border-color: var(--border-color);
  border-bottom-color: var(--primary);
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeInTab 0.25s ease;
}

@keyframes fadeInTab {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Botones institucionales
   ========================================================================== */

.btn-primary,
.btn-secondary,
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.55rem 1.1rem;
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 40px;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--primary);
  color: var(--primary-text);
  box-shadow: 0 2px 6px var(--primary-glow);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-secondary {
  background-color: var(--bg-card-alt);
  border-color: var(--border-color);
  color: var(--text-main);
}

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

.btn-danger {
  background-color: var(--accent-rose);
  color: #ffffff;
}

.btn-danger:hover {
  background-color: #be123c;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.825rem;
  min-height: 34px;
}

.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  min-height: 46px;
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-highlight);
  color: var(--primary);
}

.saved-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  font-size: 0.775rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  background-color: var(--accent-emerald-bg);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

/* ==========================================================================
   Módulo 1: Estructura e Índice por Capítulos
   ========================================================================== */

.modality-guidance-box {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  background: var(--accent-cyan-bg);
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
}

.guidance-icon {
  color: var(--accent-cyan);
  flex-shrink: 0;
  margin-top: 2px;
}

.guidance-title {
  font-size: 0.95rem;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.guidance-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.chapters-tree-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chapter-node-card {
  background-color: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  transition: all 0.2s ease;
}

.chapter-node-card:hover {
  border-color: var(--border-highlight);
  background-color: var(--bg-card-hover);
}

.chapter-node-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.chapter-title-wrap {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

.chapter-number {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary);
}

.chapter-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chapter-meta-badges {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.chapter-words-badge {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}

.chapter-actions {
  display: flex;
  gap: 0.25rem;
}

.btn-item-action {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-item-action:hover {
  color: var(--text-main);
  background: var(--bg-input);
  border-color: var(--border-color);
}

.btn-item-action.btn-delete:hover {
  color: var(--accent-rose);
  background: var(--accent-rose-bg);
}

.chapter-node-desc {
  font-size: 0.825rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-color);
  line-height: 1.45;
}

/* ==========================================================================
   Módulo 2: Cronograma Gantt y Planificación Inversa
   ========================================================================== */

.gantt-status-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background-color: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
}

.status-icon {
  color: var(--primary);
}

.status-title {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
}

.status-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.gantt-phases-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.gantt-phase-card {
  background-color: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  transition: all 0.2s ease;
}

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

.phase-title-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.phase-number-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  background-color: var(--primary-glow);
  color: var(--primary);
}

.phase-name {
  font-size: 0.975rem;
  font-weight: 600;
  color: var(--text-main);
}

.phase-dates-range {
  font-family: var(--font-mono);
  font-size: 0.825rem;
  color: var(--text-muted);
}

.phase-status-select {
  height: 32px;
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  cursor: pointer;
}

/* Barra visual Gantt */
.gantt-bar-track {
  height: 8px;
  background-color: var(--bg-input);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.gantt-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--accent-cyan));
  transition: width 0.3s ease;
}

.gantt-phase-tasks {
  font-size: 0.825rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* ==========================================================================
   Módulo 3: Extensión y Ritmo Diario
   ========================================================================== */

.words-calculator-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 900px) {
  .words-calculator-layout {
    grid-template-columns: 320px 1fr;
  }
}

.words-setup-box {
  background-color: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.box-subheading {
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.extension-inputs-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.pace-insight-card {
  background: var(--accent-purple-bg);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  gap: 0.75rem;
}

.pace-icon {
  color: var(--accent-purple);
  flex-shrink: 0;
}

.pace-kpi {
  display: block;
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.pace-explanation {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.chapters-word-tracker-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.word-tracker-row {
  background-color: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.word-tracker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.word-tracker-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
}

.word-tracker-inputs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.input-written-words {
  width: 90px;
  height: 32px;
  padding: 0.2rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  text-align: right;
}

.word-tracker-target {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
}

.word-progress-track {
  height: 6px;
  background-color: var(--bg-input);
  border-radius: 999px;
  overflow: hidden;
}

.word-progress-fill {
  height: 100%;
  border-radius: 999px;
  background-color: var(--accent-cyan);
  transition: width 0.25s ease;
}

/* ==========================================================================
   Módulo 4: Checklist de Calidad Académica
   ========================================================================== */

.checklist-progress-bar-wrap {
  background-color: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}

.checklist-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.checklist-progress-label {
  font-size: 0.9rem;
  color: var(--text-main);
}

.checklist-progress-percent {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1rem;
  color: var(--accent-emerald);
}

.progress-bar-track {
  height: 8px;
  background-color: var(--bg-input);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--accent-emerald));
  transition: width 0.3s ease;
}

.checklist-categories-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

@media (min-width: 768px) {
  .checklist-categories-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.checklist-category-card {
  background-color: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.category-card-title {
  font-size: 1rem;
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-main);
}

.checklist-items-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.checklist-item-label {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1.4;
  user-select: none;
}

.checklist-item-label input[type="checkbox"] {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  accent-color: var(--accent-emerald);
  cursor: pointer;
}

.checklist-item-label.checked {
  color: var(--text-dim);
  text-decoration: line-through;
}

/* ==========================================================================
   Módulo 5: Ensayo de Defensa Oral y Tribunal
   ========================================================================== */

.defense-simulator-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 900px) {
  .defense-simulator-grid {
    grid-template-columns: 340px 1fr;
  }
}

.defense-timer-card {
  background-color: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.25rem;
}

.timer-display-wrap {
  position: relative;
  width: 200px;
  height: 200px;
}

.timer-circle {
  position: relative;
  width: 100%;
  height: 100%;
}

.timer-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer-bg {
  fill: none;
  stroke: var(--bg-input);
  stroke-width: 8;
}

.timer-progress {
  fill: none;
  stroke: var(--primary);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 339.292;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.5s ease;
}

.timer-number-box {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.timer-time {
  font-family: var(--font-mono);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
}

.timer-phase-badge {
  font-size: 0.725rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-glow);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  margin-top: 0.4rem;
}

.timer-controls {
  display: flex;
  gap: 0.5rem;
  width: 100%;
}

.timer-controls button {
  flex: 1;
}

.timer-select-duration {
  width: 100%;
  text-align: left;
}

.defense-milestones-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  text-align: left;
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
}

.milestone-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.milestone-item.active {
  color: var(--primary);
  font-weight: 600;
}

.milestone-time {
  font-family: var(--font-mono);
}

.defense-guides-column {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.defense-guide-box {
  background-color: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.guide-heading {
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  color: var(--text-main);
}

.slides-guide-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.slides-guide-list strong {
  color: var(--text-main);
}

.faq-defense-accordion {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.defense-faq-item {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
}

.defense-faq-question {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-main);
  cursor: pointer;
}

.defense-faq-answer {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* ==========================================================================
   Guía Académica y SEO
   ========================================================================== */

.seo-academic-guide {
  margin-top: 1rem;
}

.guide-columns-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-top: 1rem;
}

@media (min-width: 768px) {
  .guide-columns-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.guide-col-title {
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
}

.guide-column p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 0.75rem;
}

/* ==========================================================================
   Modales interactivos
   ========================================================================== */

.custom-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.custom-modal-backdrop.open {
  display: flex;
  animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.custom-modal-box {
  background-color: var(--bg-card);
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}

.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;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0.2rem 0.5rem;
}

.btn-modal-close:hover {
  color: var(--text-main);
}

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

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

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

.export-option-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background-color: var(--bg-card-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}

.export-option-card:hover {
  border-color: var(--primary);
  background-color: var(--bg-card-hover);
  transform: translateY(-1px);
}

.export-card-icon {
  color: var(--primary);
  flex-shrink: 0;
}

.export-card-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.export-card-info strong {
  font-size: 0.95rem;
}

.export-card-info span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Toast / Notificación flotante
   ========================================================================== */

.toast-notification {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background-color: var(--bg-card);
  border: 1px solid var(--accent-emerald);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-main);
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast-notification.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.toast-icon {
  color: var(--accent-emerald);
}

/* ==========================================================================
   Estilos de Impresión / Exportación a PDF
   ========================================================================== */

@media print {
  .app-header,
  .fijate-footer,
  .tools-ad-banner-section,
  .tool-ad-sidebar,
  .tool-tabs,
  .project-actions-quick,
  .header-tools-group,
  .timer-controls,
  .toast-notification,
  .custom-modal-backdrop {
    display: none !important;
  }

  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 11pt;
  }

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

  .card-main {
    border: 1px solid #cccccc !important;
    box-shadow: none !important;
    background: #ffffff !important;
    break-inside: avoid;
    margin-bottom: 1.5cm;
  }

  .tab-pane {
    display: block !important;
    margin-bottom: 2cm;
  }

  .chapter-node-card,
  .gantt-phase-card,
  .checklist-category-card {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    color: #000000 !important;
  }
}
