/* ============================================================
   BERLO DESARROLLOS — Base Architecture (base.css)
   Clean WebApp Base • Fluid Scale • WCAG 2.2 AA
   ============================================================ */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-canvas);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  transition: background-color var(--trans-smooth), color var(--trans-smooth);
  position: relative;
  overflow-x: hidden;
}

/* ── Typography & Headings ─────────────────────────────────── */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-sans);
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

h1 {
  font-size: var(--text-2xl);
  font-weight: 800;
}

h2 {
  font-size: var(--text-xl);
}

h3 {
  font-size: var(--text-lg);
}

h4 {
  font-size: var(--text-base);
  font-weight: 600;
}

p {
  color: var(--text-muted);
  font-size: var(--text-sm);
  line-height: 1.65;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: all var(--trans-fast);
}

[data-theme="dark"] a:hover {
  color: var(--color-accent);
}

code,
pre,
.mono {
  font-family: var(--font-mono);
  font-size: 0.85em;
}

/* ── Scrollbars ────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-pill);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ── Text Selection ────────────────────────────────────────── */
::selection {
  background: rgba(6, 79, 211, 0.35);
  color: #ffffff;
}

/* ── WCAG 2.2 AA Focus Rings ───────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ── Media Elements ────────────────────────────────────────── */
img {
  max-width: 100%;
  display: block;
}

svg {
  flex-shrink: 0;
}

ul,
ol {
  list-style: none;
}

/* ── WebApp Main Layout Wrapper ────────────────────────────── */
.app-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-canvas);
  position: relative;
}

/* Container for page views */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 2.25rem 1.25rem 7.5rem 1.25rem;
  /* Generous bottom padding for floating dock */
  position: relative;
}

.page-content {
  flex: 1;
  width: 100%;
}

/* ── Legacy Sidebar fallback for nested legacy views ───────── */
.sidebar {
  display: none !important;
}

/* ── Form Controls Base ────────────────────────────────────── */
input,
textarea,
select,
button {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
}

/* ── Auth Layout ───────────────────────────────────────────── */
.auth-layout {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-canvas);
  padding: 1.5rem;
  background-image:
    radial-gradient(ellipse at 20% 30%, rgba(6, 79, 211, 0.12) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 80%, rgba(5, 242, 212, 0.08) 0%, transparent 55%);
}

/* ── Helpers ───────────────────────────────────────────────── */
.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Responsive adjustments ────────────────────────────────── */
@media (max-width: 768px) {
  .main-content {
    padding: 0.75rem 0.75rem 6.5rem 0.75rem;
  }
}