@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --azul: #1a3a5c;
  --verde: #7ab648;
  --naranja: #e67e22;
  --celeste: #4db6e4;
  --gris-text: #5a5a5a;
  --gris-bg: #f5f6f8;
  --gris-borde: #e0e3e8;
  --blanco: #ffffff;
  --sombra: 0 2px 12px rgba(0, 0, 0, 0.08);
}

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

.hidden {
  display: none;
}

html, body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  font-family: 'Inter', Arial, sans-serif;
  background: var(--gris-bg);
  color: var(--gris-text);
  font-size: 14px;
}

/* ── HEADER ─────────────────────────────── */
header {
  background: var(--azul);
  padding: 0 28px;
  height: 64px;
  display: flex;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  gap: 16px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.header-logo img {
  height: 40px;
  width: auto;
  flex-shrink: 0;
}

.header-logo h1 {
  font-size: 1rem;
  font-weight: 500;
  color: white;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

header button {
  background: var(--verde);
  color: white;
  border: none;
  padding: 8px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.03em;
  transition: background 0.2s, transform 0.1s;
  white-space: nowrap;
}

header button:hover {
  background: #68a03a;
  transform: translateY(-1px);
}

.btn-vacaciones {
  background: #8e5fb0 !important;
}

.btn-vacaciones:hover {
  background: #7a4d9b !important;
}

.btn-logout,
.btn-admin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  flex-shrink: 0;
  transition: background 0.2s;
}

.btn-logout:hover,
.btn-admin:hover {
  background: rgba(255, 255, 255, 0.25);
}

.btn-volver-calendario {
  color: white;
  text-decoration: none;
  font-size: 0.86rem;
  opacity: 0.85;
  padding: 6px 4px;
}

.btn-volver-calendario:hover {
  opacity: 1;
  text-decoration: underline;
}

/* ── ADMINISTRACIÓN ──────────────────────── */
#admin-content {
  max-width: 960px;
  margin: 24px auto;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.admin-panel {
  background: var(--blanco);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--sombra);
  border: 1px solid var(--gris-borde);
}

.admin-panel h2 {
  color: var(--azul);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.admin-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.admin-form input {
  flex: 1;
  min-width: 160px;
  padding: 9px 11px;
  border: 1px solid var(--gris-borde);
  border-radius: 7px;
  font-size: 0.9rem;
  font-family: 'Inter', sans-serif;
  background: var(--gris-bg);
}

.admin-form input:focus {
  outline: none;
  border-color: var(--celeste);
  box-shadow: 0 0 0 3px rgba(77, 182, 228, 0.15);
  background: var(--blanco);
}

.admin-form button {
  background: var(--azul);
  color: white;
  border: none;
  padding: 9px 18px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
}

.admin-form button:hover {
  opacity: 0.9;
}

.admin-tabla {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.admin-tabla th {
  text-align: left;
  padding: 8px 10px;
  color: #888;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 2px solid var(--gris-borde);
}

.admin-tabla td {
  padding: 10px;
  border-bottom: 1px solid var(--gris-borde);
}

.btn-eliminar-fila {
  background: none;
  border: 1px solid #e05252;
  color: #e05252;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.78rem;
  font-family: 'Inter', sans-serif;
}

.btn-eliminar-fila:hover {
  background: #e05252;
  color: white;
}

/* ── LEYENDA ─────────────────────────────── */
#leyenda {
  padding: 8px 28px;
  background: var(--blanco);
  border-bottom: 1px solid var(--gris-borde);
  font-size: 0.78rem;
  color: #888;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 4px;
  margin-left: 14px;
  vertical-align: middle;
}

.dot:first-child {
  margin-left: 0;
}

.dot.planificada { background: #4db6e4; }
.dot.confirmada  { background: #1a3a5c; }
.dot.realizada   { background: #7ab648; }
.dot.cancelada   { background: #e05252; }
.dot.consolidada { background: #e67e22; }
.dot.vacacion     { background: #8e5fb0; }

.dot.feriado {
  background: #f0ede6;
  border: 1px solid #c8b89a;
}

#leyenda-residencias {
  padding: 6px 28px;
  background: var(--blanco);
  border-bottom: 1px solid var(--gris-borde);
  font-size: 0.78rem;
  color: #333;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

#leyenda-residencias:empty {
  display: none;
}

/* ── CALENDARIO ──────────────────────────── */
#calendar {
  margin: 20px 24px;
  background: var(--blanco);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--sombra);
  border: 1px solid var(--gris-borde);
}

.fc-daygrid-day-frame {
  min-height: 130px;
}

.fc-daygrid-event {
  font-size: 0.74rem !important;
  padding: 2px 4px !important;
  border-radius: 4px !important;
}

.fc-daygrid-more-link {
  font-size: 0.72rem;
  font-weight: 600;
}

.fc-event.evento-realizada {
  opacity: 0.5;
}

/* ── MODAL BASE ──────────────────────────── */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(20, 40, 70, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  overflow-y: auto;
  padding: 20px 0;
  backdrop-filter: blur(2px);
}

.modal.hidden {
  display: none;
}

.modal-box {
  background: var(--blanco);
  border-radius: 14px;
  padding: 32px;
  width: 580px;
  max-width: 95vw;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  border: 1px solid var(--gris-borde);
  animation: fadeUp 0.2s ease;
}

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

.modal-box h2 {
  margin-bottom: 20px;
  color: var(--azul);
  font-size: 1.1rem;
  font-weight: 600;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--verde);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── FORMULARIO ──────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.full-width {
  grid-column: span 2;
}

.form-grid label {
  display: block;
  margin-bottom: 5px;
  font-size: 0.76rem;
  color: #888;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-grid input,
.form-grid select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--gris-borde);
  border-radius: 7px;
  font-size: 0.9rem;
  font-family: 'Inter', sans-serif;
  color: var(--gris-text);
  background: var(--gris-bg);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-grid input:focus,
.form-grid select:focus {
  outline: none;
  border-color: var(--celeste);
  box-shadow: 0 0 0 3px rgba(77, 182, 228, 0.15);
  background: var(--blanco);
}

/* ── BOTONES MODAL ───────────────────────── */
.modal-btns {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}

.modal-btns button {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  font-size: 0.88rem;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  transition: opacity 0.15s, transform 0.1s;
}

.modal-btns button:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

#btn-guardar {
  background: var(--azul);
  color: white;
}

#btn-ir-editar {
  background: var(--celeste);
  color: white;
}

.btn-cancelar {
  background: var(--gris-bg);
  color: #666;
  border: 1px solid var(--gris-borde) !important;
}

.btn-eliminar {
  background: #e05252;
  color: white;
}

.btn-eliminar.hidden {
  display: none;
}

/* ── ESTADO RÁPIDO ───────────────────────── */
.estado-rapido {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  background: var(--gris-bg);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border: 1px solid var(--gris-borde);
}

.estado-rapido span {
  font-size: 0.76rem;
  font-weight: 700;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 4px;
}

.btn-estado {
  color: white;
  border: none;
  padding: 5px 12px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.78rem;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  opacity: 0.6;
  transition: opacity 0.15s, transform 0.1s;
}

.btn-estado:hover,
.btn-estado.activo {
  opacity: 1;
  transform: scale(1.05);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* ── ALERTAS ─────────────────────────────── */
.alerta {
  padding: 10px 14px;
  border-radius: 7px;
  margin-bottom: 12px;
  font-size: 0.84rem;
  background: #fff8e1;
  border-left: 3px solid #ffc107;
  color: #7a5f00;
}

.alerta.hidden {
  display: none;
}

.alerta.alerta-error {
  background: #fdecea;
  border-left: 3px solid #e05252;
  color: #b71c1c;
}

.alerta-info {
  background: #e3f2fd;
  border-left: 4px solid #1a3a5c;
  color: #1a3a5c;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.82rem;
  margin-top: 6px;
}

.alerta-warning {
  background: #fff8e1;
  border-left: 4px solid #f59e0b;
  color: #92400e;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.82rem;
  margin-top: 6px;
}

/* ── MODAL VISTA ─────────────────────────── */
.vista-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.vista-fila {
  display: flex;
  gap: 12px;
  padding: 8px 12px;
  background: var(--gris-bg);
  border-radius: 7px;
  align-items: flex-start;
  border: 1px solid var(--gris-borde);
  transition: background 0.15s;
}

.vista-fila:hover {
  background: #eef6fb;
}

.vista-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  min-width: 130px;
  padding-top: 1px;
}

.vista-valor {
  font-size: 0.9rem;
  color: #2c2c2c;
  font-weight: 400;
}

.checkbox-avion {
  margin-top: 10px;
  padding: 8px 12px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e0e3e8;
}

.checkbox-avion label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 500;
}

.checkbox-avion input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* ── HEADER: FILTROS/EXPORTAR ────────────── */
.header-acciones {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.exportar-grupo {
  display: flex;
  align-items: center;
  gap: 6px;
}

.exportar-grupo select {
  padding: 7px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.12);
  color: white;
  font-size: 0.82rem;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  max-width: 150px;
}

.exportar-grupo select option {
  background: #1a3a5c;
  color: white;
}

.btn-exportar {
  background: rgba(255, 255, 255, 0.15) !important;
  border: 1px solid rgba(255, 255, 255, 0.4) !important;
  color: white !important;
  font-size: 0.82rem !important;
  padding: 7px 14px !important;
}

.btn-exportar:hover {
  background: rgba(255, 255, 255, 0.25) !important;
}

/* ── LOGIN ───────────────────────────────── */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--azul) 0%, #0d2038 100%);
  padding: 20px;
}

.login-card {
  background: var(--blanco);
  border-radius: 16px;
  padding: 40px 36px;
  width: 380px;
  max-width: 100%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  text-align: center;
}

.login-logo {
  height: 44px;
  margin-bottom: 18px;
}

.login-card h1 {
  font-size: 1.15rem;
  color: var(--azul);
  font-weight: 700;
  margin-bottom: 10px;
}

.login-sub {
  font-size: 0.86rem;
  color: #777;
  margin-bottom: 20px;
  line-height: 1.4;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-form input {
  padding: 12px 14px;
  border: 1px solid var(--gris-borde);
  border-radius: 8px;
  font-size: 1rem;
  font-family: 'Inter', sans-serif;
  text-align: center;
  background: var(--gris-bg);
}

.login-form input:focus {
  outline: none;
  border-color: var(--celeste);
  box-shadow: 0 0 0 3px rgba(77, 182, 228, 0.15);
  background: var(--blanco);
}

.login-form button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background: var(--azul);
  color: white;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-icon {
  flex-shrink: 0;
}

.login-form button:hover {
  opacity: 0.9;
}

.login-volver {
  display: inline-block;
  margin-top: 16px;
  font-size: 0.8rem;
  color: var(--celeste);
  text-decoration: none;
}

.login-volver:hover {
  text-decoration: underline;
}

/* ══════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════ */
@media (max-width: 768px) {
  header {
    height: auto;
    padding: 12px 16px;
  }

  .header-content {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .header-logo {
    justify-content: space-between;
  }

  .header-logo img {
    height: 32px;
  }

  .header-logo h1 {
    font-size: 0.86rem;
  }

  .header-acciones {
    justify-content: stretch;
  }

  .header-acciones > button {
    flex: 1;
  }

  .exportar-grupo {
    flex-wrap: wrap;
    width: 100%;
  }

  .exportar-grupo select {
    flex: 1;
    min-width: 0;
    max-width: none;
  }

  .btn-exportar {
    flex: 1 1 100%;
  }

  #leyenda {
    padding: 8px 16px;
    font-size: 0.72rem;
    justify-content: center;
  }

  #leyenda-residencias {
    padding: 6px 16px;
    justify-content: center;
    text-align: center;
  }

  #calendar {
    margin: 12px 8px;
    padding: 10px;
    border-radius: 10px;
  }

  /* FullCalendar: header del calendario se apila */
  .fc-header-toolbar {
    flex-direction: column;
    gap: 10px;
    align-items: stretch !important;
  }

  .fc-toolbar-chunk {
    display: flex;
    justify-content: center;
  }

  .fc-toolbar-title {
    font-size: 1.05rem !important;
    text-align: center;
  }

  .fc-button {
    padding: 6px 10px !important;
    font-size: 0.8rem !important;
  }

  .modal-box {
    width: 100%;
    max-width: 100%;
    padding: 20px;
    border-radius: 12px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .full-width {
    grid-column: span 1;
  }

  .modal-btns {
    flex-direction: column;
  }

  .estado-rapido {
    justify-content: center;
  }

  .vista-fila {
    flex-direction: column;
    gap: 2px;
  }

  .vista-label {
    min-width: 0;
  }

  .login-card {
    padding: 32px 24px;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 13px;
  }

  .header-logo h1 {
    display: none;
  }
}
