/* ================================================================
   Black Gold Training Argentina — Base CSS
   Design System: Light theme, corporate & professional
   ================================================================ */

/* ── CSS Custom Properties (Light Theme) ────────────────────── */
:root {
  /* Backgrounds — blancos y grises claros */
  --bg:           #f5f6f8;
  --bg-alt:       #eef0f3;
  --surface:      #ffffff;
  --surface-2:    #f5f6f8;
  --surface-3:    #eef0f3;
  --surface-hover:#e8eaed;

  /* Acento dorado (Black Gold) */
  --gold:         #b8920a;
  --gold-light:   #d4aa14;
  --gold-dark:    #8a6e08;
  --gold-muted:   rgba(184, 146, 10, 0.10);
  --gold-border:  rgba(184, 146, 10, 0.35);

  /* Texto */
  --text:         #1a1d23;
  --text-muted:   #5a6272;
  --text-faint:   #9aa0ad;
  --text-inverse: #ffffff;

  /* Bordes */
  --border:       #dde1e8;
  --border-light: #eef0f3;

  /* Estados — light theme */
  --success:      #1a7c3a;
  --success-light:#eafaf0;
  --success-text: #166534;
  --warning:      #b45309;
  --warning-light:#fffbeb;
  --warning-text: #92400e;
  --danger:       #c53030;
  --danger-light: #fff5f5;
  --danger-text:  #9b1c1c;
  --info:         #1d4ed8;
  --info-light:   #eff6ff;
  --info-text:    #1e40af;

  /* Tipografía */
  --font-ui:      'Inter', system-ui, sans-serif;
  --font-head:    'Outfit', 'Inter', sans-serif;

  /* Espaciado */
  --radius-sm:    4px;
  --radius:       6px;
  --radius-md:    8px;
  --radius-lg:    12px;
  --radius-xl:    16px;

  /* Sombras — más suaves para tema claro */
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.08);
  --shadow:       0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg:    0 8px 32px rgba(0,0,0,0.14);
  --shadow-gold:  0 4px 16px rgba(184,146,10,0.18);

  /* Transiciones */
  --trans:        0.18s ease;
  --trans-slow:   0.35s ease;
}

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

html {
  font-size: 14px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--gold-dark);
  text-decoration: none;
  transition: color var(--trans);
}
a:hover { color: var(--gold); }

img { max-width: 100%; display: block; }

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

ul, ol { list-style: none; }

/* ── Typography ─────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-head);
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
}
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1rem; }

.text-gold    { color: var(--gold); }
.text-muted   { color: var(--text-muted); }
.text-success { color: var(--success-text); }
.text-warning { color: var(--warning-text); }
.text-danger  { color: var(--danger-text); }
.text-info    { color: var(--info-text); }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.badge-success {
  background: var(--success-light);
  color: var(--success-text);
  border: 1px solid rgba(26,124,58,0.2);
}
.badge-warning {
  background: var(--warning-light);
  color: var(--warning-text);
  border: 1px solid rgba(180,83,9,0.2);
}
.badge-danger {
  background: var(--danger-light);
  color: var(--danger-text);
  border: 1px solid rgba(197,48,48,0.2);
}
.badge-neutral {
  background: var(--surface-3);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.badge-gold {
  background: var(--gold-muted);
  color: var(--gold-dark);
  border: 1px solid var(--gold-border);
}
.badge-info {
  background: var(--info-light);
  color: var(--info-text);
  border: 1px solid rgba(29,78,216,0.2);
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--trans);
  white-space: nowrap;
  line-height: 1.4;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--gold);
  color: #fff;
  border-color: var(--gold);
}
.btn-primary:hover {
  background: var(--gold-dark);
  border-color: var(--gold-dark);
  color: #fff;
  box-shadow: var(--shadow-gold);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: var(--surface-2);
  border-color: var(--gold-border);
  color: var(--gold-dark);
}

.btn-danger {
  background: var(--danger-light);
  color: var(--danger-text);
  border-color: rgba(197,48,48,0.3);
}
.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--surface-3);
  color: var(--text);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.76rem;
  border-radius: var(--radius-sm);
}
.btn-lg {
  padding: 11px 28px;
  font-size: 0.92rem;
  border-radius: var(--radius-md);
}
.btn-icon {
  padding: 6px;
  width: 30px;
  height: 30px;
  justify-content: center;
}

/* ── Forms (Oracle APEX compact style) ──────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.form-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.form-label.required::after {
  content: ' *';
  color: var(--danger-text);
}

.form-control {
  height: 30px;
  padding: 0 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.82rem;
  transition: border-color var(--trans), box-shadow var(--trans);
  width: 100%;
}
.form-control:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-muted);
}
.form-control::placeholder { color: var(--text-faint); }

.form-control-textarea {
  height: auto;
  min-height: 80px;
  padding: 8px 10px;
  resize: vertical;
}

select.form-control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%235a6272'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

/* Form grid layouts */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}
.form-grid-full { grid-column: 1 / -1; }

@media (max-width: 640px) {
  .form-grid-2, .form-grid-3 {
    grid-template-columns: 1fr;
  }
}

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface-2);
}
.card-header h3, .card-header h4 {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}
.card-body {
  padding: 16px 18px;
}

/* ── Alerts / Flash Messages ─────────────────────────────────── */
.alert {
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 0.83rem;
  border-left: 3px solid transparent;
  display: flex;
  align-items: center;
  gap: 8px;
}
.alert-success {
  background: var(--success-light);
  color: var(--success-text);
  border-color: var(--success);
}
.alert-danger {
  background: var(--danger-light);
  color: var(--danger-text);
  border-color: var(--danger);
}
.alert-warning {
  background: var(--warning-light);
  color: var(--warning-text);
  border-color: var(--warning);
}
.alert-info {
  background: var(--info-light);
  color: var(--info-text);
  border-color: var(--info);
}
.alert-close {
  margin-left: auto;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  opacity: 0.7;
  font-size: 1rem;
  line-height: 1;
}
.alert-close:hover { opacity: 1; }

/* ── Modals ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--trans-slow), visibility var(--trans-slow);
  backdrop-filter: blur(4px);
  overflow-y: auto;
}
.modal-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 640px;
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  transform: translateY(-20px);
  transition: transform var(--trans-slow);
  overflow: hidden;
  margin: auto;
}
.modal-overlay.is-open .modal {
  transform: translateY(0);
}
.modal-lg { max-width: 820px; }
.modal-sm { max-width: 440px; }

.modal form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.modal-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background: var(--surface-2);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.modal-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}
.modal-close {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all var(--trans);
}
.modal-close:hover {
  background: var(--danger-light);
  color: var(--danger-text);
  border-color: rgba(197,48,48,0.3);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
  background: var(--surface-2);
}

/* ── Dropdown ─────────────────────────────────────────────────── */
.dropdown {
  position: relative;
  display: inline-block;
}
.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 160px;
  z-index: 100;
  display: none;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.dropdown-menu.is-open { display: block; }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 0.8rem;
  color: var(--text);
  cursor: pointer;
  transition: background var(--trans);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.dropdown-item:hover {
  background: var(--surface-2);
  color: var(--gold-dark);
}
.dropdown-item.danger:hover {
  background: var(--danger-light);
  color: var(--danger-text);
}
.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ── Tables ──────────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.data-table thead th {
  background: var(--surface-2);
  padding: 9px 12px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table thead th.sorted-asc::after  { content: ' ↑'; color: var(--gold); }
.data-table thead th.sorted-desc::after { content: ' ↓'; color: var(--gold); }

.data-table tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
  color: var(--text);
  white-space: nowrap;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td {
  background: var(--surface-2);
}
.data-table tbody tr.selected td {
  background: var(--gold-muted);
}

/* Cell helpers */
.td-wrap { white-space: normal; max-width: 200px; }
.td-mono  { font-family: monospace; font-size: 0.75rem; color: var(--text-muted); }

/* ── Utilities ───────────────────────────────────────────────── */
.flex         { display: flex; }
.flex-col     { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }

.p-3 { padding: 12px; }
.p-4 { padding: 16px; }

.text-right  { text-align: right; }
.text-center { text-align: center; }
.text-sm     { font-size: 0.78rem; }
.text-xs     { font-size: 0.72rem; }
.font-bold   { font-weight: 700; }
.font-medium { font-weight: 500; }
.truncate    { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full      { width: 100%; }
.hidden      { display: none; }

/* ── Divider ─────────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}

/* ── Gold accent line ─────────────────────────────────────────── */
.gold-line {
  height: 2px;
  background: linear-gradient(90deg, var(--gold), transparent);
  margin-bottom: 16px;
}

/* ── Section header row ──────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.section-title {
  font-family: var(--font-head);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title::before {
  content: '';
  width: 3px;
  height: 18px;
  background: var(--gold);
  border-radius: 2px;
}

/* ── Search bar ──────────────────────────────────────────────── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.search-input-wrap .search-icon {
  position: absolute;
  left: 9px;
  color: var(--text-faint);
  font-size: 0.85rem;
  pointer-events: none;
}
.search-input {
  height: 30px;
  padding: 0 10px 0 30px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.82rem;
  width: 220px;
  transition: border-color var(--trans), width var(--trans);
}
.search-input:focus {
  outline: none;
  border-color: var(--gold);
  width: 260px;
}

/* ── Pagination ──────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 0;
}
.page-btn {
  height: 28px;
  min-width: 28px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.78rem;
  cursor: pointer;
  transition: all var(--trans);
}
.page-btn:hover, .page-btn.active {
  background: var(--gold-muted);
  border-color: var(--gold-border);
  color: var(--gold-dark);
}

/* ── Spinner ─────────────────────────────────────────────────── */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* ── Print base ──────────────────────────────────────────────── */
@media print {
  body { background: white; color: black; }
  .pub-navbar, .sidebar, .topbar, .btn, button, .modal-overlay, footer { display: none !important; }
  .admin-main { margin-left: 0 !important; }
}

/* ── Mobile and Cross-Device Responsive Rules ────────────────── */
@media (max-width: 768px) {
  html {
    font-size: 14px;
    -webkit-text-size-adjust: 100%;
  }

  body {
    overflow-x: hidden;
  }

  /* Prevent iOS auto-zoom on input focus */
  .form-control, input[type="text"], input[type="email"], input[type="password"],
  input[type="number"], input[type="tel"], select.form-control, textarea.form-control {
    font-size: 16px !important;
    height: 38px;
  }

  .form-control-textarea {
    height: auto;
  }

  /* Full touch support in tables */
  .table-wrapper {
    -webkit-overflow-scrolling: touch;
    overflow-x: auto;
    width: 100%;
    margin-bottom: 12px;
  }

  /* Modals on mobile */
  .modal-overlay {
    padding: 10px;
    align-items: flex-start;
    overflow-y: auto;
  }

  .modal {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 90vh !important;
    margin: 20px auto;
    border-radius: var(--radius-md);
  }

  .modal-body {
    padding: 14px 16px;
    -webkit-overflow-scrolling: touch;
  }

  .form-grid-2, .form-grid-3 {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }

  /* Touch-friendly buttons */
  .btn {
    min-height: 36px;
    padding: 8px 14px;
  }
}
