/* ============================================================
   style.css — Estilos globales compartidos
   Partybook Admin Panel
   ============================================================ */

/* ── RESET & VARIABLES ─────────────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --navy-blue: #1a2a44;
  --gold-primary: #c5a059;
  --gold-light: #e2c275;
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 80px;

  /* Aliases cortos (compatibilidad con JS existente) */
  --navy:      #1a2a44;
  --gold:      #c5a059;
  --gold-l:    #e2c275;
  --white:     #fff;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-700: #334155;
  --slate-900: #0f172a;
  --indigo:    #4f46e5;
  --green:     #16a34a;
  --red:       #ef4444;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'Inter', system-ui, sans-serif;
  background: #f1f5f9;
}
body { display: flex; }


/* ── SIDEBAR ────────────────────────────────────────────────── */
.sidebar {
  background-color: var(--navy-blue);
  width: var(--sidebar-width);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  height: 100vh;
  z-index: 100;
  flex-shrink: 0;
  overflow: hidden;
}
.sidebar.collapsed { width: var(--sidebar-collapsed-width); }

.nav-text-wrapper {
  opacity: 1;
  transform: translateX(0);
  transition: opacity 0.3s ease, transform 0.3s ease, width 0.3s ease;
  white-space: nowrap;
  overflow: hidden;
  display: block;
  flex: 1;
  min-width: 160px;
}
.sidebar.collapsed .nav-text-wrapper {
  opacity: 0;
  transform: translateX(-15px);
  pointer-events: none;
  width: 0;
  min-width: 0;
  margin: 0 !important;
  display: none;
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 0.8rem 1.2rem;
  margin: 0.2rem 0.75rem;
  border-radius: 12px;
  color: #d1d5db;
  text-decoration: none !important;
  transition: all 0.2s;
  gap: 12px;
}
.nav-link svg { width: 24px; height: 24px; flex-shrink: 0; }
.nav-link:hover,
.nav-link.active       { color: #e2c275 !important; background: rgba(255,255,255,0.05); }
.nav-link.active       { background: rgba(197,160,89,0.15); border: 1px solid rgba(197,160,89,0.2); }
.sidebar.collapsed .nav-link { justify-content: center; padding: 0.8rem 0; margin: 0.2rem 0.5rem; gap: 0; }
.sidebar.collapsed .nav-link svg { margin: 0 !important; }

.sidebar-header {
  padding: 1.5rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 90px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar.collapsed .sidebar-header { justify-content: center; padding: 1.5rem 0.5rem; }
.sidebar-header img { width: 45px; height: 45px; flex-shrink: 0; }

.sidebar-footer {
  padding: 1rem;
  margin-top: auto;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.user-card {
  display: flex;
  align-items: center;
  padding: 0.75rem;
  background: rgba(255,255,255,0.05);
  border-radius: 12px;
  gap: 12px;
}
.sidebar.collapsed .user-card { background: transparent; justify-content: center; padding: 0.75rem 0; }

.avatar {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--gold-primary), var(--gold-light));
  color: var(--navy-blue);
  display: flex; align-items: center; justify-content: center;
  font-weight: bold;
  flex-shrink: 0;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 90;
}
.sidebar-overlay.active { display: block; }

.logo-title       { font-size: 1.125rem; font-weight: 700; color: white; line-height: 1.25; }
.logo-title span  { color: #c5a059; }
.logo-subtitle    { font-size: 9px; color: #93c5fd; text-transform: uppercase; letter-spacing: 0.1em; }
.user-name        { font-weight: 700; color: white; font-size: 0.875rem; }
.user-role        { font-size: 0.75rem; color: #60a5fa; }


/* ── MAIN LAYOUT ────────────────────────────────────────────── */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}


/* ── HEADER ─────────────────────────────────────────────────── */
header {
  height: 4rem;
  background: white;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  z-index: 10;
  flex-shrink: 0;
}
.header-left      { display: flex; align-items: center; gap: 0.5rem; }
.header-title     { font-size: 1rem; font-weight: 700; color: var(--navy-blue); }
.header-subtitle  { font-size: 10px; color: #9ca3af; }

.hamburger-btn {
  color: var(--navy-blue);
  padding: 0.5rem;
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: 0.5rem;
  transition: background 0.2s;
}
.hamburger-btn:hover { background: #f3f4f6; }
.hamburger-btn svg  { width: 1.25rem; height: 1.25rem; }

@media (min-width: 640px) {
  header            { height: 5rem; }
  .header-left      { gap: 1rem; }
  .header-title     { font-size: 1.25rem; }
  .header-subtitle  { font-size: 0.75rem; }
}


/* ── CONTENT AREA ───────────────────────────────────────────── */
.content-area { flex: 1; overflow-y: auto; padding: 1rem; }
@media (min-width: 640px)  { .content-area { padding: 1.5rem; } }
@media (min-width: 1024px) { .content-area { padding: 2.5rem; } }

.container { max-width: 1400px; margin: 0 auto; }


/* ── SCROLLBAR ──────────────────────────────────────────────── */
::-webkit-scrollbar       { width: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-primary); }


/* ── TYPOGRAPHY ─────────────────────────────────────────────── */
.page-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2.5rem;
  color: var(--navy-blue);
  text-align: center;
  margin-bottom: 10px;
  letter-spacing: 3px;
  font-weight: 700;
}
.page-subtitle {
  text-align: center;
  color: #64748b;
  margin-bottom: 40px;
  font-size: 1rem;
}
.section-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.6rem;
  color: var(--navy-blue);
  font-weight: 700;
}


/* ── BUTTONS ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.3s;
  font-family: 'Inter', sans-serif;
  white-space: nowrap;
}
.btn-primary { background: linear-gradient(135deg, var(--navy-blue), #2a3f66); color: white; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(26,42,68,0.35); }

.btn-danger  { background: linear-gradient(135deg, #f44336, #e57373); color: white; }
.btn-danger:hover  { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(244,67,54,0.4); }

.btn-success { background: linear-gradient(135deg, #4caf50, #66bb6a); color: white; }
.btn-success:hover { box-shadow: 0 4px 12px rgba(76,175,80,0.4); }

.btn-warning { background: linear-gradient(135deg, #f59e0b, #fbbf24); color: white; }
.btn-warning:hover { box-shadow: 0 4px 12px rgba(245,158,11,0.4); }

.btn-outline { background: white; border: 2px solid #e5e7eb; color: #64748b; }
.btn-outline:hover { border-color: var(--navy-blue); color: var(--navy-blue); }

.btn-sm  { padding: 6px 14px; font-size: 0.78rem; }

/* Aliases usados en adminusers.html */
.btn-create { @extend .btn; background: linear-gradient(135deg, var(--navy-blue), #2a3f66); color: white; }
.btn-save   { @extend .btn; background: linear-gradient(135deg, var(--navy-blue), #2a3f66); color: white; }
.btn-cancel { padding: 10px 22px; border: 2px solid #e5e7eb; background: white; border-radius: 10px; font-weight: 600; font-family: 'Inter', sans-serif; font-size: 0.875rem; cursor: pointer; color: #64748b; transition: all 0.2s; }
.btn-cancel:hover { border-color: #cbd5e1; background: #f8fafc; }

.action-btn {
  padding: 6px 14px;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.action-btn:hover { transform: translateY(-1px); }


/* ── TABS ───────────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  background: white;
  border-bottom: 2px solid #e5e7eb;
  padding: 0 1.5rem;
  flex-shrink: 0;
}
.tab-btn {
  padding: 0.75rem 1.25rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: #64748b;
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tab-btn.active  { color: var(--navy-blue); border-bottom-color: var(--gold-primary); }
.tab-content     { display: none; flex: 1; overflow-y: auto; padding: 1.5rem 2rem; }
.tab-content.active { display: block; }


/* ── SECTION HEAD ───────────────────────────────────────────── */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.toolbar h2 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.6rem;
  color: var(--navy-blue);
  font-weight: 700;
}
.search-bar {
  flex: 1;
  min-width: 200px;
  max-width: 380px;
  padding: 10px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  font-size: 0.9rem;
  font-family: 'Inter', sans-serif;
  transition: all 0.2s;
  color: var(--navy-blue);
}
.search-bar:focus {
  outline: none;
  border-color: var(--gold-primary);
  box-shadow: 0 0 0 3px rgba(197,160,89,0.1);
}


/* ── STAT CARDS ─────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}
.stat-card {
  background: white;
  border: 2px solid rgba(197,160,89,0.3);
  border-radius: 15px;
  padding: 24px 20px;
  text-align: center;
  transition: all 0.3s;
  animation: fadeIn 0.5s ease;
}
.stat-card:hover { border-color: var(--gold-primary); box-shadow: 0 8px 25px rgba(197,160,89,0.2); transform: translateY(-3px); }
.stat-card .number { font-family: 'Cormorant Garamond', serif; font-size: 2.8rem; font-weight: 700; color: var(--navy-blue); line-height: 1; margin-bottom: 6px; }
.stat-card .label  { font-size: 0.8rem; color: #64748b; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }


/* ── TABLES (genérica) ──────────────────────────────────────── */
.table-wrap,
.pages-wrap,
.matrix-wrap {
  background: white;
  border: 2px solid rgba(197,160,89,0.2);
  border-radius: 15px;
  overflow: hidden;
  animation: fadeIn 0.5s ease;
}
.matrix-wrap { overflow: auto; }

/* Cabecera compartida */
.users-table,
.pages-table,
.matrix-table { width: 100%; border-collapse: collapse; }
.matrix-table  { min-width: 600px; }

.users-table thead,
.pages-table thead  { background: #f8fafc; }
.matrix-table thead { background: #f8fafc; }

.users-table th,
.pages-table th {
  padding: 14px 16px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 2px solid #e5e7eb;
}
.matrix-table th {
  padding: 14px 16px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: center;
  border-bottom: 2px solid #e5e7eb;
}
.matrix-table th:first-child { text-align: left; }

.users-table td,
.pages-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.9rem;
  color: var(--navy-blue);
  vertical-align: middle;
}
.matrix-table td {
  padding: 12px 16px;
  font-size: 0.82rem;
  border-bottom: 1px solid #f1f5f9;
  text-align: center;
  vertical-align: middle;
}
.matrix-table td:first-child { text-align: left; font-weight: 600; color: var(--navy-blue); }

.users-table tbody tr:last-child td,
.pages-table tr:last-child td,
.matrix-table tr:last-child td { border-bottom: none; }

.users-table tbody tr:hover,
.pages-table tr:hover td,
.matrix-table tr:hover td { background: rgba(197,160,89,0.04); }

/* Helpers de tabla */
.uuid-display {
  background: #f1f5f9;
  padding: 5px 10px;
  border-radius: 6px;
  font-family: monospace;
  font-size: 11px;
  color: #64748b;
  word-break: break-all;
  max-width: 220px;
}
.page-href { font-family: monospace; font-size: 0.72rem; color: var(--indigo); background: #f1f5f9; padding: 3px 8px; border-radius: 6px; }
.actions   { display: flex; gap: 8px; flex-wrap: wrap; }

/* Checkbox matriz */
.cb-wrap { display: flex; justify-content: center; }
.cb { width: 18px; height: 18px; cursor: pointer; accent-color: var(--gold-primary); }


/* ── BADGES ─────────────────────────────────────────────────── */
.badge            { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-moderator  { background: rgba(197,160,89,0.15); color: var(--navy-blue); border: 1px solid rgba(197,160,89,0.4); }
.badge-user       { background: #f1f5f9; color: #64748b; border: 1px solid #e5e7eb; }

.status-badge  { display: inline-flex; align-items: center; gap: 5px; font-size: 0.72rem; font-weight: 600; padding: 4px 10px; border-radius: 100px; }
.status-active { background: #dcfce7; color: #16a34a; }
.status-inactive { background: #f1f5f9; color: #94a3b8; }
.status-dot    { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.dot-active    { background: #16a34a; }
.dot-inactive  { background: #94a3b8; }

.system-badge { font-size: 0.62rem; background: #fef3c7; color: #d97706; border: 1px solid #fde68a; padding: 2px 7px; border-radius: 100px; font-weight: 700; }


/* ── ROLE CARDS ─────────────────────────────────────────────── */
.roles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.25rem; }

.role-card {
  background: white;
  border: 2px solid rgba(197,160,89,0.2);
  border-radius: 15px;
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
  transition: all 0.3s;
  animation: fadeIn 0.5s ease;
}
.role-card:hover { border-color: var(--gold-primary); box-shadow: 0 8px 25px rgba(197,160,89,0.2); transform: translateY(-3px); }
.role-card-bar   { position: absolute; top: 0; left: 0; right: 0; height: 4px; border-radius: 15px 15px 0 0; }
.role-card-head  { display: flex; align-items: center; gap: 10px; margin-bottom: 0.75rem; }
.role-badge      { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
.role-name       { font-family: 'Cormorant Garamond', serif; font-size: 1.1rem; font-weight: 700; color: var(--navy-blue); }
.role-slug       { font-size: 0.7rem; color: #94a3b8; font-family: monospace; }
.role-desc       { font-size: 0.78rem; color: #64748b; margin-bottom: 0.75rem; min-height: 18px; }
.role-meta       { display: flex; align-items: center; justify-content: space-between; }
.role-count      { font-size: 0.72rem; color: #94a3b8; background: #f1f5f9; padding: 3px 8px; border-radius: 100px; display: inline-flex; align-items: center; gap: 4px; }
.role-actions    { display: flex; gap: 5px; }

.role-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.role-chip  { font-size: 0.65rem; font-weight: 700; padding: 2px 8px; border-radius: 100px; border: 1.5px solid; cursor: default; }


/* ── FORMS ──────────────────────────────────────────────────── */
.form-group   { margin-bottom: 1rem; }
.form-label, .form-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: #475569;
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.form-input,
.form-group input[type="text"],
.form-group input[type="number"],
.form-group select {
  width: 100%;
  padding: 11px 14px;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  font-size: 0.9rem;
  font-family: 'Inter', sans-serif;
  color: var(--navy-blue);
  transition: all 0.2s;
  outline: none;
}
.form-input:focus,
.form-group input[type="text"]:focus {
  border-color: var(--gold-primary);
  box-shadow: 0 0 0 3px rgba(197,160,89,0.1);
}
.form-group input[type="text"]:read-only { background: #f8fafc; color: #94a3b8; cursor: default; }
.form-group small { display: block; margin-top: 5px; font-size: 11px; color: #94a3b8; }
.form-row     { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.form-actions,
.modal-footer { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1.5rem; }

.checkbox-group                      { display: flex; align-items: center; gap: 10px; }
.checkbox-group input[type="checkbox"]{ width: 18px; height: 18px; accent-color: var(--gold-primary); cursor: pointer; }
.checkbox-group label                 { margin: 0; font-size: 0.9rem; text-transform: none; letter-spacing: 0; color: var(--navy-blue); font-weight: 600; }


/* ── MODALS ─────────────────────────────────────────────────── */
/* Variante adminusers (clase .modal) */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  justify-content: center;
  align-items: center;
  z-index: 9999;
  backdrop-filter: blur(2px);
}
.modal.active { display: flex; animation: fadeIn 0.25s ease; }

/* Variante roles (clase .modal-overlay) */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 200; align-items: center; justify-content: center; backdrop-filter: blur(2px); }
.modal-overlay.open { display: flex; animation: fadeIn 0.25s ease; }

/* Contenido del modal (ambas variantes) */
.modal-content,
.modal-overlay > .modal {
  background: white;
  padding: 2rem;
  border-radius: 20px;
  max-width: 480px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  border: 1px solid rgba(197,160,89,0.2);
  /* resetear los estilos del .modal padre cuando está anidado */
  display: block;
  position: static;
  inset: auto;
  backdrop-filter: none;
}
.modal-header,
.modal-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--navy-blue);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 1px;
}
.modal-header h3 { font-family: inherit; font-size: inherit; font-weight: inherit; color: inherit; }


/* ── TOAST ──────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  padding: 16px 24px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  display: none;
  align-items: center;
  gap: 12px;
  z-index: 9999;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--navy-blue);
  max-width: 340px;
}
.toast.active,
.toast.show  { display: flex; animation: slideInToast 0.3s ease; }
.toast.success { border-left: 4px solid #4caf50; }
.toast.error   { border-left: 4px solid #f44336; }


/* ── EMPTY STATE & LOADING ──────────────────────────────────── */
.empty-state { text-align: center; padding: 80px 20px; color: #94a3b8; }
.empty-state svg { width: 64px; height: 64px; margin: 0 auto 16px; opacity: 0.4; display: block; }
.empty-state p   { font-size: 1rem; color: #64748b; }

.loading  { text-align: center; padding: 60px 20px; color: var(--navy-blue); }
.spinner  {
  border: 3px solid #e5e7eb;
  border-top: 3px solid var(--gold-primary);
  border-radius: 50%;
  width: 36px; height: 36px;
  animation: spin 0.9s linear infinite;
  margin: 0 auto 16px;
}


/* ── ANIMATIONS ─────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes spin {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
@keyframes slideInToast {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}


/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 1023px) {
  .sidebar { position: fixed; left: 0; transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); width: var(--sidebar-width) !important; }
  .sidebar.mobile-open .nav-text-wrapper { display: block !important; opacity: 1 !important; transform: translateX(0) !important; width: auto !important; min-width: 160px !important; }
  main   { margin-left: 0 !important; width: 100vw !important; }
  header { padding: 0 1rem; }
  .roles-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .page-title  { font-size: 1.8rem; }
  .toolbar     { flex-direction: column; align-items: stretch; }
  .search-bar  { max-width: 100%; }
  .users-table th:nth-child(2), .users-table td:nth-child(2) { display: none; }
  .users-table th:nth-child(4), .users-table td:nth-child(4) { display: none; }
}
