/* ==========================================================================
   Precifica Fácil — global.css
   Tokens de design, reset e estilos base compartilhados por todo o sistema.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Cores base */
  --color-bg: #FAF7F2;
  --color-surface: #FFFFFF;
  --color-surface-alt: #F5F0E8;
  --color-border: #E7DFD1;
  --color-border-strong: #D8CDB9;

  --color-text: #2A251E;
  --color-text-muted: #7A7166;
  --color-text-soft: #A79E90;

  /* Acento — marca do produto (rescaldo de forno / tomate assado) */
  --color-primary: #C1440E;
  --color-primary-hover: #A6390B;
  --color-primary-soft: #FCEAE0;
  --color-primary-soft-strong: #F6D3BF;

  /* Sidebar (interior do forno) */
  --color-sidebar-bg: #1E1A16;
  --color-sidebar-bg-alt: #29231D;
  --color-sidebar-text: #B8AFA2;
  --color-sidebar-text-hover: #FFFFFF;
  --color-sidebar-border: #332C24;

  /* Feedback */
  --color-success: #3F7D4F;
  --color-success-soft: #E7F2E9;
  --color-danger: #B3261E;
  --color-danger-soft: #FBEAE9;
  --color-warning: #C68A1D;
  --color-warning-soft: #FBF1DF;

  /* Tipografia */
  --font-display: 'Sora', 'Segoe UI', Arial, sans-serif;
  --font-body: 'Inter', 'Segoe UI', Arial, sans-serif;

  /* Espaçamento */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  /* Raio e sombra */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(30, 26, 22, 0.06), 0 1px 1px rgba(30, 26, 22, 0.04);
  --shadow-md: 0 8px 24px rgba(30, 26, 22, 0.08);
  --shadow-lg: 0 16px 40px rgba(30, 26, 22, 0.14);

  /* Layout */
  --sidebar-width: 248px;
  --topbar-height: 68px;
}

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

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

h1 { font-size: 26px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }

p {
  margin: 0;
}

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

button {
  font-family: inherit;
  cursor: pointer;
}

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

ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

::selection {
  background: var(--color-primary-soft-strong);
}

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Utilitários */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.text-muted {
  color: var(--color-text-muted);
}

.text-danger {
  color: var(--color-danger);
  font-weight: 600;
}

/* ==========================================================================
/* ==========================================================================
   Carregamento de autenticação
   Exibido enquanto verificamos se existe uma sessão ativa no Firebase.
   ========================================================================== */
.auth-loading {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
}

.auth-loading__spinner {
  width: 26px;
  height: 26px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: precifica-spin .7s linear infinite;
}

.auth-loading p {
  font-size: 13px;
  color: var(--color-text-muted);
}

.auth-loading__error {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  max-width: 320px;
  text-align: center;
}

.auth-loading.has-error .auth-loading__spinner,
.auth-loading.has-error .auth-loading__text {
  display: none;
}

.auth-loading.has-error .auth-loading__error {
  display: flex;
}

.auth-loading__error p {
  color: var(--color-danger);
}

@keyframes precifica-spin {
  to { transform: rotate(360deg); }
}
