/* ============================================
   LUNAE ACADEMY - Estilos principais
   Paleta: azul-ardósia + creme
   Tipografia: Fraunces (display) + Inter (body)
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Paleta principal */
  --slate: #1E2A38;
  --slate-soft: #3D5066;
  --cream: #F7F4ED;
  --white: #FFFFFF;
  --stone: #D8D3C8;
  --stone-dark: #B5AFA3;
  --muted: #6B6660;

  /* Cores semânticas (dessaturadas) */
  --success: #5A7A5C;
  --success-bg: #E8EDE8;
  --warning: #C89B3C;
  --warning-bg: #F8EFD8;
  --danger: #B85042;
  --danger-bg: #F8E3E0;
  --info: #1E2A38;
  --info-bg: #E5E9EE;

  /* Espaçamento e raios */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 2px rgba(30,42,56,0.04), 0 1px 1px rgba(30,42,56,0.04);
  --shadow: 0 2px 8px rgba(30,42,56,0.06), 0 1px 3px rgba(30,42,56,0.04);
  --shadow-lg: 0 12px 32px rgba(30,42,56,0.08), 0 4px 12px rgba(30,42,56,0.05);
  --shadow-hover: 0 6px 20px rgba(30,42,56,0.12), 0 2px 6px rgba(30,42,56,0.06);

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--slate);
  background: var(--cream);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Atmosfera sutil de fundo */
body {
  min-height: 100vh;
  background-image:
    radial-gradient(circle at 10% 0%, rgba(30,42,56,0.025), transparent 40%),
    radial-gradient(circle at 100% 100%, rgba(200,155,60,0.04), transparent 50%);
}

/* ----------------------------------------
   Tipografia
   ---------------------------------------- */
h1, h2, h3, h4 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 500;
  color: var(--slate);
  letter-spacing: -0.02em;
  margin: 0 0 0.5em;
  line-height: 1.15;
}
h1 { font-size: 36px; }
h2 { font-size: 26px; }
h3 { font-size: 20px; }
h4 { font-size: 17px; font-family: 'Inter', sans-serif; font-weight: 600; letter-spacing: 0; }

p { margin: 0 0 1em; color: var(--slate-soft); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
em { font-style: italic; color: var(--slate-soft); }

a { color: var(--slate); text-decoration: underline; text-underline-offset: 3px; }
a:hover { color: var(--slate-soft); }

/* ----------------------------------------
   Logo / nome da marca
   ---------------------------------------- */
.brand {
  font-family: 'Fraunces', serif;
  font-size: 22px;
  font-weight: 400;
  font-style: italic;
  letter-spacing: -0.01em;
  color: var(--slate-soft);
  text-decoration: none;
}
.brand em {
  /* No HTML escrevemos "Lunae <em>Academy</em>" — agora ambos têm o mesmo
     estilo, mas mantemos a tag <em> caso queiramos diferenciar no futuro. */
  font-style: italic;
  color: var(--slate-soft);
  margin-left: 4px;
}
.brand-lg {
  font-size: 34px;
}

/* ----------------------------------------
   Layout
   ---------------------------------------- */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}
.container-sm {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 20px;
}

.app-header {
  background: var(--cream);
  border-bottom: 1px solid var(--stone);
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}
.app-header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}
.app-header-left {
  display: flex;
  align-items: center;
  gap: 32px;
}
.app-nav {
  display: flex;
  gap: 4px;
}
.nav-link {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--slate-soft);
  text-decoration: none;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.nav-link:hover { background: rgba(30,42,56,0.05); color: var(--slate); }
.nav-link-active { background: var(--slate); color: var(--cream); }
.nav-link-active:hover { background: var(--slate); color: var(--cream); }
.user-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

@media (max-width: 720px) {
  .app-header-inner { flex-direction: column; align-items: flex-start; gap: 12px; }
  .app-header-left { flex-direction: column; align-items: flex-start; gap: 12px; width: 100%; }
  .app-nav { flex-wrap: wrap; }
  .user-menu { width: 100%; justify-content: space-between; }
}

main {
  padding: 40px 0 80px;
}

/* ----------------------------------------
   Cartões
   ---------------------------------------- */
.card {
  background: var(--white);
  border: 1px solid var(--stone);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow);
}
.card-tight { padding: 20px; }

/* ----------------------------------------
   Formulários
   ---------------------------------------- */
.field { margin-bottom: 18px; }

label {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 12px 14px;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  color: var(--slate);
  background: var(--cream);
  border: 1.5px solid var(--stone);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
input:focus, textarea:focus, select:focus {
  border-color: var(--slate);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(30,42,56,0.08);
}
input::placeholder { color: var(--stone-dark); }

.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 480px) {
  .input-row { grid-template-columns: 1fr; }
}

.field-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 5px;
}

/* Checkbox custom */
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--slate-soft);
  cursor: pointer;
  user-select: none;
}
.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--slate);
  cursor: pointer;
}

/* ----------------------------------------
   Botões — com hover pulse e press
   ---------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 22px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  position: relative;
  transition:
    transform 0.12s var(--ease),
    box-shadow 0.18s var(--ease),
    background 0.15s var(--ease);
  -webkit-tap-highlight-color: transparent;
}

/* Botão primário */
.btn-primary {
  background: var(--slate);
  color: var(--cream);
  box-shadow: var(--shadow);
}
.btn-primary:hover {
  background: #15202C;
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
  animation: btn-pulse 1.8s var(--ease) infinite;
}
.btn-primary:active {
  transform: translateY(1px) scale(0.98);
  box-shadow: var(--shadow-sm);
  animation: none;
}

@keyframes btn-pulse {
  0%, 100% { box-shadow: var(--shadow-hover); }
  50% { box-shadow: 0 8px 24px rgba(30,42,56,0.18), 0 2px 8px rgba(30,42,56,0.10); }
}

/* Botão secundário — sem hover-pulse, só press */
.btn-secondary {
  background: var(--white);
  color: var(--slate);
  border: 1.5px solid var(--stone);
}
.btn-secondary:hover {
  background: var(--cream);
  border-color: var(--slate-soft);
}
.btn-secondary:active {
  transform: translateY(1px) scale(0.98);
  background: var(--stone);
}

/* Botão "ghost" / link — sem hover-pulse, só press */
.btn-ghost {
  background: transparent;
  color: var(--slate-soft);
  padding: 10px 16px;
}
.btn-ghost:hover { color: var(--slate); }
.btn-ghost:active { transform: scale(0.96); color: var(--slate); }

/* Botão full-width */
.btn-block {
  width: 100%;
}

/* Tamanho large */
.btn-lg {
  padding: 16px 28px;
  font-size: 15px;
}

/* Botão danger */
.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover { background: #9C3F33; transform: translateY(-1px); }
.btn-danger:active { transform: translateY(1px) scale(0.98); }

button:disabled,
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  animation: none !important;
  transform: none !important;
}

/* ----------------------------------------
   Mensagens (flash, erros, sucessos)
   ---------------------------------------- */
.msg {
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 18px;
  border-left: 3px solid;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease), margin 0.25s var(--ease), padding 0.25s var(--ease), max-height 0.25s var(--ease);
  max-height: 200px;
  overflow: hidden;
}
.msg-success { background: var(--success-bg); color: var(--success); border-color: var(--success); }
.msg-error   { background: var(--danger-bg);  color: var(--danger);  border-color: var(--danger); }
.msg-warning { background: var(--warning-bg); color: #8A6A1C; border-color: var(--warning); }
.msg-info    { background: var(--info-bg);    color: var(--slate);   border-color: var(--slate); }

.msg-text { flex: 1; line-height: 1.5; }

.msg-close {
  background: transparent;
  border: 0;
  font-size: 22px;
  line-height: 1;
  color: currentColor;
  opacity: 0.55;
  cursor: pointer;
  padding: 0 4px;
  margin-top: -2px;
  border-radius: 4px;
  transition: opacity 0.15s var(--ease), background 0.15s var(--ease), transform 0.1s var(--ease);
  font-family: inherit;
}
.msg-close:hover { opacity: 1; background: rgba(0,0,0,0.05); }
.msg-close:active { transform: scale(0.9); }

.msg.fading-out {
  opacity: 0;
  transform: translateY(-6px);
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin-top: 0;
  margin-bottom: 0;
  border-width: 0;
}

/* ----------------------------------------
   Auth pages (login / invite)
   ---------------------------------------- */
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--white);
  border: 1px solid var(--stone);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  box-shadow: var(--shadow-lg);
  animation: auth-in 0.5s var(--ease-out);
}
.auth-brand {
  text-align: center;
  margin-bottom: 24px;
}
.auth-card h1 {
  font-size: 28px;
  text-align: center;
  margin-bottom: 8px;
}
.auth-card .lede {
  text-align: center;
  color: var(--muted);
  margin-bottom: 28px;
  font-size: 14px;
}

@keyframes auth-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ----------------------------------------
   Loading screen
   ---------------------------------------- */
.loading-screen {
  position: fixed;
  inset: 0;
  background: var(--cream);
  z-index: 9999;
  display: grid;
  place-items: center;
  animation: fade-in 0.3s var(--ease);
}
.loading-screen.fade-out {
  animation: fade-out 0.4s var(--ease) forwards;
}
.loading-inner {
  text-align: center;
  max-width: 360px;
  padding: 0 24px;
}
.loading-brand {
  font-family: 'Fraunces', serif;
  font-size: 30px;
  font-weight: 400;
  font-style: italic;
  color: var(--slate-soft);
  margin-bottom: 40px;
  letter-spacing: -0.01em;
}
.loading-brand em {
  font-style: italic;
  color: var(--slate-soft);
}
.loading-msg {
  font-size: 16px;
  color: var(--slate-soft);
  min-height: 26px;
  transition: opacity 0.3s var(--ease);
}
.loading-dots {
  display: inline-flex;
  gap: 6px;
  margin-top: 28px;
}
.loading-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--slate);
  opacity: 0.3;
  animation: dot-pulse 1.4s var(--ease) infinite;
}
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dot-pulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.85); }
  40% { opacity: 1; transform: scale(1); }
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes fade-out {
  to { opacity: 0; visibility: hidden; }
}

/* ----------------------------------------
   Toast notifications
   ---------------------------------------- */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  background: var(--white);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: var(--shadow-lg);
  border-left: 3px solid;
  min-width: 280px;
  max-width: 380px;
  font-size: 14px;
  pointer-events: auto;
  animation: toast-in 0.3s var(--ease-out);
}
.toast-success { border-color: var(--success); color: var(--success); }
.toast-error   { border-color: var(--danger);  color: var(--danger); }
.toast.fade-out { animation: toast-out 0.3s var(--ease) forwards; }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateX(20px); }
}

/* ----------------------------------------
   Dashboard mock (placeholders Fase 1)
   ---------------------------------------- */
.dashboard-greeting {
  margin-bottom: 32px;
}
.dashboard-greeting h1 {
  margin-bottom: 4px;
}
.dashboard-greeting p {
  margin: 0;
}

.placeholder-card {
  text-align: center;
  padding: 60px 32px;
}
.placeholder-card h3 {
  margin-bottom: 8px;
}

/* ----------------------------------------
   Dashboard widgets (Fase 2)
   ---------------------------------------- */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.metric-card {
  background: var(--white);
  border: 1px solid var(--stone);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.metric-label {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px;
  font-weight: 600;
}
.metric-value {
  font-family: 'Fraunces', serif;
  font-size: 34px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--slate);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.metric-suffix { font-size: 18px; color: var(--slate-soft); margin-left: 2px; }

/* Toggle de vista admin/comercial */
.view-toggle {
  display: inline-flex;
  gap: 4px;
  background: var(--white);
  border: 1px solid var(--stone);
  border-radius: 100px;
  padding: 4px;
  margin-top: 12px;
}
.view-toggle form { display: inline; }
.view-toggle button {
  border: none;
  background: transparent;
  padding: 8px 16px;
  border-radius: 100px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--slate-soft);
  cursor: pointer;
  transition: all 0.15s var(--ease);
}
.view-toggle button:hover { color: var(--slate); }
.view-toggle button:active { transform: scale(0.96); }
.view-toggle button.active {
  background: var(--slate);
  color: var(--cream);
}

/* CTA grande para "Novo pedido" no dashboard */
.cta-card {
  background: linear-gradient(135deg, var(--slate), #15202C);
  color: var(--cream);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}
.cta-card h2 {
  color: var(--cream);
  margin: 0 0 4px;
  font-size: 22px;
}
.cta-card p { color: rgba(247,244,237,0.7); margin: 0; font-size: 14px; }
.cta-card .btn {
  background: var(--cream);
  color: var(--slate);
}
.cta-card .btn:hover { background: var(--white); }

/* ----------------------------------------
   Mobile
   ---------------------------------------- */
@media (max-width: 600px) {
  h1 { font-size: 28px; }
  h2 { font-size: 22px; }
  .card { padding: 24px 20px; }
  .auth-card { padding: 32px 24px; }
  .container { padding: 0 16px; }
}
