:root {
  --bg1: #002b5c;     /* azul marino oscuro */
  --bg2: #0a4b80;     /* azul medio */
  --card-bg: rgba(12, 140, 230, 0.1); /* fondo cards azul claro translúcido */
  --text-light: #cfdfff; /* texto claro */
  --text-muted: #a0b9d8; /* texto opaco para detalles */
  --btn-bg: #0c8ce6;
  --btn-bg-hover: #066abf;
  --btn-danger-bg: #e02c2c;
  --btn-danger-hover: #b22222;
  --border-light: rgba(255 255 255 / 0.15);
  --input-bg: transparent;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0 !important;
  padding: 0 !important;
  min-height: 100vh !important;
  width: 100vw !important;
  font-family: Inter, system-ui, 'Segoe UI', Arial, sans-serif;
  background: linear-gradient(180deg, var(--bg1), var(--bg2)) !important;
  color: var(--text-light);
  overflow-x: hidden !important;
}

/* --- Estilos para Notificaciones (Toasts) --- */
#notification-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1050; /* Asegurar que esté por encima de otros elementos como los modales */
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(320px, 90%);
}

.toast {
  background: #004080; /* Color sólido, no transparente */
  color: var(--text-light);
  padding: 16px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border-left: 5px solid var(--btn-bg); /* Borde por defecto (info) */
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.4s ease-in-out;
  font-size: 15px;
  font-weight: 500;
  user-select: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

.toast.success {
  border-left-color: #4caf50; /* Verde para éxito */
}

.toast.error {
  border-left-color: var(--btn-danger-bg); /* Rojo para error */
}

/* --- Login / General --- */

.card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 22px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  color: var(--text-light);
}

.login-card {
  width: min(520px, 94%);
  margin: 6vh auto;
  display: block;
  text-align: center;
}

.logo img {
  height: 78px;
  object-fit: contain;
  margin-bottom: 10px;
}

h1 {
  margin: 6px 0 8px;
  font-size: 20px;
  color: var(--text-light);
}

.lead {
  opacity: 0.95;
  margin: 0 0 14px;
  color: var(--text-light);
}

.form {
  display: grid;
  gap: 12px;
}

input[type=email],
input[type=password],
select,
textarea {
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  background: var(--input-bg);
  color: var(--text-light);
}

select {
  color: #222 !important; /* texto oscuro para el select */
  background-color: white; /* fondo blanco para select */
}

option {
    color: black;
}

.btn {
  padding: 8px 12px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.btn.primary {
  background: var(--btn-bg);
  font-weight: 600;
}

.btn.primary:hover {
  background: var(--btn-bg-hover);
}

.footer {
  background-color: #003366; /* mismo azul oscuro */
  color: white;
  text-align: center;
  padding: 1em 0;
  font-size: 0.8em;
}

.muted {
  font-size: 12px;
  opacity: 0.6;
  color: var(--text-muted);
}

.note {
  font-size: 12px;
  opacity: 0.7;
  margin-top: 12px;
  color: var(--text-muted);
}

/* --- Clientes --- */

/* Barra de búsqueda */
#searchCliente {
  width: 100%;
  max-width: 420px;
  padding: 12px 16px;
  font-size: 16px;
  border-radius: 10px;
  border: 1px solid rgba(255 255 255 / 0.2);
  background: transparent;
  color: var(--text-light);
  margin-bottom: 18px;
  box-shadow: inset 0 2px 5px rgba(0 0 0 / 0.2);
  transition: border-color 0.25s ease;
}

#searchCliente:focus {
  outline: none;
  border-color: var(--btn-bg);
  box-shadow: 0 0 8px var(--btn-bg-hover);
}

#clientesList {
  /* Estilos para el layout horizontal desplazable */
  display: flex;
  flex-direction: row;
  overflow-x: auto;
  padding-bottom: 20px;
  cursor: grab; /* Indica que se puede arrastrar */
  user-select: none; /* Evita la selección de texto al arrastrar */
  align-items: flex-start; /* Evita que las tarjetas se estiren a la misma altura */
  margin-top: 12px;
}

.cliente-card {
  flex: 0 0 320px; /* No crece, no se encoge, base de 320px */
  margin-right: 15px;
  background: var(--card-bg);
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: background-color 0.25s ease, box-shadow 0.3s ease;
  cursor: default;
  color: var(--text-light);
  outline: none;
}

.cliente-card:focus,
.cliente-card:hover {
  background: rgba(12, 140, 230, 0.25);
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.45);
}

.cliente-card strong {
  font-size: 18px;
  color: #d7e9ff;
  margin-bottom: 6px;
  user-select: text;
}

.cliente-card p {
  font-size: 14px;
  opacity: 0.8;
  line-height: 1.3;
  margin: 0 0 12px 0;
  user-select: text;
  color: var(--text-light);
}

.cliente-card .botones-cliente {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.cliente-card .editar-cliente-btn {
  align-self: flex-start;
  margin-right: 8px;
}

.editar-cliente-btn {
  width: 100% !important;
  background-color: #55aacc !important;
  color: white !important;
  border: none;
  padding: 10px 16px !important;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
  margin-top: 10px;
  margin-bottom: 5px;
  text-align: center;
  font-size: 14px;
  display: block;
}

.editar-cliente-btn:hover {
  background-color: #4a96b8 !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.editar-cliente-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.eliminar-cliente-btn {
  margin-top: 8px;
  background-color: var(--btn-danger-bg);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: background-color 0.3s ease;
  pointer-events: auto !important;
  position: relative;
  z-index: 10;
}

.eliminar-cliente-btn:hover {
  background-color: var(--btn-danger-hover);
}

/* --- Spots --- */

.spots-list {
  list-style: none;
  padding-left: 0;
  margin-top: 6px;
  color: var(--text-light);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.spots-list li {
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 6px;
}

.spots-list small {
  display: block;
  margin-bottom: 2px;
}

.spots-list button {
  margin-right: 6px;
  margin-top: 2px;
  padding: 4px 8px;
  font-size: 0.85rem;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  background-color: var(--btn-bg);
  color: white;
  transition: background-color 0.3s ease;
}

.spots-list button:hover {
  background-color: #0667c9;
}

.spots-list button.eliminar-spot-btn {
  background-color: var(--btn-danger-bg);
}

.spots-list button.eliminar-spot-btn:hover {
  background-color: var(--btn-danger-hover);
}

.spot-item {
  background: rgba(12, 140, 230, 0.1);
  border-radius: 8px;
  padding: 8px 10px;
  color: #e0eaff;
  user-select: text;
  display: flex;
  flex-direction: column;
  margin-bottom: 0.5em;
}

.spot-item strong {
  font-size: 1rem;
  color: #aaddff;
}

.spot-vigente {
  color: #28a745 !important; /* Verde */
  font-weight: 600;
  opacity: 1 !important;
  transition: opacity 0.3s ease;
}

.spot-no-vigente {
  color: #999999 !important; /* Gris opaco */
  opacity: 0.5 !important;
  font-style: italic;
  transition: opacity 0.3s ease;
}

.spot-vigente strong,
.spot-no-vigente strong {
  color: inherit !important;
  opacity: inherit !important;
  font-weight: 600;
  font-style: inherit;
}

.asignar-spot-btn {
  align-self: flex-start;
  background-color: var(--btn-bg);
  color: white;
  padding: 8px 14px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.25s ease;
  margin-top: 10px;
}

.asignar-spot-btn:hover {
  background-color: #0a6abf;
}

/* --- Modal --- */
dialog {
  border: none;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  width: 95%;
  max-width: 480px;
  background-color: rgba(0, 43, 92, 0.9);
  color: var(--text-light);
  padding: 20px 24px;
  position: relative;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

dialog::backdrop {
  background-color: rgba(0, 0, 0, 0.6);
}

dialog form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

dialog label {
  font-weight: 600;
  font-size: 14px;
  user-select: none;
  color: var(--text-light);
}

dialog input[type="text"],
dialog input[type="date"],
dialog input[type="number"],
dialog textarea {
  border-radius: 8px;
  border: 1px solid var(--border-light);
  background: var(--input-bg);
  color: var(--text-light);
  padding: 10px 14px;
  font-size: 15px;
  resize: vertical;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: border-color 0.3s ease;
}

dialog input[type="text"]:focus,
dialog input[type="date"]:focus,
dialog input[type="number"]:focus,
dialog textarea:focus {
  outline: none;
  border-color: var(--btn-bg);
  box-shadow: 0 0 6px var(--btn-bg-hover);
}

dialog textarea {
  min-height: 70px;
}

dialog .actions {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  margin-top: 10px;
}

dialog button {
  padding: 10px 16px;
  border-radius: 10px;
  border: none;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.3s ease;
}

dialog button[type="submit"] {
  background-color: var(--btn-bg);
  color: #e9f3ff;
}

dialog button[type="submit"]:hover {
  background-color: var(--btn-bg-hover);
}

dialog button.close-btn {
  background-color: transparent;
  color: var(--text-light);
  font-weight: 600;
}

dialog button.close-btn:hover {
  background-color: rgba(255 255 255 / 0.15);
}

/* Checkbox grupo horas y días */
#horasCheckboxes,
#diasCheckboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

#horasCheckboxes label,
#diasCheckboxes label {
  user-select: none;
  margin-right: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  color: var(--text-light);
}

#horasCheckboxes input[type="checkbox"],
#diasCheckboxes input[type="checkbox"] {
  cursor: pointer;
  margin-right: 4px;
}

/* --- Panel --- */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background: rgba(255, 255, 255, 0.03);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  height: 44px;
}

.container {
  padding: 20px;
}

.panel {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.tab-btn {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: transparent;
  cursor: pointer;
  color: var(--text-light);
}

.tab-btn.active {
  background: rgba(255, 255, 255, 0.06);
}

#tabContent, .tab-content {
  background: rgba(255, 255, 255, 0.03);
  padding: 12px;
  border-radius: 8px;
  min-height: 240px;
  color: var(--text-light);
  max-height: none !important;
  height: auto !important;
  overflow-y: visible !important;
}

.pauteo {
  padding: 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-light);
}

.pauteo .left {
  display: flex;
  gap: 12px;
  align-items: center;
}

.grupo-hora {
  margin-bottom: 1.2em;
}

.hora-block {
  display: flex;
  gap: 12px;
  padding: 10px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  align-items: flex-start;
  transition: background-color 0.3s ease;
}

.hora-label {
  width: 70px;
  font-weight: 700;
  font-size: 1.1rem;
  color: #0c8ce6;
  flex-shrink: 0;
  user-select: none;
}

.proxima-hora {
  background-color: #2e7d32;
  box-shadow: 0 0 10px 2px #81c784cc;
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 12px;
}

.badge {
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.15);
  font-size: 13px;
  color: var(--text-light);
}

.small {
  font-size: 13px;
  opacity: 0.9;
  color: var(--text-light);
}

/* --- Exportar / Tablas --- */
table th {
  background-color: #004080;
  color: white;
}

table td {
  border: 1px solid #ddd;
  padding: 8px;
  font-size: 13px;
  color: #000;
}

label {
  font-weight: bold;
  margin-right: 5px;
}

select {
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  margin-right: 15px;
}

#tipoFilter {
  margin-left: 15px;
}

.subtotal {
  background-color: #cfe3ff;
  font-weight: bold;
  color: #000;
}

.total {
  background-color: #99c2ff;
  font-weight: bold;
  color: #000;
}

/* --- Responsive --- */
@media (max-width: 480px) {
  .cliente-card {
    padding: 14px 16px;
  }
  dialog {
    padding: 16px 20px;
  }
  #searchCliente {
    font-size: 14px;
  }
}