/* ==========================================================
   DEBBY BABY — Layout (sidebar, topbar, login, página)
   ========================================================== */

/* ============ Tela de Login ============ */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
}

.auth-decoration {
  flex: 1;
  background:
    radial-gradient(at 30% 20%, rgba(216, 183, 167, 0.45) 0px, transparent 50%),
    radial-gradient(at 80% 80%, rgba(168, 176, 141, 0.30) 0px, transparent 50%),
    linear-gradient(135deg, var(--color-creme), var(--color-rose-light));
  display: flex; align-items: center; justify-content: center;
  position: relative;
  overflow: hidden;
}
.auth-decoration::before,
.auth-decoration::after {
  content: ""; position: absolute;
  border-radius: 50%; filter: blur(60px);
}
.auth-decoration::before {
  width: 280px; height: 280px;
  background: rgba(216, 183, 167, 0.4);
  top: -60px; left: -40px;
}
.auth-decoration::after {
  width: 320px; height: 320px;
  background: rgba(168, 176, 141, 0.3);
  bottom: -80px; right: -60px;
}

.auth-brand {
  text-align: center;
  position: relative; z-index: 2;
  padding: var(--space-8);
  max-width: 480px;
}
.auth-brand img { max-width: 280px; margin: 0 auto var(--space-4); }
.auth-brand h2 {
  font-family: var(--font-script);
  font-size: var(--fs-2xl);
  color: var(--color-cappuccino-dark);
  font-weight: var(--fw-medium);
  margin-bottom: var(--space-2);
}
.auth-brand p {
  font-size: var(--fs-sm);
  color: var(--text-soft);
  letter-spacing: 0.04em;
}

.auth-form-wrap {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-8) var(--space-6);
  background: var(--bg);
}
.auth-form {
  width: 100%;
  max-width: 400px;
}
.auth-form h1 {
  font-size: var(--fs-2xl);
  margin-bottom: var(--space-1);
}
.auth-form .subtitle {
  color: var(--text-soft);
  margin-bottom: var(--space-8);
  font-size: var(--fs-sm);
}

.auth-tabs {
  display: flex;
  margin-bottom: var(--space-6);
  border-bottom: 1px solid var(--border);
}
.auth-tab {
  flex: 1;
  padding: var(--space-3);
  text-align: center;
  font-weight: var(--fw-semibold);
  font-size: var(--fs-sm);
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  transition: all var(--t-fast);
}
.auth-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.auth-footer {
  margin-top: var(--space-5);
  text-align: center;
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

@media (max-width: 860px) {
  .auth-page { flex-direction: column; }
  .auth-decoration { min-height: 240px; padding: var(--space-6); }
  .auth-brand img { max-width: 180px; }
}

/* ============ Aplicação principal ============ */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border-soft);
  padding: var(--space-5) 0;
  display: flex; flex-direction: column;
  position: sticky; top: 0;
  height: 100vh;
}
.sidebar-brand {
  text-align: center;
  padding: 0 var(--space-5) var(--space-5);
  border-bottom: 1px dashed var(--border);
}
.sidebar-brand img { max-width: 130px; margin: 0 auto; }
.sidebar-brand .tagline {
  font-family: var(--font-script);
  color: var(--accent);
  font-size: var(--fs-base);
  margin-top: var(--space-1);
}

.sidebar-nav {
  flex: 1;
  display: flex; flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-4) var(--space-3);
  overflow-y: auto;
}
.nav-item {
  display: flex; align-items: center; gap: var(--space-3);
  padding: 0.75rem var(--space-3);
  border-radius: var(--radius-md);
  color: var(--text-soft);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  transition: all var(--t-fast);
  cursor: pointer;
}
.nav-item:hover {
  background: var(--surface-2);
  color: var(--primary);
}
.nav-item.active {
  background: linear-gradient(90deg, rgba(216,183,167,0.25), transparent);
  color: var(--primary);
  position: relative;
}
.nav-item.active::before {
  content: ""; position: absolute; left: -12px;
  top: 50%; transform: translateY(-50%);
  width: 4px; height: 24px;
  background: var(--accent);
  border-radius: 0 4px 4px 0;
}
.nav-item .icon { width: 20px; height: 20px; flex-shrink: 0; }

.sidebar-footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border-soft);
}
.user-chip {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-2);
  border-radius: var(--radius-md);
}
.user-chip .avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: var(--fw-bold); font-size: var(--fs-sm);
}
.user-chip .info { flex: 1; min-width: 0; }
.user-chip .name {
  font-size: var(--fs-xs); font-weight: var(--fw-semibold);
  color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-chip .email {
  font-size: 0.6875rem; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Main area */
.main-area {
  display: flex; flex-direction: column;
  min-width: 0;
}

.topbar {
  height: var(--topbar-h);
  background: rgba(255, 249, 244, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-soft);
  padding: 0 var(--space-6);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 10;
  gap: var(--space-4);
}
.topbar-title h1 {
  font-size: var(--fs-xl); margin: 0;
  font-family: var(--font-display); font-weight: var(--fw-medium);
}
.topbar-title .sub {
  font-size: var(--fs-xs); color: var(--text-muted);
  font-family: var(--font-body);
  margin-top: 2px;
}
.topbar-actions { display: flex; align-items: center; gap: var(--space-3); }

.menu-toggle {
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  display: none;
  align-items: center; justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
}

.content {
  flex: 1;
  padding: var(--space-6);
  max-width: var(--container);
  width: 100%;
  margin: 0 auto;
}

.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
  gap: var(--space-3);
}
.section-header h2 { margin: 0; }

/* Responsive */
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0;
    z-index: var(--z-overlay);
    transform: translateX(-100%);
    transition: transform var(--t-base);
    width: var(--sidebar-w);
    box-shadow: var(--shadow-xl);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: inline-flex; }
  .sidebar-backdrop {
    position: fixed; inset: 0;
    background: rgba(74, 59, 51, 0.4);
    z-index: calc(var(--z-overlay) - 1);
    backdrop-filter: blur(2px);
  }
}

@media (max-width: 600px) {
  .content { padding: var(--space-3); }
  .topbar { padding: 0 var(--space-3); height: 56px; }
  .topbar-title h1 { font-size: var(--fs-base); }
  .topbar-title .sub { display: none; }
  .topbar-actions { gap: var(--space-2); }
  .topbar-actions .btn-text { display: none; }   /* só ícones em mobile */
  .data-table { font-size: var(--fs-xs); }
  .data-table th, .data-table td { padding: var(--space-2) var(--space-3); }
  .hide-mobile { display: none !important; }
  .section-header { margin-bottom: var(--space-4); }
  .section-header h2 { font-size: var(--fs-xl); }
  /* Botões do header empilham se necessário */
  .section-header .btn-group { width: 100%; }
  .section-header .btn-group .btn { flex: 1; }
}

@media (max-width: 480px) {
  .content { padding: var(--space-2); }
  .topbar { padding: 0 var(--space-2); }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: var(--space-2); }
  .kpi-card { padding: var(--space-3); }
  .kpi-value { font-size: var(--fs-xl); }
  .kpi-label { font-size: 0.65rem; }
  .btn { padding: 0.6rem 1rem; }
  .btn-sm { padding: 0.4rem 0.7rem; }
}

/* Página de visualização do pedido (para PDF) */
.order-print {
  max-width: 800px;
  margin: 0 auto;
  background: white;
  padding: var(--space-8);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}
.order-print-header {
  text-align: center;
  padding-bottom: var(--space-5);
  border-bottom: 2px solid var(--color-rose-light);
  margin-bottom: var(--space-6);
}
.order-print-header img { max-width: 200px; margin: 0 auto var(--space-2); }
.order-print-header .doc-title {
  font-family: var(--font-display);
  font-size: var(--fs-2xl);
  color: var(--primary);
  letter-spacing: 0.1em;
  margin-top: var(--space-2);
}
.order-print-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
  font-size: var(--fs-sm);
}
.meta-block label {
  display: block;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 2px;
}
.meta-block .value { color: var(--text); font-weight: var(--fw-semibold); }

/* ============ Tela de boot (loading inicial) ============ */
.app-booting {
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: var(--space-4);
  background:
    radial-gradient(at 30% 20%, rgba(216, 183, 167, 0.20) 0px, transparent 50%),
    radial-gradient(at 80% 80%, rgba(168, 176, 141, 0.15) 0px, transparent 50%),
    var(--bg);
  animation: fadeIn .35s ease-out both;
}
.app-booting img {
  max-width: 200px;
  filter: drop-shadow(0 4px 14px rgba(139, 107, 90, 0.18));
  animation: pulse 2s ease-in-out infinite;
}
.app-booting p {
  font-family: var(--font-display);
  color: var(--text-soft);
  font-size: var(--fs-lg);
  letter-spacing: 0.02em;
}
@keyframes pulse {
  0%,100% { transform: scale(1); opacity: 1; }
  50%     { transform: scale(1.03); opacity: 0.85; }
}
@keyframes fadeIn {
  from { opacity: 0; } to { opacity: 1; }
}
