/* ============================================
   CGLL Tenis - Sistema de Reservas
   ============================================ */

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

:root {
  --primary:     #8B1538;
  --primary-dk:  #6d1029;
  --primary-lt:  #a8234e;
  --accent:      #C4A94D;
  --accent-dk:   #a88e3a;
  --bg:          #f7f4f5;
  --surface:     #ffffff;
  --border:      #e4d9dc;
  --text:        #1a1a1a;
  --text-muted:  #6b5a5e;
  --danger:      #c62828;
  --radius:      8px;
  --shadow:      0 2px 8px rgba(139,21,56,0.10);
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
}

/* ---- Navbar ---- */
.navbar {
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 24px;
  height: 58px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.20);
  gap: 32px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar .logo {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  white-space: nowrap;
  color: #fff;
  text-decoration: none;
}

.navbar .nav-links {
  display: flex;
  gap: 4px;
  list-style: none;
  flex-wrap: wrap;
}

.navbar .nav-links a,
.navbar .nav-links span {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 0.93rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  display: block;
}

.navbar .nav-links a:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

.navbar .nav-links a.active,
.navbar .nav-links .active a {
  background: rgba(255,255,255,0.22);
  color: #fff;
}

/* ---- Layout ---- */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 20px;
}

h1, h2, h3 {
  color: var(--primary-dk);
  font-weight: 600;
  margin-bottom: 16px;
}

h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }

.subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 20px;
}

/* ---- Grid ---- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

/* ---- Cards ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 20px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s;
}

.card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.13);
}

.card h2,
.card h3 {
  margin-bottom: 10px;
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.big-number {
  font-size: 2.8rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
  margin: 8px 0 4px;
}

/* ---- Botones ---- */
button,
.btn-primary,
input[type="submit"] {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 9px 20px;
  border-radius: var(--radius);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  text-decoration: none;
  line-height: 1.4;
}

button:hover,
.btn-primary:hover,
input[type="submit"]:hover {
  background: var(--primary-dk);
}

button:active,
.btn-primary:active {
  transform: scale(0.98);
}

button.danger {
  background: var(--danger);
}

button.danger:hover {
  background: #b71c1c;
}

/* ---- Formularios ---- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.form-group input,
.form-group select,
.form-group textarea,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  color: var(--text);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(196,169,77,0.22);
}

.form-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.form-inline input,
.form-inline select {
  flex: 1;
  min-width: 140px;
}

/* ---- Resultado / mensajes ---- */
.result {
  margin-top: 16px;
  padding: 12px 16px;
  background: #fdf6e3;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  color: var(--primary-dk);
  font-size: 0.93rem;
  white-space: pre-wrap;
}

.result.error {
  background: #ffebee;
  border-color: #ef9a9a;
  color: var(--danger);
}

/* ---- Tablas ---- */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  margin-top: 12px;
}

thead th {
  background: var(--primary);
  color: #fff;
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.4px;
}

tbody tr:nth-child(odd) {
  background: #faf7f7;
}

tbody tr:hover {
  background: #fdf6e3;
}

td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

/* ---- Utilidades ---- */
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }

/* ---- Estado inline ---- */
.loading { color: var(--accent-dk); font-weight: 500; font-style: italic; }
.success  { color: #2e7d32; font-weight: 600; }
.error    { color: var(--danger); font-weight: 600; }

/* ---- Filas inactivas ---- */
tr.inactive { opacity: 0.55; }
tr.inactive td { font-style: italic; }

/* ---- Celdas de historial ---- */
td.success { color: #2e7d32; }
td.error   { color: var(--danger); }
td.error-msg { color: var(--text-muted); font-size: 0.85rem; max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- Barra de filtros ---- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.filter-bar label { font-weight: 600; font-size: 0.9rem; color: var(--text-muted); }

/* ---- Mensajes resultado en modales ---- */
.success-message {
  padding: 16px 20px;
  background: #e8f5e9;
  border: 1px solid #a5d6a7;
  border-radius: var(--radius);
  color: #2e7d32;
}
.success-message h3 { color: #2e7d32; margin-bottom: 10px; }

.error-message {
  padding: 16px 20px;
  background: #fde8ec;
  border: 1px solid var(--primary-lt);
  border-radius: var(--radius);
  color: var(--primary-dk);
}
.error-message h3 { color: var(--primary-dk); margin-bottom: 10px; }

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ---- Login ---- */
.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary-dk) 0%, var(--primary) 60%, var(--accent-dk) 100%);
}

.login-box {
  background: #fff;
  border-radius: 12px;
  padding: 44px 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
}

.login-box .logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-box .logo h1 {
  color: var(--primary);
  font-size: 1.6rem;
  font-weight: 700;
}

.login-box .logo h1 span {
  color: var(--accent);
}

.login-box .logo p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 4px;
}

.login-box .error {
  background: #fde8ec;
  color: var(--primary-dk);
  border: 1px solid var(--primary-lt);
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 18px;
  font-size: 0.9rem;
  display: none;
}

/* ---- Modal ---- */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: #fff;
  border-radius: 10px;
  padding: 32px;
  width: 90%;
  max-width: 560px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.22);
  position: relative;
}

.modal-content .close {
  position: absolute;
  top: 14px;
  right: 18px;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
}

.modal-content .close:hover {
  color: var(--primary);
}

/* ---- Status badges ---- */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 600;
}

.badge-success { background: #e8f5e9; color: #2e7d32; }
.badge-danger  { background: #fde8ec; color: var(--primary-dk); }
.badge-warning { background: #fff8e1; color: #f57f17; }

/* ---- Accent button ---- */
.btn-accent {
  background: var(--accent);
  color: #fff;
}

.btn-accent:hover {
  background: var(--accent-dk);
}

/* ---- Navbar logout link ---- */
.navbar .nav-links a.nav-logout {
  color: rgba(255,255,255,0.70);
}

.navbar .nav-links a.nav-logout:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

/* ---- Responsive ---- */
@media (max-width: 640px) {
  .navbar {
    padding: 0 14px;
    height: auto;
    flex-direction: column;
    align-items: flex-start;
    padding-top: 10px;
    padding-bottom: 10px;
    gap: 8px;
  }

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

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

  .container {
    padding: 16px 12px;
  }
}
