/* ═══════════════════════════════════════════════════
   PINEDI COMPLIANCE — BASE
   base.css
   ═══════════════════════════════════════════════════ */

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

html { height: 100%; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  background: var(--surface-0);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background var(--transition-slow), color var(--transition-slow);
}

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

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

button {
  font-family: var(--font-body);
  cursor: pointer;
  border: none;
  background: none;
}

input, select, textarea {
  font-family: var(--font-body);
  font-size: var(--text-base);
}

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-mid);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ─── SELECCIÓN DE TEXTO ─── */
::selection {
  background: var(--accent-soft);
  color: var(--text-primary);
}

/* ─── SHELL DE LA APP ─── */
#app-shell {
  display: none;
  min-height: 100vh;
}

#app-shell.visible {
  display: flex;
}

/* ─── SIDEBAR ─── */
#sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  transition: width var(--transition-slow);
  overflow: hidden;
  min-height: 0;
}

#sidebar.collapsed {
  width: var(--sidebar-w-col);
}

/* ─── CONTENIDO PRINCIPAL ─── */
#main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition-slow);
}

#sidebar.collapsed ~ #main-content,
#sidebar.collapsed + #main-content {
  margin-left: var(--sidebar-w-col);
}

/* ─── TOPBAR ─── */
#topbar {
  height: var(--header-h);
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

/* ─── ÁREA DE CONTENIDO ─── */
#panel-container {
  flex: 1;
  padding: 28px 28px;
  max-width: 1400px;
  width: 100%;
}

/* ─── PANTALLA DE LOGIN ─── */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-0);
  position: relative;
  overflow: hidden;
}

/* ─── TIPOGRAFÍA ─── */
.display { font-family: var(--font-display); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}

h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
h4 { font-size: var(--text-md); }

.text-sm      { font-size: var(--text-sm); }
.text-xs      { font-size: var(--text-xs); }
.text-muted   { color: var(--text-secondary); }
.text-dim     { color: var(--text-muted); }
.text-accent  { color: var(--accent); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-success { color: var(--success); }

/* ─── LOGIN — forzar tema oscuro siempre ─── */
#login-screen {
  background: #0a0f1e !important;
  color-scheme: dark;
}
@media (max-width: 768px) {
  #sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-w);
  }
  #sidebar.open {
    transform: translateX(0);
  }
  #main-content {
    margin-left: 0 !important;
  }
  #panel-container {
    padding: 16px;
  }
}
