/* ==========================================================================
   LEYDE BOLOS — GESTÃO DE ESTOQUE, COMPRAS & MÉTRICAS INTELIGENTES
   Design System: Confeitaria Artesanal & Alta Gastronomia
   ========================================================================== */

:root {
  /* Brand Color Palette */
  --gold-primary: #C59A5A;
  --gold-secondary: #DFBA73;
  --gold-light: #FBF6EE;
  --gold-dark: #9A7235;

  --rose-gold: #B76E79;
  --rose-dark: #8C4752;
  --rose-light: #FDF3F5;
  --rose-soft: #FAF0F2;

  --dark-chocolate: #2C1810;
  --dark-brown: #3F261D;
  --text-dark: #2A2220;
  --text-muted: #7A6964;
  --text-light: #A4938E;

  --bg-app: #F7F3EF;
  --bg-card: #FFFFFF;
  --bg-sidebar: #241611;
  --bg-sidebar-active: #38231C;

  --border-light: #EFE7DE;
  --border-gold: rgba(197, 154, 90, 0.4);
  --border-rose: rgba(183, 110, 121, 0.35);

  /* Status Colors */
  --status-safe: #2E7D32;
  --status-safe-bg: #E8F5E9;
  --status-warning: #E65100;
  --status-warning-bg: #FFF3E0;
  --status-danger: #C62828;
  --status-danger-bg: #FFEBEE;
  --status-info: #0277BD;
  --status-info-bg: #E1F5FE;

  /* Elevation Shadows */
  --shadow-sm: 0 2px 6px rgba(44, 24, 16, 0.04), 0 1px 3px rgba(44, 24, 16, 0.03);
  --shadow-md: 0 8px 24px rgba(44, 24, 16, 0.06), 0 2px 6px rgba(44, 24, 16, 0.04);
  --shadow-lg: 0 16px 36px rgba(44, 24, 16, 0.09), 0 4px 12px rgba(44, 24, 16, 0.05);
  --shadow-gold: 0 10px 25px rgba(197, 154, 90, 0.22);
  --shadow-rose: 0 10px 25px rgba(183, 110, 121, 0.22);

  /* Typography */
  --font-serif: 'Playfair Display', 'Fraunces', serif;
  --font-sans: 'Montserrat', 'Jost', sans-serif;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
}

/* Reset & Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-dark);
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  display: flex;
  overflow-x: hidden;
  position: relative;
  font-size: 15px;
  line-height: 1.5;
}

/* ==========================================================================
   APP LAYOUT (Sidebar + Main Content Area)
   ========================================================================== */
.app-container {
  display: flex;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Sidebar Navigation */
.app-sidebar {
  width: 280px;
  background: linear-gradient(180deg, #241611 0%, #1A0F0C 100%);
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 28px 20px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 100;
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(223, 186, 115, 0.2);
}

.brand-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--gold-secondary);
  object-fit: cover;
  background: #FFFFFF;
}

.brand-text h2 {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: var(--gold-secondary);
  line-height: 1.1;
  font-weight: 700;
}

.brand-text span {
  font-size: 0.75rem;
  color: #D6C7C2;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-weight: 500;
}

/* Nav Links */
.sidebar-menu {
  list-style: none;
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-item-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 13px 18px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: #D6C7C2;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.nav-item-btn i {
  font-size: 1.15rem;
  width: 22px;
  text-align: center;
  color: #A8958E;
  transition: color 0.2s;
}

.nav-item-btn:hover {
  background: rgba(223, 186, 115, 0.08);
  color: #FFFFFF;
}

.nav-item-btn:hover i {
  color: var(--gold-secondary);
}

.nav-item-btn.active {
  background: linear-gradient(135deg, rgba(197, 154, 90, 0.25), rgba(183, 110, 121, 0.2));
  color: #FFFFFF;
  border: 1px solid rgba(223, 186, 115, 0.35);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.nav-item-btn.active i {
  color: var(--gold-secondary);
}

.nav-badge {
  margin-left: auto;
  background: var(--rose-gold);
  color: #FFFFFF;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
}

.nav-badge.danger {
  background: #E63946;
}

/* Sidebar Footer / Quick Tools */
.sidebar-footer {
  border-top: 1px solid rgba(223, 186, 115, 0.2);
  padding-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-link {
  color: #C8B8B2;
  font-size: 0.85rem;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.sidebar-link:hover {
  color: var(--gold-secondary);
  background: rgba(255, 255, 255, 0.05);
}

/* Main Content Area */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  min-width: 0;
}

/* Top Header Bar */
.top-header {
  background: #FFFFFF;
  border-bottom: 1px solid var(--border-light);
  padding: 18px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 10px rgba(44, 24, 16, 0.03);
}

.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--dark-chocolate);
  cursor: pointer;
  padding: 4px;
}

.header-title h1 {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  color: var(--dark-chocolate);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-title p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Main Content View Container */
.content-body {
  padding: 32px;
  max-width: 1360px;
  width: 100%;
  margin: 0 auto;
}

/* View Sections (Tab Contents) */
.view-section {
  display: none;
  animation: fadeIn 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.view-section.active-view {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   BUTTONS & CONTROLS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold-secondary) 0%, var(--gold-primary) 100%);
  color: var(--dark-chocolate);
  box-shadow: 0 4px 12px rgba(197, 154, 90, 0.25);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-gold);
  background: linear-gradient(135deg, #ECC984 0%, #D2A864 100%);
}

.btn-rose {
  background: linear-gradient(135deg, var(--rose-gold) 0%, var(--rose-dark) 100%);
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(183, 110, 121, 0.25);
}

.btn-rose:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-rose);
  background: linear-gradient(135deg, #C57B86 0%, #994F5A 100%);
}

.btn-secondary {
  background: #FFFFFF;
  color: var(--text-dark);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: var(--gold-light);
  border-color: var(--gold-primary);
  transform: translateY(-1px);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.82rem;
  border-radius: var(--radius-sm);
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
}

/* ==========================================================================
   STAT CARDS & METRIC WIDGETS
   ========================================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px 22px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: transform 0.25s, box-shadow 0.25s;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--gold-primary);
}

.stat-card.rose-accent::before {
  background: var(--rose-gold);
}

.stat-card.danger-accent::before {
  background: #E63946;
}

.stat-card.safe-accent::before {
  background: var(--status-safe);
}

.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.stat-label {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
}

.stat-icon-wrap {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  background: var(--gold-light);
  color: var(--gold-dark);
}

.stat-card.rose-accent .stat-icon-wrap {
  background: var(--rose-light);
  color: var(--rose-dark);
}

.stat-value {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 800;
  color: var(--dark-chocolate);
  line-height: 1.1;
  margin-bottom: 8px;
}

.stat-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.trend-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 2px 8px;
  border-radius: 20px;
}

.trend-badge.down {
  background: var(--status-safe-bg);
  color: var(--status-safe);
}

.trend-badge.up {
  background: var(--status-danger-bg);
  color: var(--status-danger);
}

.trend-badge.neutral {
  background: #F0EDE8;
  color: var(--text-muted);
}

/* ==========================================================================
   DASHBOARD CHARTS GRID
   ========================================================================== */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1.2fr;
  gap: 24px;
  margin-bottom: 32px;
}

.chart-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px 26px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.chart-title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--dark-chocolate);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.chart-canvas-wrapper {
  position: relative;
  flex: 1;
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Category Legend List */
.category-legend-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 15px;
}

.legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.88rem;
}

.legend-color-label {
  display: flex;
  align-items: center;
  gap: 10px;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-val {
  font-weight: 700;
  color: var(--dark-chocolate);
}

/* ==========================================================================
   INSIGHTS / REPUTATION BANNER
   ========================================================================== */
.smart-insights-banner {
  background: linear-gradient(135deg, #FFF9F3 0%, #FFF4F6 100%);
  border: 1.5px solid var(--border-gold);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  box-shadow: 0 4px 16px rgba(197, 154, 90, 0.08);
}

.insight-content {
  display: flex;
  align-items: center;
  gap: 16px;
}

.insight-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--gold-secondary), var(--gold-primary));
  color: var(--dark-chocolate);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.insight-text h4 {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  color: var(--dark-chocolate);
  margin-bottom: 2px;
}

.insight-text p {
  font-size: 0.86rem;
  color: #634C45;
}

/* ==========================================================================
   FILTER & SEARCH CONTROLS BAR
   ========================================================================== */
.controls-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 240px;
}

.search-box i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  font-size: 0.95rem;
}

.search-input {
  width: 100%;
  padding: 10px 14px 10px 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: var(--bg-app);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--text-dark);
  transition: all 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: var(--gold-primary);
  background: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(197, 154, 90, 0.15);
}

.filter-categories {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.category-chip {
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid var(--border-light);
  background: #FFFFFF;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.category-chip:hover {
  border-color: var(--gold-primary);
  color: var(--dark-chocolate);
}

.category-chip.active {
  background: var(--dark-chocolate);
  color: #FFFFFF;
  border-color: var(--dark-chocolate);
}

/* ==========================================================================
   PRODUCTS / STOCK GRID
   ========================================================================== */
.stock-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 22px;
}

.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
  position: relative;
}

.product-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-gold);
}

.product-card.stock-low {
  border-left: 4px solid var(--status-warning);
}

.product-card.stock-out {
  border-left: 4px solid var(--status-danger);
  background: #FFFDFC;
}

.product-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.product-category-tag {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 3px 10px;
  border-radius: 12px;
  background: var(--gold-light);
  color: var(--gold-dark);
}

.stock-status-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.status-ok {
  background: var(--status-safe-bg);
  color: var(--status-safe);
}

.status-low {
  background: var(--status-warning-bg);
  color: var(--status-warning);
}

.status-empty {
  background: var(--status-danger-bg);
  color: var(--status-danger);
}

.product-name {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--dark-chocolate);
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 4px;
}

.product-brand {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* Stock Balance & Counter */
.stock-balance-row {
  background: var(--bg-app);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.stock-balance-info {
  display: flex;
  flex-direction: column;
}

.balance-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}

.balance-qty {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--dark-chocolate);
}

.balance-unit {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* Quick Increment / Decrement Counter */
.quick-adjust-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-adjust {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  background: #FFFFFF;
  color: var(--dark-chocolate);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-adjust:hover {
  background: var(--gold-light);
  border-color: var(--gold-primary);
  color: var(--gold-dark);
}

.product-details-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px dashed var(--border-light);
  padding-top: 12px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.product-cost {
  font-weight: 600;
}

.product-actions-btn {
  display: flex;
  gap: 6px;
}

/* ==========================================================================
   DATA TABLES (Compras & Histórico)
   ========================================================================== */
.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.data-table th {
  background: #FAF7F4;
  padding: 14px 18px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-light);
}

.data-table td {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-dark);
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background: #FDFBF8;
}

.table-badge-supplier {
  display: inline-block;
  background: #F4EFEB;
  color: var(--dark-chocolate);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
}

/* ==========================================================================
   SHOPPING LIST VIEW (Lista de Compras Inteligente)
   ========================================================================== */
.shopping-list-header {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 22px 26px;
  margin-bottom: 24px;
  border: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
}

.shopping-items-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.shopping-item-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: all 0.2s;
}

.shopping-item-card.purchased {
  opacity: 0.6;
  background: #F9F9F9;
  text-decoration: line-through;
}

.shopping-checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: 14px;
}

.shopping-check-input {
  width: 22px;
  height: 22px;
  accent-color: var(--gold-primary);
  cursor: pointer;
}

.shopping-item-name {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--dark-chocolate);
}

.shopping-suggested-qty {
  font-weight: 700;
  color: var(--rose-dark);
  background: var(--rose-light);
  padding: 4px 12px;
  border-radius: 14px;
  font-size: 0.85rem;
}

/* ==========================================================================
   MODALS & DIALOGS
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(44, 24, 16, 0.65);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
  animation: modalFadeIn 0.25s ease;
}

.modal-overlay.active {
  display: flex;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-dialog {
  background: #FFFFFF;
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 540px;
  box-shadow: 0 25px 60px rgba(44, 24, 16, 0.25);
  border: 1px solid var(--border-gold);
  overflow: hidden;
  animation: modalSlideUp 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes modalSlideUp {
  from { transform: translateY(20px) scale(0.97); }
  to { transform: translateY(0) scale(1); }
}

.modal-header {
  padding: 22px 28px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #FFFDFB;
}

.modal-header h3 {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: var(--dark-chocolate);
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.3rem;
  color: var(--text-light);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  transition: color 0.2s;
}

.modal-close-btn:hover {
  color: var(--dark-chocolate);
}

.modal-body {
  padding: 26px 28px;
  max-height: 75vh;
  overflow-y: auto;
}

.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--dark-chocolate);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: var(--bg-app);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--text-dark);
  transition: all 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--gold-primary);
  background: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(197, 154, 90, 0.15);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.modal-footer {
  padding: 18px 28px;
  background: #FAF7F4;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* ==========================================================================
   FLOATING ACTION BUTTON (Mobile FAB)
   ========================================================================== */
.fab-btn {
  position: fixed;
  bottom: 25px;
  right: 25px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-secondary) 0%, var(--gold-primary) 100%);
  color: var(--dark-chocolate);
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 10px 25px rgba(197, 154, 90, 0.4);
  border: none;
  cursor: pointer;
  z-index: 99;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.fab-btn:hover {
  transform: scale(1.08) rotate(90deg);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast-message {
  background: var(--dark-chocolate);
  color: #FFFFFF;
  padding: 12px 22px;
  border-radius: 30px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--gold-secondary);
  animation: toastPop 0.3s ease;
}

@keyframes toastPop {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   MOBILE SCAN BANNER
   ========================================================================== */
.mobile-scan-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, #FFF6F7 0%, #FFF9F2 100%);
  border: 1.5px solid var(--border-gold);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  margin-bottom: 22px;
  box-shadow: 0 4px 16px rgba(183, 110, 121, 0.12);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.mobile-scan-banner:active {
  transform: scale(0.98);
}

.scan-banner-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--rose-gold), var(--rose-dark));
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(183, 110, 121, 0.35);
}

.scan-banner-text {
  flex: 1;
}

.scan-banner-text strong {
  display: block;
  font-size: 0.95rem;
  color: var(--dark-chocolate);
  margin-bottom: 2px;
}

.scan-banner-text span {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.25;
}

.scan-banner-arrow {
  color: var(--rose-gold);
  font-size: 1rem;
}

/* ==========================================================================
   RESPONSIVE DESIGN (Tablets & Mobile)
   ========================================================================== */
.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
  z-index: 998;
}

.sidebar-backdrop.active {
  display: block;
}

canvas {
  max-width: 100% !important;
  height: auto !important;
}

.table-container {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 992px) {
  .app-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    z-index: 1000;
    box-shadow: 6px 0 30px rgba(0, 0, 0, 0.35);
  }

  .app-sidebar.sidebar-open {
    transform: translateX(0) !important;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(44, 24, 16, 0.6);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }

  .sidebar-backdrop.active {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: rgba(197, 154, 90, 0.1);
    border: 1px solid var(--border-gold);
    color: var(--dark-chocolate);
    font-size: 1.25rem;
    cursor: pointer;
  }

  .charts-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .top-header {
    padding: 10px 14px;
    width: 100%;
    max-width: 100%;
  }

  .content-body {
    padding: 14px 10px;
    width: 100%;
    max-width: 100%;
  }

  .fab-btn {
    display: flex;
  }
}

@media (max-width: 600px) {
  .top-header {
    padding: 8px 10px;
    gap: 6px;
    justify-content: space-between;
    width: 100%;
    max-width: 100%;
  }

  .header-title h1 {
    font-size: 0.98rem;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .header-title p {
    display: none !important;
  }

  .header-actions {
    gap: 5px;
  }

  .btn-header-scan, .btn-header-action {
    padding: 7px 10px;
    font-size: 0.82rem;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    width: 100%;
  }

  .controls-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    width: 100%;
    padding: 12px;
  }

  .search-box {
    width: 100%;
    min-width: 0;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .smart-insights-banner {
    flex-direction: column;
    align-items: flex-start;
    padding: 14px;
    gap: 10px;
    width: 100%;
  }

  .stat-card {
    padding: 16px 14px;
    width: 100%;
  }

  .stat-value {
    font-size: 1.55rem;
  }

  .chart-card {
    padding: 16px 14px;
    width: 100%;
  }

  .stock-grid {
    grid-template-columns: 1fr;
    gap: 14px;
    width: 100%;
  }

  .product-card {
    width: 100%;
  }

  .modal-dialog {
    max-height: 94vh;
    border-radius: var(--radius-lg);
    width: 95%;
    margin: 0 auto;
  }

  .modal-body {
    padding: 14px 12px;
  }
}

/* ==========================================================================
   GOOGLE AUTHENTICATION & LOGIN OVERLAY
   ========================================================================== */
html.not-authenticated .app-container {
  display: none !important;
}

html.not-authenticated .auth-overlay {
  display: flex !important;
}

.auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 50% 30%, #3A221A 0%, #1A0D09 100%);
  backdrop-filter: blur(10px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: modalFadeIn 0.25s ease;
}

.auth-card {
  background: #FFFFFF;
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 440px;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.45);
  border: 2px solid var(--gold-secondary);
  overflow: hidden;
  text-align: center;
  position: relative;
  animation: modalSlideUp 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.auth-card-header {
  background: linear-gradient(180deg, #FFFDF9 0%, #FAF5EE 100%);
  padding: 35px 25px 22px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.auth-logo {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 3.5px solid var(--gold-primary);
  box-shadow: 0 10px 25px rgba(183, 110, 121, 0.25);
  margin-bottom: 14px;
  background: #FFFFFF;
}

.auth-card-header h2 {
  font-family: var(--font-serif);
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--dark-chocolate);
  line-height: 1.1;
  margin-bottom: 4px;
}

.auth-card-header p {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.auth-badge-secure {
  margin-top: 12px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--status-safe);
  background: var(--status-safe-bg);
  padding: 4px 14px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(46, 125, 50, 0.2);
}

.auth-card-body {
  padding: 26px 28px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.google-btn-center {
  display: flex;
  justify-content: center;
  margin: 5px 0 18px;
  width: 100%;
}

.btn-google-login {
  width: 100%;
  max-width: 320px;
  background: #FFFFFF;
  color: #3C4043;
  border: 1.5px solid #DADCE0;
  border-radius: 28px;
  padding: 12px 20px;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(60, 64, 67, 0.08);
  transition: all 0.25s ease;
}

.btn-google-login:hover {
  background: #F8FAFD;
  border-color: #D2E3FC;
  box-shadow: 0 4px 12px rgba(66, 133, 244, 0.18);
  transform: translateY(-1px);
}

.btn-google-login:active {
  background: #F1F3F4;
  transform: translateY(0);
}

.auth-error-alert {
  background: var(--status-danger-bg);
  color: var(--status-danger);
  border: 1px solid rgba(198, 40, 40, 0.3);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.84rem;
  text-align: left;
  margin-bottom: 14px;
  width: 100%;
  line-height: 1.4;
}

.auth-card-footer {
  padding: 14px 20px;
  background: #FAF7F4;
  border-top: 1px solid var(--border-light);
}

.auth-back-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 600;
  transition: color 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.auth-back-link:hover {
  color: var(--dark-chocolate);
}

