/* ================================================================
   BLIBAK CMS — Design System v3.0
   main.css · Base global para layout público (landing, auth)
================================================================ */

/* ─── GOOGLE FONTS ─────────────────────────────────────────── */
/* Inter se carga vía <link rel="preconnect"> + <link rel="stylesheet">
   en layout_public.php y layout_logged.php (más rápido, no bloquea
   el render como un @import). Este @import quedaba aquí duplicando
   esa carga con una petición extra que sí bloquea. */

/* ─── VARIABLES ─────────────────────────────────────────────── */
:root {
  --brand:          #2563eb;
  --brand-dark:     #1d4ed8;
  --brand-darker:   #1e40af;
  --brand-light:    #eff6ff;
  --brand-mid:      #dbeafe;

  --text-primary:   #0f172a;
  --text-secondary: #475569;
  --text-muted:     #94a3b8;
  --text-white:     #ffffff;

  --bg-page:        #f8fafc;
  --bg-white:       #ffffff;
  --bg-subtle:      #f1f5f9;
  --bg-dark:        #0f172a;

  --border:         #e2e8f0;
  --border-strong:  #cbd5e1;

  --card-bg:        #ffffff;
  --input-bg:       #ffffff;
  --input-border:   #e2e8f0;

  --shadow-xs:  0 1px 3px rgba(15,23,42,.06);
  --shadow-sm:  0 4px 12px rgba(15,23,42,.08);
  --shadow-md:  0 8px 24px rgba(15,23,42,.10);
  --shadow-lg:  0 16px 48px rgba(15,23,42,.14);
  --shadow-xl:  0 24px 64px rgba(15,23,42,.18);

  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  18px;
  --radius-xl:  24px;
  --radius-2xl: 32px;
  --radius-full:999px;

  --header-h:   68px;
  --font:       'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --ease:       cubic-bezier(.4,0,.2,1);
  --ease-spring:cubic-bezier(.34,1.56,.64,1);
}

/* ─── RESET ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-tap-highlight-color: transparent; font-size: 16px; }
body {
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: var(--brand); text-decoration: none; transition: color .2s; }
a:hover { color: var(--brand-dark); }
h1,h2,h3,h4,h5,h6 { line-height: 1.2; font-weight: 700; color: var(--text-primary); }
p { color: var(--text-secondary); }

/* ─── HEADER PÚBLICO ─────────────────────────────────────────── */
.site-header {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--brand);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px;
  z-index: 1000;
  box-shadow: 0 1px 0 rgba(255,255,255,.08) inset, 0 4px 24px rgba(0,0,0,.12);
  backdrop-filter: saturate(180%) blur(14px);
}

.logo-left {
  display: flex; align-items: center; gap: 11px;
}
.logo-left img {
  height: 34px; width: auto; object-fit: contain;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,.18));
}
.logo-left span {
  font-size: 1.15rem; font-weight: 800; color: white;
  letter-spacing: -.015em;
}

.menu-right {
  display: flex; align-items: center; gap: 6px;
}
.menu-right a {
  color: rgba(255,255,255,.88); font-weight: 600;
  font-size: .87rem; padding: 9px 18px;
  border-radius: var(--radius-full);
  transition: all .2s var(--ease);
  letter-spacing: -.005em;
}
.menu-right a:hover { background: rgba(255,255,255,.12); color: white; }
.menu-right a.btn-header {
  background: white;
  color: var(--brand);
  border: 1.5px solid transparent;
  box-shadow: 0 2px 10px rgba(0,0,0,.12);
  margin-left: 4px;
}
.menu-right a.btn-header:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,.18);
  background: white; color: var(--brand);
}

/* ─── MAIN ───────────────────────────────────────────────────── */
main { padding-top: var(--header-h); min-height: calc(100vh - var(--header-h)); }

/* ─── FOOTER ─────────────────────────────────────────────────── */
.site-footer {
  background: var(--bg-dark);
  color: rgba(255,255,255,.7);
  text-align: center;
  padding: 24px 20px;
  font-size: .85rem;
  font-weight: 500;
}
.site-footer strong { color: white; }

/* ─── BOTONES ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 22px; border-radius: var(--radius-full);
  border: none; font-family: var(--font); font-weight: 600;
  font-size: .9rem; cursor: pointer; text-decoration: none;
  transition: all .2s var(--ease); white-space: nowrap; line-height: 1;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed !important; transform: none !important; }

.btn-primary { background: var(--brand); color: white; box-shadow: 0 4px 14px rgba(37,99,235,.3); }
.btn-primary:hover { background: var(--brand-dark); transform: translateY(-1px); box-shadow: 0 8px 22px rgba(37,99,235,.4); color: white; }

.btn-secondary { background: var(--bg-subtle); color: var(--text-primary); border: 1.5px solid var(--border); }
.btn-secondary:hover { background: var(--border); color: var(--text-primary); }

.btn-ghost { background: transparent; color: var(--brand); border: 2px solid var(--brand); }
.btn-ghost:hover { background: var(--brand); color: white; }

.btn-danger { background: #ef4444; color: white; }
.btn-danger:hover { background: #dc2626; color: white; transform: translateY(-1px); }

.btn-sm { padding: 7px 14px; font-size: .8rem; }
.btn-lg { padding: 14px 30px; font-size: 1rem; }
.btn-xl { padding: 16px 36px; font-size: 1.05rem; }
.btn-block { width: 100%; justify-content: center; }

/* ─── TARJETAS ───────────────────────────────────────────────── */
.card {
  background: var(--bg-white); border-radius: var(--radius-lg);
  padding: 24px; box-shadow: var(--shadow-sm);
  border: 1px solid var(--border); margin-bottom: 20px;
}
.card-sm { padding: 16px; border-radius: var(--radius-md); }
.card-hover { transition: transform .2s, box-shadow .2s; }
.card-hover:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

/* ─── ALERTAS ────────────────────────────────────────────────── */
.alert {
  padding: 13px 16px; border-radius: var(--radius-md);
  font-weight: 600; font-size: .875rem; margin-bottom: 16px;
  display: flex; align-items: flex-start; gap: 10px;
  border-left: 4px solid transparent;
  animation: slideDown .25s var(--ease);
}
@keyframes slideDown { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:none; } }
.alert-success { background: #f0fdf4; color: #15803d; border-color: #22c55e; }
.alert-error,
.alert-danger   { background: #fef2f2; color: #b91c1c; border-color: #ef4444; }
.alert-warning  { background: #fffbeb; color: #92400e; border-color: #f59e0b; }
.alert-info     { background: #eff6ff; color: #1e40af; border-color: #3b82f6; }

/* ─── FORMULARIOS ────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block; font-weight: 600;
  font-size: .85rem; color: var(--text-primary); margin-bottom: 6px;
}
.form-control {
  width: 100%; padding: 11px 14px; border-radius: var(--radius-md);
  border: 1.5px solid var(--border); font-family: var(--font);
  font-size: .95rem; background: var(--bg-subtle);
  color: var(--text-primary); transition: all .2s;
}
.form-control:focus {
  outline: none; border-color: var(--brand);
  background: var(--bg-white); box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
textarea.form-control { resize: vertical; min-height: 100px; }

/* ─── BADGE ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: var(--radius-full);
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
}
.badge-blue  { background: var(--brand-mid); color: #1e40af; }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-red   { background: #fee2e2; color: #b91c1c; }
.badge-yellow{ background: #fef3c7; color: #92400e; }
.badge-gray  { background: #f3f4f6; color: #374151; }

/* ─── AVATARES ───────────────────────────────────────────────── */
.avatar { border-radius: 50%; object-fit: cover; background: var(--border); flex-shrink: 0; }
.avatar-xs  { width: 28px; height: 28px; }
.avatar-sm  { width: 38px; height: 38px; }
.avatar-md  { width: 52px; height: 52px; }
.avatar-lg  { width: 72px; height: 72px; }
.avatar-xl  { width: 96px; height: 96px; }
.avatar-2xl { width: 128px; height: 128px; }

/* ─── GRID / FLEX ────────────────────────────────────────────── */
.grid    { display: grid; gap: 16px; }
.grid-2  { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3  { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-4  { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.flex    { display: flex; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-1   { gap: 8px; }
.gap-2   { gap: 16px; }
.gap-3   { gap: 24px; }
.flex-wrap { flex-wrap: wrap; }
.flex-col  { flex-direction: column; }
.flex-1    { flex: 1; }

/* ─── UTILIDADES ─────────────────────────────────────────────── */
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-muted   { color: var(--text-muted); }
.text-sm      { font-size: .875rem; }
.text-xs      { font-size: .75rem; }
.text-lg      { font-size: 1.125rem; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.p-0  { padding: 0; }
.w-full { width: 100%; }
.min-0  { min-width: 0; }
.sr-only { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); }

/* ─── SKELETON LOADER ────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, #f0f4f8 25%, #e2e8f0 50%, #f0f4f8 75%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { to { background-position: -400% 0; } }

/* ─── SPINNER ────────────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2.5px solid rgba(37,99,235,.2);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .65s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── EMPTY STATE ────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 56px 24px; }
.empty-state .empty-icon { font-size: 3.5rem; margin-bottom: 14px; }
.empty-state h3 { font-size: 1.15rem; color: var(--text-primary); margin-bottom: 8px; }
.empty-state p  { color: var(--text-muted); font-size: .9rem; max-width: 320px; margin: 0 auto 20px; }

/* ─── DIVIDER ────────────────────────────────────────────────── */
.divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--text-muted); font-size: .8rem; margin: 20px 0;
}
.divider::before, .divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ─── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .site-header { padding: 0 16px; }
  .logo-left .logo-text { font-size: 1rem; }
  .menu-right a:not(.btn-header) span { display: none; }
  .card { padding: 16px; }
  .btn-lg { padding: 12px 22px; font-size: .9rem; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  :root { --header-h: 60px; }
  .btn-xl { padding: 13px 24px; }
}

/* ─── MODO OSCURO ────────────────────────────────────────────── */
[data-theme="dark"] {
  --text-primary:   #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #64748b;

  --bg-page:        #0f172a;
  --bg-white:       #1e293b;
  --bg-subtle:      #1e293b;

  --border:         #334155;
  --border-strong:  #475569;

  --card-bg:        #1e293b;
  --input-bg:       #1e293b;
  --input-border:   #334155;

  --brand-light:    rgba(37,99,235,.15);
  --brand-mid:      rgba(37,99,235,.25);
}

[data-theme="dark"] body {
  background: #0f172a;
  color: #f1f5f9;
}

[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6 { color: #f1f5f9; }

[data-theme="dark"] p { color: #94a3b8; }
[data-theme="dark"] a { color: #60a5fa; }

/* ─── MODO OSCURO (fix) — override previous section ─────────── */
:root[data-theme="dark"] {
  --text-primary:   #f1f5f9 !important;
  --text-secondary: #94a3b8;
  --text-muted:     #64748b;
  --bg-page:        #0f172a;
  --bg-white:       #1e293b;
  --bg-subtle:      #1e293b;
  --border:         #334155;
  --border-strong:  #475569;
}
[data-theme="dark"] body {
  background: #0f172a !important;
  color: #f1f5f9 !important;
}
