/* ============================================================
   Garrafão System — Estilos Globais
   ============================================================ */

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

:root {
  --blue-dark:   #1e3a5f;
  --blue-mid:    #2563eb;
  --blue-light:  #3b82f6;
  --green-dark:  #166534;
  --green-mid:   #16a34a;
  --green-light: #22c55e;
  --amber:       #d97706;
  --amber-light: #fbbf24;
  --red:         #dc2626;
  --red-light:   #f87171;
  --purple:      #7c3aed;
  --teal:        #0d9488;
  --gray-50:     #f8fafc;
  --gray-100:    #f1f5f9;
  --gray-200:    #e2e8f0;
  --gray-300:    #cbd5e1;
  --gray-500:    #64748b;
  --gray-700:    #334155;
  --gray-900:    #0f172a;
  --header-bg:   #1a2e4a;
  --font-main:   'Inter', sans-serif;
  --font-title:  'Poppins', sans-serif;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:   0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg:   0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
  --radius:      .75rem;
  --radius-sm:   .5rem;
  --radius-lg:   1rem;
  --radius-xl:   1.5rem;
}

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

body {
  font-family: var(--font-main);
  background: var(--gray-50);
  color: var(--gray-900);
  margin: 0;
  min-height: 100vh;
}

h1, h2, h3, h4, h5 { font-family: var(--font-title); }

/* ── Utilities ── */
.font-poppins { font-family: var(--font-title) !important; }
.text-blue     { color: var(--blue-mid) !important; }
.text-green    { color: var(--green-mid) !important; }
.text-amber    { color: var(--amber) !important; }
.text-red      { color: var(--red) !important; }
.bg-blue       { background: var(--blue-mid) !important; }
.bg-green      { background: var(--green-mid) !important; }
.bg-amber      { background: var(--amber) !important; }
.bg-red        { background: var(--red) !important; }

/* ── Toast ── */
#toast-container {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .875rem 1.25rem;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--blue-mid);
  min-width: 280px;
  max-width: 380px;
  pointer-events: all;
  animation: slideIn .25s ease;
  font-size: .9rem;
  font-weight: 500;
}
.toast.success { border-color: var(--green-mid); }
.toast.error   { border-color: var(--red); }
.toast.warning { border-color: var(--amber); }
.toast i { font-size: 1.1rem; }
.toast.success i { color: var(--green-mid); }
.toast.error   i { color: var(--red); }
.toast.warning i { color: var(--amber); }
.toast.info    i { color: var(--blue-mid); }
@keyframes slideIn {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; transform: translateX(120%); }
}

/* ── Header ── */
.app-header {
  background: var(--header-bg);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.app-header .brand {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.app-header .brand-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: .75rem;
  background: #2563eb;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.1rem;
}
.app-header .brand-name {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.1rem;
  color: #fff;
  margin: 0;
}
.app-header .brand-sub {
  font-size: .75rem;
  color: rgba(255,255,255,.6);
  margin: 0;
}
.app-header .header-actions {
  display: flex;
  align-items: center;
  gap: .75rem;
}

/* ── Tabs ── */
.nav-tabs-custom {
  border-bottom: 2px solid var(--gray-200);
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
  margin-bottom: 1.5rem;
}
.nav-tabs-custom .nav-link {
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--gray-500);
  font-weight: 500;
  padding: .75rem 1rem;
  margin-bottom: -2px;
  transition: all .2s;
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .9rem;
  background: none;
  cursor: pointer;
}
.nav-tabs-custom .nav-link:hover {
  color: var(--gray-700);
  border-bottom-color: var(--gray-300);
}
.nav-tabs-custom .nav-link.active {
  color: var(--blue-mid);
  border-bottom-color: var(--blue-mid);
}

/* ── Cards ── */
.card-custom {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  overflow: hidden;
}
.card-custom .card-header-custom {
  padding: 1.25rem 1.5rem .75rem;
  border-bottom: 1px solid var(--gray-100);
}
.card-custom .card-body-custom {
  padding: 1.25rem 1.5rem;
}

/* ── KPI Cards ── */
.kpi-card {
  border-radius: var(--radius);
  padding: 1.5rem;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.kpi-card .kpi-value {
  font-family: var(--font-title);
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1;
  margin: .5rem 0 .25rem;
}
.kpi-card .kpi-label { font-size: .85rem; opacity: .85; margin: 0; }
.kpi-card .kpi-unit  { font-size: .8rem; opacity: .65; margin: 0; }
.kpi-card .kpi-icon  {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 3rem;
  opacity: .15;
}

/* ── Status Badges ── */
.badge-preparing { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.badge-ready     { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.badge-paid      { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.badge-cancelled { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* ── Order Cards ── */
.order-card {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  padding: 1rem 1.25rem;
  transition: box-shadow .2s;
}
.order-card:hover { box-shadow: var(--shadow-md); }

/* ── Client Cards ── */
.client-card {
  background: #fff;
  border-radius: var(--radius);
  border: 2px solid var(--gray-200);
  padding: 1rem 1.25rem;
  cursor: pointer;
  transition: all .2s;
  text-align: left;
  width: 100%;
  display: block;
}
.client-card:hover {
  border-color: var(--blue-light);
  background: #eff6ff;
  box-shadow: var(--shadow-sm);
}
.client-card.selected {
  border-color: var(--blue-mid);
  background: #dbeafe;
}

/* ── Forms ── */
.form-control-custom {
  width: 100%;
  padding: .625rem .875rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  color: var(--gray-900);
  background: #fff;
  transition: border-color .2s, box-shadow .2s;
  font-family: var(--font-main);
}
.form-control-custom:focus {
  outline: none;
  border-color: var(--blue-mid);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
.form-label-custom {
  display: block;
  font-size: .85rem;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: .375rem;
}

/* ── Buttons ── */
.btn-primary-custom {
  background: var(--blue-mid);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: .625rem 1.25rem;
  font-weight: 600;
  font-size: .9rem;
  cursor: pointer;
  transition: background .2s, transform .1s;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-family: var(--font-main);
}
.btn-primary-custom:hover  { background: #1d4ed8; }
.btn-primary-custom:active { transform: scale(.98); }
.btn-primary-custom:disabled { opacity: .6; cursor: not-allowed; }

.btn-success-custom {
  background: var(--green-mid);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: .625rem 1.25rem;
  font-weight: 600;
  font-size: .9rem;
  cursor: pointer;
  transition: background .2s;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-family: var(--font-main);
}
.btn-success-custom:hover { background: #15803d; }

.btn-outline-custom {
  background: transparent;
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  padding: .625rem 1.25rem;
  font-weight: 500;
  font-size: .9rem;
  cursor: pointer;
  transition: all .2s;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-family: var(--font-main);
}
.btn-outline-custom:hover {
  background: var(--gray-100);
  border-color: var(--gray-400);
}

.btn-ghost-custom {
  background: transparent;
  color: rgba(255,255,255,.7);
  border: none;
  border-radius: var(--radius-sm);
  padding: .5rem .875rem;
  font-weight: 500;
  font-size: .875rem;
  cursor: pointer;
  transition: all .2s;
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  font-family: var(--font-main);
}
.btn-ghost-custom:hover {
  background: rgba(255,255,255,.1);
  color: #fff;
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--gray-500);
}
.empty-state i {
  font-size: 3rem;
  opacity: .3;
  display: block;
  margin-bottom: 1rem;
}
.empty-state p { margin: 0; font-size: .95rem; }

/* ── Spinner ── */
.spinner-custom {
  width: 1.5rem;
  height: 1.5rem;
  border: 3px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ── Page transitions ── */
.page {
  display: none !important;
  position: relative;
}
.page.active {
  display: block !important;
}

/* Login page precisa de flex para centralizar */
#page-login.active {
  display: flex !important;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
}

/* ── Modal ── */
.modal-custom .modal-content {
  border-radius: var(--radius-lg);
  border: none;
  box-shadow: var(--shadow-lg);
}
.modal-custom .modal-header {
  border-bottom: 1px solid var(--gray-100);
  padding: 1.25rem 1.5rem;
}
.modal-custom .modal-body { padding: 1.5rem; }
.modal-custom .modal-footer {
  border-top: 1px solid var(--gray-100);
  padding: 1rem 1.5rem;
}

/* ── Priority badges ── */
.priority-low      { background: #d1fae5; color: #065f46; }
.priority-medium   { background: #fef3c7; color: #92400e; }
.priority-high     { background: #fee2e2; color: #991b1b; }
.priority-critical { background: #dc2626; color: #fff; }

/* ── Responsive ── */
@media (max-width: 576px) {
  .app-header { padding: .75rem 1rem; }
  .kpi-card .kpi-value { font-size: 1.75rem; }
}
