/* ==============================================================================
   PANEL ADMINISTRATIVO - SISTEMA DE DISEÑO ESCUELA DE TERAPIAS INTERNACIONAL
   Paleta: Obsidian Deep, Royal Gold, Slate Gray, Esmeralda y Zafiro.
   ============================================================================== */

:root {
  --bg-deep: #070d18;
  --bg-surface: #0c1728;
  --bg-surface-elevated: #112038;
  --bg-card: rgba(16, 29, 50, 0.7);
  --bg-card-hover: rgba(22, 40, 70, 0.85);

  --gold-primary: #d4af37;
  --gold-glow: #e2b755;
  --gold-dark: #9a6f1a;
  --gold-grad: linear-gradient(135deg, #fef4dc 0%, #e2b755 35%, #c59331 65%, #f2d58a 85%, #9a6f1a 100%);
  --gold-text-grad: linear-gradient(180deg, #ffffff 0%, #ffe8b3 35%, #dfb252 75%, #9e731d 100%);

  --emerald: #10b981;
  --emerald-bg: rgba(16, 185, 129, 0.15);
  --amber: #f59e0b;
  --amber-bg: rgba(245, 158, 11, 0.15);
  --ruby: #ef4444;
  --ruby-bg: rgba(239, 68, 68, 0.15);
  --sky: #38bdf8;
  --sky-bg: rgba(56, 189, 248, 0.15);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --border: rgba(255, 255, 255, 0.08);
  --border-gold: rgba(212, 175, 55, 0.3);

  --font-serif: 'Cinzel', Georgia, serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px rgba(226, 183, 85, 0.2);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-deep);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.font-serif {
  font-family: var(--font-serif);
}

.gold-text {
  background: var(--gold-text-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ==============================================================================
   PANTALLA DE ACCESO (LOGIN)
   ============================================================================== */
.login-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 20%, #15243e 0%, #060b13 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 1000;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-surface);
  border: 1px solid var(--border-gold);
  border-radius: 16px;
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gold-grad);
}

.login-brand {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo {
  width: 64px;
  height: 64px;
  margin-bottom: 1rem;
  filter: drop-shadow(0 0 12px rgba(212, 175, 55, 0.4));
}

.login-title {
  font-size: 1.5rem;
  letter-spacing: 0.1em;
  color: var(--gold-glow);
  margin-bottom: 0.25rem;
}

.login-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.form-group input,
.form-group select,
.form-group textarea {
  background: #08111e;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--gold-primary);
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.2);
}

.field-hint {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.btn-primary {
  background: var(--gold-grad);
  color: #070d18;
  border: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.8rem 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-main);
  font-weight: 500;
  font-size: 0.9rem;
  padding: 0.7rem 1.25rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.alert-box {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
}

.alert-box.error {
  background: var(--ruby-bg);
  border: 1px solid var(--ruby);
  color: #fca5a5;
}

.login-footer-hint {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.4;
  margin-top: 0.5rem;
}

/* ==============================================================================
   ADMIN LAYOUT & HEADER
   ============================================================================== */
.admin-app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.admin-topbar {
  height: 68px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  text-decoration: none;
}

.topbar-logo {
  width: 36px;
  height: 36px;
}

.topbar-brand-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--gold-glow);
  display: block;
  line-height: 1.1;
}

.topbar-brand-badge {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  text-transform: uppercase;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.admin-user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gold-grad);
  color: #070d18;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.user-meta strong {
  display: block;
  font-size: 0.85rem;
  color: var(--text-main);
  line-height: 1.1;
}

.user-meta span {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.btn-logout {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 0.4rem 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.btn-logout:hover {
  border-color: var(--ruby);
  color: var(--ruby);
  background: var(--ruby-bg);
}

/* ==============================================================================
   SIDEBAR & TABS
   ============================================================================== */
.admin-layout {
  display: flex;
  flex: 1;
}

.admin-sidebar {
  width: 250px;
  background: #091220;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.5rem 1rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.nav-item {
  width: 100%;
  background: transparent;
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
}

.nav-item.active {
  background: rgba(212, 175, 55, 0.12);
  color: var(--gold-glow);
  font-weight: 600;
}

.nav-item.active svg {
  stroke: var(--gold-glow);
}

.sidebar-footer {
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.server-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-indicator.online {
  background: var(--emerald);
  box-shadow: 0 0 8px var(--emerald);
}

.status-indicator.offline {
  background: var(--ruby);
}

/* ==============================================================================
   MAIN CONTENT & PANES
   ============================================================================== */
.admin-main {
  flex: 1;
  padding: 2rem;
  max-width: 1400px;
  width: 100%;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

.pane-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 2rem;
  gap: 1rem;
}

.pane-title {
  font-size: 1.6rem;
  color: var(--gold-glow);
  letter-spacing: 0.04em;
  margin-bottom: 0.3rem;
}

.pane-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ==============================================================================
   STATS & CARDS
   ============================================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.2s ease;
}

.stat-card:hover {
  border-color: var(--border-gold);
  transform: translateY(-2px);
}

.stat-icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon-wrapper.gold { background: rgba(212, 175, 55, 0.15); color: var(--gold-glow); }
.stat-icon-wrapper.green { background: var(--emerald-bg); color: var(--emerald); }
.stat-icon-wrapper.blue { background: var(--sky-bg); color: var(--sky); }
.stat-icon-wrapper.amber { background: var(--amber-bg); color: var(--amber); }

.stat-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.stat-value {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1;
}

.dashboard-banner {
  background: linear-gradient(135deg, rgba(17, 32, 56, 0.9) 0%, rgba(9, 18, 32, 0.9) 100%);
  border: 1px solid var(--border-gold);
  border-radius: 14px;
  padding: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.banner-content h3 {
  font-size: 1.3rem;
  margin-bottom: 0.4rem;
}

.banner-content p {
  color: var(--text-muted);
  max-width: 650px;
  font-size: 0.95rem;
}

.banner-cta {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ==============================================================================
   FILTERS & DATA TABLES
   ============================================================================== */
.filter-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.search-box {
  flex: 1;
  min-width: 260px;
  position: relative;
  display: flex;
  align-items: center;
}

.search-box svg {
  position: absolute;
  left: 1rem;
  color: var(--text-dim);
}

.search-box input {
  width: 100%;
  background: #091220;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem 1rem 0.7rem 2.6rem;
  color: var(--text-main);
  font-size: 0.9rem;
}

.filter-select {
  background: #091220;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem 1rem;
  color: var(--text-main);
  font-size: 0.9rem;
}

.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.data-table th {
  background: #091322;
  color: var(--text-muted);
  font-weight: 600;
  text-align: left;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.data-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.badge-status {
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-block;
  text-transform: capitalize;
}

.badge-status.vigente {
  background: var(--emerald-bg);
  color: var(--emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-status.en_revision {
  background: var(--amber-bg);
  color: var(--amber);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-status.suspendido {
  background: var(--ruby-bg);
  color: var(--ruby);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-tag {
  background: rgba(212, 175, 55, 0.12);
  color: var(--gold-glow);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  display: inline-block;
  margin-right: 4px;
  margin-bottom: 3px;
}

.action-buttons {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.btn-icon {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  border-color: var(--gold-primary);
  color: var(--gold-glow);
  background: rgba(212, 175, 55, 0.1);
}

.btn-icon.delete:hover {
  border-color: var(--ruby);
  color: var(--ruby);
  background: var(--ruby-bg);
}

/* ==============================================================================
   VERIFIER & INTEGRATION CARDS
   ============================================================================== */
.verifier-card {
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: 14px;
  padding: 2.5rem;
  max-width: 650px;
}

.verifier-input-group {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.verifier-input-group input {
  flex: 1;
  background: #08111e;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1.2rem;
  color: var(--text-main);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.verifier-result-box {
  background: #091322;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
}

.integration-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 1.5rem;
}

.integration-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.integration-head h3 {
  font-size: 1.1rem;
  color: var(--text-main);
  margin-top: 0.4rem;
}

.code-box {
  background: #050a12;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  overflow-x: auto;
}

.code-box pre {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.82rem;
  color: #93c5fd;
  line-height: 1.4;
}

/* ==============================================================================
   MODALS
   ============================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 9, 18, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 1000;
  overflow-y: auto;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-gold);
  border-radius: 14px;
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.form-row.two-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-row.three-cols {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
}

.form-row.checkboxes {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  accent-color: var(--gold-primary);
  width: 16px;
  height: 16px;
}

.form-section-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gold-glow);
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
  margin-top: 0.5rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* ==============================================================================
   RESPONSIVIDAD
   ============================================================================== */
@media (max-width: 900px) {
  .admin-layout {
    flex-direction: column;
  }
  .admin-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .nav-item {
    width: auto;
  }
  .form-row.two-cols,
  .form-row.three-cols {
    grid-template-columns: 1fr;
  }
}
