/* ============================
   AÇAIZINHO — Sistema de Gestão
   Cores da logo: pink #E8057C, amarelo #FFD700, verde-água #00BFA5
   ============================ */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&family=Baloo+2:wght@700;800&display=swap');

:root {
  --pink:       #E8057C;
  --pink-dark:  #C0046A;
  --pink-light: #FF4DAD;
  --pink-bg:    #FFF0F8;
  --yellow:     #FFD200;
  --yellow-dark:#E6B800;
  --teal:       #00BFA5;
  --teal-dark:  #009688;
  --purple:     #6B21A8;
  --white:      #FFFFFF;
  --gray-50:    #F9FAFB;
  --gray-100:   #F3F4F6;
  --gray-200:   #E5E7EB;
  --gray-400:   #9CA3AF;
  --gray-600:   #4B5563;
  --gray-800:   #1F2937;
  --sidebar-w:  240px;
  --radius:     12px;
  --shadow:     0 2px 12px rgba(0,0,0,0.08);
  --shadow-md:  0 4px 20px rgba(0,0,0,0.12);
}

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

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: 'Nunito', sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  min-height: 100vh;
}

/* ======= SIDEBAR ======= */
.sidebar {
  position: fixed; top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--pink);
  display: flex; flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 24px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.15);
}

.sidebar-logo h1 {
  font-family: 'Baloo 2', cursive;
  font-size: 1.6rem;
  color: var(--yellow);
  line-height: 1;
  letter-spacing: -0.5px;
}
.sidebar-logo span {
  font-family: 'Nunito', sans-serif;
  font-size: 0.7rem;
  color: rgba(255,255,255,0.85);
  display: block;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 2px;
}

.sidebar-nav { padding: 16px 12px; flex: 1; }

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
  padding: 12px 8px 6px;
}

.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: rgba(255,255,255,0.88);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.18s ease;
  margin-bottom: 2px;
}
.nav-link:hover,
.nav-link.active {
  background: rgba(255,255,255,0.18);
  color: #fff;
}
.nav-link.active { background: rgba(255,255,255,0.25); }
.nav-link .icon { font-size: 1.1rem; width: 22px; text-align: center; }

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,0.15);
}
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255,255,255,0.12);
}
.user-chip .avatar {
  width: 32px; height: 32px;
  background: var(--yellow);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 0.85rem;
  color: var(--pink-dark);
}
.user-chip .info { flex: 1; min-width: 0; }
.user-chip .info strong {
  display: block; font-size: 0.82rem;
  color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-chip .info small { font-size: 0.7rem; color: rgba(255,255,255,0.6); }

/* ======= MAIN LAYOUT ======= */
.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex; flex-direction: column;
}

.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 0 28px;
  height: 60px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}
.topbar-left  { display: flex; align-items: center; gap: 12px; }
.topbar-title { font-size: 1.05rem; font-weight: 800; color: var(--gray-800); }
.topbar-right { display: flex; align-items: center; gap: 12px; }

/* Hamburguer — visível só no mobile */
.hamburger-btn {
  display: none;
  flex-direction: column; justify-content: center; gap: 5px;
  width: 36px; height: 36px;
  background: none; border: none; cursor: pointer;
  padding: 4px; border-radius: 8px;
  transition: background 0.15s;
}
.hamburger-btn:hover { background: var(--gray-100); }
.hamburger-btn span {
  display: block; width: 20px; height: 2px;
  background: var(--gray-800); border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}

/* Overlay mobile */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 99;
}
.sidebar-overlay.active { display: block; }

.content { padding: 28px; flex: 1; }

/* ======= RESPONSIVO MOBILE ======= */
@media (max-width: 768px) {
  /* Sidebar some por padrão e vira overlay */
  .sidebar {
    transform: translateX(-100%);
    z-index: 100;
    box-shadow: none;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.25);
  }
  /* Remove o comportamento de colapso desktop na sidebar ao recolher */
  .sidebar.hidden {
    transform: translateX(-100%);
  }

  .main { margin-left: 0; }

  .topbar { padding: 0 16px; }
  .hamburger-btn { display: flex; }

  .content { padding: 16px; }

  /* Oculta botão de recolher sidebar (desktop-only) */
  .sidebar-collapse-btn { display: none; }
  .sidebar-show-btn     { display: none; }
}

@media (max-width: 500px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card  { padding: 14px 12px; gap: 10px; }
  .stat-info .value { font-size: 1.2rem; }
}

/* ======= CARDS ======= */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.card-title {
  font-size: 0.95rem; font-weight: 800;
  color: var(--gray-800);
}
.card-body { padding: 20px 22px; }

/* ======= STAT CARDS ======= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 16px;
  border-left: 4px solid var(--pink);
  transition: transform 0.18s, box-shadow 0.18s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card.yellow { border-left-color: var(--yellow); }
.stat-card.teal   { border-left-color: var(--teal); }
.stat-card.purple { border-left-color: var(--purple); }

.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  background: var(--pink-bg);
  flex-shrink: 0;
}
.stat-card.yellow .stat-icon { background: #FFFBEB; }
.stat-card.teal   .stat-icon { background: #F0FDFA; }
.stat-card.purple .stat-icon { background: #F5F3FF; }

.stat-info .value {
  font-size: 1.55rem; font-weight: 900;
  color: var(--gray-800); line-height: 1;
}
.stat-info .label {
  font-size: 0.75rem; font-weight: 600;
  color: var(--gray-400); margin-top: 3px;
  text-transform: uppercase; letter-spacing: 0.5px;
}

/* ======= BUTTONS ======= */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.875rem; font-weight: 700;
  cursor: pointer; border: none;
  text-decoration: none; transition: all 0.18s;
  white-space: nowrap;
}
.btn-primary {
  background: var(--pink); color: #fff;
}
.btn-primary:hover { background: var(--pink-dark); }
.btn-yellow {
  background: var(--yellow); color: var(--gray-800);
}
.btn-yellow:hover { background: var(--yellow-dark); }
.btn-teal {
  background: var(--teal); color: #fff;
}
.btn-teal:hover { background: var(--teal-dark); }
.btn-outline {
  background: transparent; color: var(--pink);
  border: 2px solid var(--pink);
}
.btn-outline:hover { background: var(--pink); color: #fff; }
.btn-ghost {
  background: var(--gray-100); color: var(--gray-600);
}
.btn-ghost:hover { background: var(--gray-200); }
.btn-danger {
  background: #EF4444; color: #fff;
}
.btn-danger:hover { background: #DC2626; }
.btn-sm { padding: 5px 11px; font-size: 0.8rem; }
.btn-xs { padding: 3px 8px; font-size: 0.75rem; border-radius: 6px; }

/* ======= FORMS ======= */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block; font-size: 0.82rem; font-weight: 700;
  color: var(--gray-600); margin-bottom: 5px;
  text-transform: uppercase; letter-spacing: 0.4px;
}
.form-control {
  width: 100%; padding: 9px 13px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.9rem; color: var(--gray-800);
  transition: border-color 0.18s, box-shadow 0.18s;
  background: var(--white);
}
.form-control:focus {
  outline: none;
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(232,5,124,0.12);
}
.form-control::placeholder { color: var(--gray-400); }
select.form-control { cursor: pointer; }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

/* ======= TABLES ======= */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 11px 16px;
  font-size: 0.72rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--gray-400);
  border-bottom: 2px solid var(--gray-100);
  text-align: left;
}
tbody td {
  padding: 12px 16px;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--gray-50); }

/* ======= BADGES / STATUS ======= */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 20px;
  font-size: 0.72rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.badge-pendente   { background: #FEF9C3; color: #854D0E; }
.badge-confirmado { background: #DBEAFE; color: #1E40AF; }
.badge-em_entrega { background: #FEF3C7; color: #92400E; }
.badge-entregue   { background: #DCFCE7; color: #166534; }
.badge-cancelado  { background: #FEE2E2; color: #991B1B; }
.badge-admin { background: #FDF4FF; color: #7E22CE; }
.badge-operador { background: #F0F9FF; color: #075985; }
.badge-ativo { background: #DCFCE7; color: #166534; }
.badge-inativo { background: #F3F4F6; color: #9CA3AF; }

/* ======= ALERTS ======= */
.alert {
  padding: 12px 16px; border-radius: 8px;
  font-size: 0.88rem; font-weight: 600;
  margin-bottom: 16px;
}
.alert-success { background: #DCFCE7; color: #166534; border-left: 4px solid #22C55E; }
.alert-danger   { background: #FEE2E2; color: #991B1B; border-left: 4px solid #EF4444; }
.alert-warning  { background: #FEF3C7; color: #92400E; border-left: 4px solid #F59E0B; }

/* ======= SEARCH BAR ======= */
.search-bar {
  display: flex; align-items: center; gap: 8px;
  background: var(--gray-100);
  border-radius: 8px; padding: 7px 13px;
  flex: 1; max-width: 320px;
}
.search-bar input {
  border: none; background: transparent;
  font-family: 'Nunito', sans-serif;
  font-size: 0.88rem; color: var(--gray-800);
  width: 100%;
}
.search-bar input:focus { outline: none; }
.search-bar .icon { color: var(--gray-400); font-size: 0.95rem; }

/* ======= EMPTY STATE ======= */
.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--gray-400);
}
.empty-state .emoji { font-size: 3rem; margin-bottom: 12px; }
.empty-state p { font-weight: 600; }

/* ======= PAGINATION / FILTERS ======= */
.filters-bar {
  display: flex; flex-wrap: wrap; gap: 10px;
  align-items: center; margin-bottom: 20px;
}

/* ======= LOGIN PAGE ======= */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--pink) 0%, #9B027A 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.login-box {
  background: var(--white);
  border-radius: 20px;
  padding: 44px 40px;
  width: 100%; max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.login-logo {
  text-align: center; margin-bottom: 28px;
}
.login-logo h1 {
  font-family: 'Baloo 2', cursive;
  font-size: 2.4rem; font-weight: 800;
  color: var(--pink);
  line-height: 1;
}
.login-logo p {
  font-size: 0.8rem; color: var(--gray-400);
  font-weight: 600; letter-spacing: 1px;
  text-transform: uppercase; margin-top: 4px;
}

/* ======= PAGE HEADER ======= */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.page-header h2 {
  font-size: 1.3rem; font-weight: 900; color: var(--gray-800);
}
.page-header small {
  display: block; font-size: 0.78rem;
  color: var(--gray-400); font-weight: 600;
  margin-top: 2px;
}

/* ======= PEDIDO ITENS ======= */
.item-row {
  display: grid;
  grid-template-columns: 1fr 120px 120px 90px 36px;
  gap: 10px; align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
}
.item-row:last-child { border-bottom: none; }

@media (max-width: 640px) {
  .item-row {
    grid-template-columns: 1fr 80px 80px 70px 32px;
    gap: 6px;
    font-size: 0.82rem;
  }
}

/* ======= CHART CONTAINER ======= */
.chart-box {
  position: relative;
  height: 220px;
}

/* ======= GRID HELPERS ======= */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; }

@media (max-width: 900px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ======= MISC ======= */
.text-pink   { color: var(--pink); }
.text-teal   { color: var(--teal); }
.text-yellow { color: var(--yellow-dark); }
.fw-bold { font-weight: 800; }
.mt-1  { margin-top: 8px; }
.mt-2  { margin-top: 16px; }
.mt-3  { margin-top: 24px; }
.mb-1  { margin-bottom: 8px; }
.mb-2  { margin-bottom: 16px; }
.gap-2 { gap: 16px; }
.flex  { display: flex; }
.flex-center { display: flex; align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }

/* scrollbar thin */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 999px; }
