/* Prematrícula IES Almunia 2026/27 - diseño v8 */
:root{
  --bg1:#0f766e;
  --bg2:#1d4ed8;
  --ink:#0f172a;
  --muted:#64748b;
  --card:#ffffff;
  --line:#dbe3ef;
  --soft:#eff6ff;
  --accent:#0f766e;
  --accent2:#1d4ed8;
  --danger:#dc2626;
  --ok:#16a34a;
}

*{box-sizing:border-box}

body{
  margin:0;
  font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;
  color:var(--ink);
  background:
    radial-gradient(circle at top left, rgba(20,184,166,.24), transparent 32rem),
    radial-gradient(circle at top right, rgba(59,130,246,.22), transparent 34rem),
    linear-gradient(135deg,#f8fafc 0%,#eef6ff 45%,#f4fbf8 100%);
  min-height:100vh;
}

.wrap{
  max-width:1180px;
  margin:auto;
  padding:28px;
}

.hero{
  position:relative;
  overflow:hidden;
  border-radius:28px;
  padding:34px;
  color:white;
  background:
    linear-gradient(135deg, rgba(15,118,110,.97), rgba(29,78,216,.94)),
    url("data:image/svg+xml,%3Csvg width='1200' height='600' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.16'%3E%3Ccircle cx='1020' cy='80' r='170'/%3E%3Ccircle cx='1080' cy='120' r='240'/%3E%3Cpath d='M0 420 C 220 330, 380 520, 610 410 S 940 260, 1200 360'/%3E%3Cpath d='M0 500 C 260 400, 400 610, 660 470 S 970 330, 1200 430'/%3E%3C/g%3E%3C/svg%3E");
  box-shadow:0 24px 60px rgba(15,23,42,.20);
}

.hero .kicker{
  display:inline-flex;
  gap:8px;
  align-items:center;
  background:rgba(255,255,255,.16);
  border:1px solid rgba(255,255,255,.28);
  padding:8px 12px;
  border-radius:999px;
  font-size:14px;
  font-weight:700;
  backdrop-filter:blur(8px);
}

.hero h1{
  font-size:clamp(32px,5vw,58px);
  line-height:1.02;
  margin:18px 0 8px;
  letter-spacing:-.04em;
}

.hero p{
  margin:0;
  font-size:18px;
  opacity:.92;
}

.card{
  background:rgba(255,255,255,.92);
  border:1px solid rgba(219,227,239,.9);
  border-radius:24px;
  padding:24px;
  margin:18px 0;
  box-shadow:0 16px 45px rgba(15,23,42,.09);
  backdrop-filter:blur(10px);
}

.card h1,.card h2,.card h3{letter-spacing:-.02em}
.card h1{margin-top:0}
.card h2{margin-top:4px}

.grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(245px,1fr));
  gap:16px;
}

.level{
  position:relative;
  display:block;
  min-height:118px;
  padding:20px;
  border-radius:22px;
  color:white;
  text-decoration:none;
  font-weight:900;
  font-size:18px;
  background:linear-gradient(135deg,var(--accent),var(--accent2));
  box-shadow:0 14px 32px rgba(29,78,216,.22);
  transition:.18s ease;
  overflow:hidden;
}

.level:before{
  content:"";
  position:absolute;
  right:-34px;
  top:-34px;
  width:105px;
  height:105px;
  border-radius:50%;
  background:rgba(255,255,255,.18);
}

.level:after{
  content:"Entrar →";
  position:absolute;
  left:20px;
  bottom:18px;
  font-size:13px;
  font-weight:800;
  opacity:.88;
}

.level:hover{
  transform:translateY(-3px);
  box-shadow:0 20px 42px rgba(15,23,42,.22);
}

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  background:linear-gradient(135deg,var(--accent),var(--accent2));
  color:white;
  text-decoration:none;
  border:0;
  border-radius:14px;
  padding:12px 16px;
  font-weight:800;
  cursor:pointer;
  box-shadow:0 10px 24px rgba(29,78,216,.16);
}

.btn:hover{filter:brightness(.98);transform:translateY(-1px)}
.danger{background:var(--danger)!important;color:white}
.ok{background:var(--ok)!important;color:white}
.muted{color:var(--muted)}
.small{font-size:12px}

label{
  display:block;
  margin:14px 0 6px;
  font-weight:800;
  color:#1e293b;
}

input,select,textarea{
  width:100%;
  border:1px solid #cbd5e1;
  border-radius:14px;
  padding:12px 13px;
  background:white;
  color:var(--ink);
  font:inherit;
  outline:none;
  transition:.15s ease;
}

input:focus,select:focus,textarea:focus{
  border-color:#38bdf8;
  box-shadow:0 0 0 4px rgba(56,189,248,.17);
}

textarea{min-height:92px;resize:vertical}

.block{
  border:1px solid #dbe3ef;
  border-radius:22px;
  padding:18px;
  margin-top:18px;
  background:linear-gradient(180deg,#fff,#f8fbff);
}

.block h3{margin:0 0 6px}

.fixed{
  background:#fff7ed;
  border:1px solid #fed7aa;
  border-left:6px solid #f97316;
  padding:13px;
  border-radius:16px;
  margin:12px 0;
}

.hint{
  background:#eff6ff;
  border:1px solid #bfdbfe;
  border-left:6px solid #3b82f6;
  padding:12px;
  border-radius:16px;
  color:#334155;
}

.footer{
  font-size:12px;
  color:#475569;
  text-align:center;
  margin:22px 0 12px;
  line-height:1.45;
}

.pill{
  display:inline-block;
  background:#e0f2fe;
  border-radius:999px;
  padding:5px 10px;
  margin:3px;
}

.success{
  text-align:center;
  padding:42px;
}

.success h1{
  color:#166534;
  font-size:clamp(28px,4vw,46px);
}

.adminbar{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-bottom:12px;
}

/* tablas */
.tablewrap{
  overflow:auto;
  max-height:72vh;
  border:1px solid var(--line);
  border-radius:18px;
  background:white;
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.65);
}

table{
  width:100%;
  border-collapse:collapse;
  background:white;
}

th,td{
  border:1px solid var(--line);
  padding:9px 10px;
  font-size:13px;
  vertical-align:top;
}

th{
  background:#e9eef7;
  cursor:pointer;
  font-weight:900;
}

.admin-table{
  min-width:1450px;
  width:max-content;
  border-collapse:separate;
  border-spacing:0;
}

.admin-table th,
.admin-table td{
  white-space:nowrap;
  font-size:12px;
  padding:8px 10px;
}

.admin-table th{
  position:sticky;
  top:0;
  z-index:3;
  background:#dbeafe;
  color:#0f172a;
}

.admin-table td{background:#fff}

.admin-table .sticky-col{
  position:sticky;
  left:0;
  z-index:2;
  background:#f8fafc;
  font-weight:800;
}

.admin-table th.sticky-col{
  z-index:4;
  background:#bfdbfe;
}

.admin-table .sticky-col-2{
  position:sticky;
  left:110px;
  z-index:2;
  background:#f8fafc;
  font-weight:800;
}

.admin-table th.sticky-col-2{
  z-index:4;
  background:#bfdbfe;
}

.pref-num{
  text-align:center;
  font-weight:900;
  color:#1d4ed8;
}

.empty-cell{
  color:#cbd5e1;
  text-align:center;
}

.admin-note{
  font-size:13px;
  color:#475569;
  margin:8px 0 14px;
}

.hidden{display:none!important}

@media (max-width:720px){
  .wrap{padding:16px}
  .hero{padding:24px;border-radius:22px}
  .card{padding:18px;border-radius:20px}
  .grid{grid-template-columns:1fr}
  .level{min-height:96px}
}

@media print{
  .no-print,.adminbar,.btn{display:none!important}
  body{background:white}
  .card,.hero{box-shadow:none;border:0;background:white;color:black}
  .wrap{max-width:none;padding:0}
  .tablewrap{overflow:visible;max-height:none}
  .admin-table{min-width:0;width:100%;font-size:9px}
  .admin-table th,.admin-table td{white-space:normal;font-size:8px;padding:4px}
  .sticky-col,.sticky-col-2{position:static!important}
}

/* V9: más columnas visibles con desplazamiento horizontal */
.admin-table{min-width:1800px}
.admin-table th{max-width:260px;white-space:normal;line-height:1.15}
.admin-table td{white-space:nowrap}
.pref-num .empty-cell{font-weight:400}

/* V15: validación por bloques independientes y listas sin numeración duplicada */
.pref-group{background:linear-gradient(180deg,#fff,#f8fbff)}
.pref-list{list-style:none;margin-left:0;padding-left:0}
.pref-item{margin:3px 0}

/* =====================================================
   SOLO PANEL ADMINISTRACIÓN
   ===================================================== */

/* Si existe tabla admin, aprovechar casi toda la pantalla */
.wrap:has(.admin-table){
    max-width:98vw !important;
}

/* Tabla admin más compacta */
.admin-table{
    min-width:1200px !important;
    width:max-content !important;
}

.admin-table th,
.admin-table td{
    font-size:11px !important;
    padding:5px 6px !important;
}

.admin-table th{
    max-width:170px !important;
    white-space:normal !important;
}

.admin-table td{
    white-space:nowrap !important;
}

.admin-table .sticky-col-2{
    left:95px !important;
}

/* Centrar botón de envío de la prematrícula */
form button.btn[type="submit"]{
    display:flex;
    margin:25px auto 0 auto;
    min-width:220px;
}

.btn-admin-login{
    margin-top:20px;
}
