/* PlanificaDocente v2 — Estilos principales */
:root {
  --blue:       #1e40af;
  --blue-light: #3b82f6;
  --blue-pale:  #dbeafe;
  --green:      #16a34a;
  --green-pale: #dcfce7;
  --red:        #dc2626;
  --red-pale:   #fee2e2;
  --yellow:     #ca8a04;
  --yellow-pale:#fef9c3;
  --gray-50:    #f8fafc;
  --gray-100:   #f1f5f9;
  --gray-200:   #e2e8f0;
  --gray-400:   #94a3b8;
  --gray-600:   #475569;
  --gray-800:   #1e293b;
  --radius:     10px;
  --shadow:     0 2px 12px rgba(0,0,0,.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { font-family: system-ui, -apple-system, 'Segoe UI', sans-serif; background: #f0f4ff; color: var(--gray-800); min-height: 100vh; }

/* ── LAYOUT ── */
.layout { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.sidebar { background: var(--blue); color: #fff; display: flex; flex-direction: column; padding: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar-logo { padding: 24px 20px 16px; border-bottom: 1px solid rgba(255,255,255,.15); }
.sidebar-logo h1 { font-size: 1.15rem; font-weight: 800; }
.sidebar-logo p  { font-size: .72rem; opacity: .7; margin-top: 2px; }
.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-section { font-size: .68rem; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: rgba(255,255,255,.45); padding: 16px 20px 6px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 9px 20px; color: rgba(255,255,255,.85); text-decoration: none; font-size: .875rem; transition: background .15s; }
.nav-link:hover, .nav-link.active { background: rgba(255,255,255,.12); color: #fff; }
.nav-link .icon { width: 18px; text-align: center; }
.sidebar-user { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.15); font-size: .8rem; }
.sidebar-user .name  { font-weight: 600; }
.sidebar-user .email { opacity: .65; font-size: .72rem; }
.sidebar-user a { color: rgba(255,255,255,.65); text-decoration: none; font-size: .75rem; }
.sidebar-user a:hover { color: #fff; }

.main { display: flex; flex-direction: column; }
.topbar { background: #fff; border-bottom: 1px solid var(--gray-200); padding: 0 28px; height: 56px; display: flex; align-items: center; gap: 16px; position: sticky; top: 0; z-index: 10; }
.topbar-title { font-weight: 700; font-size: 1rem; color: var(--gray-800); flex: 1; }
.topbar-actions { display: flex; gap: 8px; }
.content { padding: 28px; flex: 1; }

/* ── CARDS ── */
.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; border: 1px solid var(--gray-200); }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--gray-200); display: flex; align-items: center; justify-content: space-between; }
.card-title  { font-weight: 700; font-size: .95rem; }
.card-body   { padding: 20px; }

/* ── BOTONES ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 18px; border-radius: 8px; border: none; font-size: .875rem; font-weight: 600; cursor: pointer; text-decoration: none; transition: all .15s; white-space: nowrap; }
.btn-primary  { background: var(--blue); color: #fff; }
.btn-primary:hover { background: #1d3899; }
.btn-success  { background: var(--green); color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-danger   { background: var(--red); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-outline  { background: transparent; color: var(--gray-600); border: 1.5px solid var(--gray-200); }
.btn-outline:hover { border-color: var(--blue-light); color: var(--blue); }
.btn-sm { padding: 5px 12px; font-size: .8rem; }
.btn-lg { padding: 12px 28px; font-size: 1rem; }

/* ── FORMULARIOS ── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: .83rem; font-weight: 600; color: var(--gray-600); margin-bottom: 5px; }
.form-control { width: 100%; padding: 9px 12px; border: 2px solid var(--gray-200); border-radius: 8px; font-size: .9rem; font-family: inherit; color: var(--gray-800); background: #fff; transition: border-color .2s; }
.form-control:focus { outline: none; border-color: var(--blue-light); }
.form-control:disabled { background: var(--gray-50); cursor: not-allowed; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-hint { font-size: .76rem; color: var(--gray-400); margin-top: 4px; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ── TABLAS ── */
.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table th { background: var(--gray-50); padding: 10px 14px; text-align: left; font-weight: 600; font-size: .8rem; color: var(--gray-600); border-bottom: 2px solid var(--gray-200); }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--gray-200); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--gray-50); }
.table-actions { display: flex; gap: 6px; }

/* ── BADGES ── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px; font-size: .75rem; font-weight: 600; }
.badge-mensual { background: var(--blue-pale); color: var(--blue); }
.badge-clase   { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.badge-admin   { background: #fef3c7; color: #92400e; }
.badge-super   { background: #fce7f3; color: #9d174d; }

/* ── FLASH MESSAGES ── */
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: .875rem; font-weight: 500; }
.flash-success { background: var(--green-pale); border-left: 4px solid var(--green); color: #14532d; }
.flash-error   { background: var(--red-pale);   border-left: 4px solid var(--red);   color: #7f1d1d; }
.flash-warning { background: var(--yellow-pale); border-left: 4px solid var(--yellow);color: #78350f; }
.flash-info    { background: var(--blue-pale);   border-left: 4px solid var(--blue);  color: #1e3a8a; }

/* ── LOGIN ── */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-card { background: #fff; border-radius: 16px; box-shadow: 0 8px 32px rgba(0,0,0,.12); width: 100%; max-width: 420px; padding: 40px; }
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo .icon { font-size: 3rem; margin-bottom: 8px; }
.login-logo h1   { font-size: 1.5rem; font-weight: 800; color: var(--blue); }
.login-logo p    { color: var(--gray-400); font-size: .875rem; margin-top: 4px; }
.login-error { background: var(--red-pale); border-left: 4px solid var(--red); color: #7f1d1d; padding: 10px 14px; border-radius: 6px; margin-bottom: 20px; font-size: .875rem; }

/* ── PAGE HEADER ── */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; gap: 16px; }
.page-header h1 { font-size: 1.35rem; font-weight: 800; }
.page-header p  { color: var(--gray-400); font-size: .875rem; margin-top: 4px; }
.page-actions   { display: flex; gap: 8px; flex-shrink: 0; }

/* ── STATS ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card  { background: #fff; border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); border: 1px solid var(--gray-200); }
.stat-num   { font-size: 2rem; font-weight: 800; color: var(--blue); }
.stat-label { font-size: .8rem; color: var(--gray-400); margin-top: 2px; }

/* ── CRONOGRAMA MENSUAL ── */
.crono-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.crono-table th { background: var(--blue); color: #fff; padding: 8px 6px; font-size: .75rem; font-weight: 600; }
.crono-table td { border: 1px solid var(--gray-200); padding: 5px 6px; vertical-align: top; }
.crono-table input, .crono-table select, .crono-table textarea { width: 100%; border: none; background: transparent; font-size: .82rem; font-family: inherit; resize: none; }
.crono-table input:focus, .crono-table textarea:focus { outline: 1px solid var(--blue-light); border-radius: 3px; }
.crono-table tr:nth-child(even) td { background: var(--gray-50); }

/* ── CLASE A CLASE (3 MOMENTOS) ── */
.clase-card { border: 2px solid var(--gray-200); border-radius: var(--radius); margin-bottom: 20px; overflow: hidden; }
.clase-header { background: var(--blue); color: #fff; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; }
.clase-header h3 { font-size: .95rem; font-weight: 700; }
.momento { border-top: 1px solid var(--gray-200); }
.momento-header { padding: 10px 16px; font-weight: 700; font-size: .82rem; display: flex; align-items: center; gap: 8px; }
.momento-inicio   .momento-header { background: #ecfdf5; color: #065f46; }
.momento-desarrollo .momento-header { background: #eff6ff; color: #1e3a8a; }
.momento-cierre   .momento-header { background: #fdf4ff; color: #6b21a8; }
.momento-body { padding: 12px 16px; }
.momento-body .form-row { grid-template-columns: 80px 1fr; }

/* ── TIPO SELECTOR ── */
.tipo-selector { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.tipo-option { border: 2px solid var(--gray-200); border-radius: var(--radius); padding: 20px; cursor: pointer; text-align: center; transition: all .2s; }
.tipo-option:hover { border-color: var(--blue-light); background: var(--blue-pale); }
.tipo-option.selected { border-color: var(--blue); background: var(--blue-pale); }
.tipo-option .tipo-icon { font-size: 2rem; margin-bottom: 8px; }
.tipo-option h3 { font-size: .95rem; font-weight: 700; color: var(--gray-800); }
.tipo-option p  { font-size: .78rem; color: var(--gray-400); margin-top: 4px; }

/* ── UTILITIES ── */
.text-muted { color: var(--gray-400); }
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.d-flex { display: flex; }
.gap-2  { gap: 8px; }
.ms-auto { margin-left: auto; }
.w-100 { width: 100%; }
.fw-bold { font-weight: 700; }

/* ── PRINT ── */
@media print {
  .sidebar, .topbar, .btn, .flash, .page-actions, .print-hidden { display: none !important; }
  .layout { display: block; }
  .content { padding: 0; }
  body { background: #fff; }
}

/* ── TIPO SELECTOR (nueva planificación) ── */
.tipo-selector {
  display: flex; gap: 16px;
}
.tipo-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 4px;
  padding: 20px 16px; border-radius: var(--radius);
  border: 2px solid var(--gray-200); background: #fff;
  color: var(--gray-800); text-decoration: none;
  font-weight: 600; font-size: .95rem; transition: all .15s;
}
.tipo-btn small { font-weight: 400; font-size: .78rem; color: var(--gray-400); }
.tipo-btn:hover { border-color: var(--blue-light); background: #eff6ff; }
.tipo-btn-active { border-color: var(--blue); background: var(--blue); color: #fff; }
.tipo-btn-active small { color: rgba(255,255,255,.75); }

/* ── CLASE A CLASE ── */
.clase-card {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow);
}
.clase-header {
  background: var(--blue); color: #fff;
  padding: 10px 16px;
  display: flex; justify-content: space-between; align-items: center;
}
.clase-header h3 { font-size: .95rem; font-weight: 700; }

.momento { border-top: 1px solid var(--gray-200); }
.momento-header {
  padding: 8px 16px; font-size: .85rem; font-weight: 700;
  display: flex; align-items: center; gap: 8px;
}
.momento-inicio .momento-header   { background: #f0fdf4; color: #166534; }
.momento-desarrollo .momento-header{ background: #eff6ff; color: #1e40af; }
.momento-cierre .momento-header   { background: #faf5ff; color: #6b21a8; }
.momento-body { padding: 12px 16px 14px; }

/* ── CRONOGRAMA TABLE ── */
.crono-table { width: 100%; border-collapse: collapse; }
.crono-table th {
  background: var(--blue); color: #fff;
  padding: 8px 8px; font-size: .78rem; text-align: left;
  border: 1px solid #1e3a8a; white-space: nowrap;
}
.crono-table td {
  border: 1px solid var(--gray-200);
  padding: 4px 6px; vertical-align: top;
}
.crono-table td input,
.crono-table td textarea,
.crono-table td select {
  width: 100%; padding: 4px 6px; font-size: .8rem;
  border: 1px solid var(--gray-200); border-radius: 4px;
  background: #fff; resize: vertical;
}
.crono-table tr:nth-child(even) td { background: var(--gray-50); }

/* ── BADGES ── */
.badge {
  display: inline-block; padding: 2px 10px;
  border-radius: 999px; font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .3px;
}
.badge-mensual, .badge-info   { background: #dbeafe; color: #1e40af; }
.badge-clase                  { background: #f3e8ff; color: #6b21a8; }
.badge-success                { background: var(--green-pale); color: var(--green); }
.badge-danger                 { background: var(--red-pale); color: var(--red); }
.badge-warning                { background: var(--yellow-pale); color: var(--yellow); }

/* ── FORM HELPERS ── */
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; }
.form-group.mb-0 { margin-bottom: 0; }
.form-label { font-size: .82rem; font-weight: 600; color: var(--gray-600); }
.form-control {
  padding: 8px 12px; border: 1px solid var(--gray-200);
  border-radius: 7px; font-size: .9rem; background: #fff;
  transition: border-color .15s; width: 100%;
}
.form-control:focus { outline: none; border-color: var(--blue-light); box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
.form-hint { font-size: .78rem; color: var(--gray-400); margin-top: 4px; }
textarea.form-control { resize: vertical; min-height: 60px; }
select.form-control { appearance: auto; }

/* ── FLASH ── */
.flash { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: .9rem; }
.flash-success { background: var(--green-pale); color: #166534; border: 1px solid #bbf7d0; }
.flash-error   { background: var(--red-pale); color: #991b1b; border: 1px solid #fecaca; }
.flash-warning { background: var(--yellow-pale); color: #92400e; border: 1px solid #fef08a; }
.flash-info    { background: var(--blue-pale); color: #1e40af; border: 1px solid #bfdbfe; }

/* ── TABLE WRAP ── */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table th { background: var(--gray-50); border-bottom: 2px solid var(--gray-200); padding: 10px 12px; text-align: left; font-size: .78rem; text-transform: uppercase; color: var(--gray-600); letter-spacing: .3px; }
.table td { border-bottom: 1px solid var(--gray-200); padding: 10px 12px; vertical-align: middle; }
.table tr:hover td { background: var(--gray-50); }

/* ── BUTTONS ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 18px; border-radius: 8px; font-size: .875rem; font-weight: 600; cursor: pointer; border: none; text-decoration: none; transition: all .15s; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: #1d3fad; }
.btn-outline { background: #fff; color: var(--gray-800); border: 1.5px solid var(--gray-200); }
.btn-outline:hover { border-color: var(--blue-light); color: var(--blue); }
.btn-danger  { background: var(--red); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 5px 12px; font-size: .8rem; }

/* ── PAGE HEADER ── */
.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-header h1 { font-size: 1.35rem; font-weight: 800; color: var(--gray-800); }
.page-header p  { font-size: .875rem; color: var(--gray-400); margin-top: 3px; }
.page-actions   { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── CARD ── */
.card { background: #fff; border-radius: var(--radius); border: 1px solid var(--gray-200); box-shadow: var(--shadow); }
.card-header { padding: 14px 20px; border-bottom: 1px solid var(--gray-200); display: flex; align-items: center; justify-content: space-between; }
.card-title  { font-weight: 700; font-size: .9rem; }
.card-body   { padding: 20px; }

/* ── SIDEBAR NAV ── */
.nav-link { display: flex; align-items: center; gap: 10px; padding: 10px 20px; color: rgba(255,255,255,.75); text-decoration: none; font-size: .875rem; transition: all .15s; border-left: 3px solid transparent; }
.nav-link:hover, .nav-link.active { color: #fff; background: rgba(255,255,255,.12); border-left-color: rgba(255,255,255,.6); }
.nav-section { padding: 16px 20px 4px; font-size: .68rem; text-transform: uppercase; letter-spacing: .7px; color: rgba(255,255,255,.4); }

/* ── PRINT ── */
@media print {
  .sidebar, .topbar, .page-actions, .btn, .flash { display: none !important; }
  .layout { grid-template-columns: 1fr; }
  .main-content { padding: 0; }
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .tipo-selector { flex-direction: column; }
}
