/* ===== VMD SRLS - Gestionale B2B Styles ===== */
/* Optimized for Tablet (kiosk mode), Desktop, and Mobile */

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

/* ===== CSS Custom Properties ===== */
:root {
  --g-primary: #1B3A5C;
  --g-primary-light: #2E5C8A;
  --g-primary-dark: #0F2640;
  --g-accent: #E8722A;
  --g-accent-light: #F08A4A;
  --g-bg: #F0F2F5;
  --g-bg-card: #FFFFFF;
  --g-bg-dark: #0D1B2A;
  --g-text: #2D3748;
  --g-text-light: #718096;
  --g-text-muted: #A0AEC0;
  --g-border: #E2E8F0;
  --g-success: #28A745;
  --g-warning: #FFC107;
  --g-danger: #DC3545;
  --g-info: #17A2B8;
  --g-white: #FFFFFF;
  --g-radius: 12px;
  --g-radius-lg: 16px;
  --g-radius-xl: 20px;
  --g-radius-full: 9999px;
  --g-shadow: 0 4px 20px rgba(0,0,0,0.06);
  --g-shadow-lg: 0 10px 40px rgba(0,0,0,0.1);
  --g-shadow-xl: 0 20px 60px rgba(0,0,0,0.12);
  --g-transition: 300ms cubic-bezier(0.4,0,0.2,1);
  --g-font-heading: 'Plus Jakarta Sans', sans-serif;
  --g-font-body: 'Inter', sans-serif;
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }

body.gestionale-body {
  font-family: var(--g-font-body);
  color: var(--g-text);
  background: var(--g-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--g-primary); text-decoration: none; transition: color var(--g-transition); }
a:hover { color: var(--g-accent); }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; }

h1, h2, h3, h4 {
  font-family: var(--g-font-heading);
  font-weight: 700;
  color: var(--g-bg-dark);
  line-height: 1.2;
}

/* ===== App Shell ===== */
.g-app {
  display: flex;
  min-height: 100vh;
}

/* ===== Sidebar ===== */
.g-sidebar {
  width: 260px;
  background: linear-gradient(180deg, var(--g-bg-dark) 0%, var(--g-primary-dark) 100%);
  color: var(--g-white);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: -260px;
  height: 100vh;
  z-index: 1000;
  transition: left var(--g-transition);
  box-shadow: 4px 0 20px rgba(0,0,0,0.2);
}

.g-sidebar.active {
  left: 0;
}

.g-sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 12px;
}

.g-sidebar-header img {
  width: 42px;
  height: auto;
  border-radius: 8px;
}

.g-sidebar-header h3 {
  color: var(--g-white);
  font-size: 1rem;
  font-weight: 700;
}

.g-sidebar-header span {
  font-size: 0.7rem;
  color: var(--g-accent-light);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.g-sidebar-nav {
  flex: 1;
  padding: 1rem 0;
  overflow-y: auto;
}

.g-sidebar-nav a,
.g-sidebar-nav button {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.85rem 1.5rem;
  color: rgba(255,255,255,0.7);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--g-transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.g-sidebar-nav a:hover,
.g-sidebar-nav button:hover,
.g-sidebar-nav a.active {
  color: var(--g-white);
  background: rgba(255,255,255,0.08);
}

.g-sidebar-nav a.active {
  border-left: 3px solid var(--g-accent);
  background: rgba(232,114,42,0.12);
}

.g-sidebar-nav svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.g-sidebar-label {
  padding: 1.25rem 1.5rem 0.5rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.35);
  font-weight: 600;
}

.g-sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 0.75rem;
  color: rgba(255,255,255,0.4);
}

.g-sidebar-close {
  display: none;
  position: absolute;
  top: 1rem;
  right: 1rem;
  color: var(--g-white);
  background: rgba(255,255,255,0.1);
  border-radius: var(--g-radius-full);
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
}

/* ===== Main Content ===== */
.g-main {
  flex: 1;
  min-height: 100vh;
  padding: 0;
  width: 100%;
}

/* ===== Top Header Bar ===== */
.g-header {
  background: var(--g-white);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 10px rgba(0,0,0,0.04);
  position: sticky;
  top: 0;
  z-index: 900;
  gap: 1rem;
}

.g-header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.g-menu-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--g-radius);
  background: var(--g-bg);
  color: var(--g-text);
  transition: all var(--g-transition);
}

.g-menu-toggle:hover {
  background: var(--g-primary);
  color: var(--g-white);
}

.g-header-title {
  font-family: var(--g-font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--g-bg-dark);
}

.g-header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.g-cart-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0.5rem 1rem;
  background: var(--g-bg);
  border-radius: var(--g-radius);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--g-text);
  transition: all var(--g-transition);
  position: relative;
}

.g-cart-btn:hover {
  background: var(--g-accent);
  color: var(--g-white);
}

.g-cart-badge {
  background: var(--g-accent);
  color: var(--g-white);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--g-radius-full);
  min-width: 18px;
  text-align: center;
  line-height: 1.2;
}

.g-user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--g-text-light);
}

.g-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--g-radius-full);
  background: var(--g-primary);
  color: var(--g-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
}

/* ===== Content Area ===== */
.g-content {
  padding: 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
}

/* ===== Views (show/hide) ===== */
.g-view {
  display: none;
  animation: gFadeIn 0.3s ease;
}

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

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

/* ===== Auth Views ===== */
.g-auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--g-bg-dark) 0%, var(--g-primary) 50%, var(--g-bg-dark) 100%);
  padding: 2rem;
}

.g-auth-view {
  display: none;
  width: 100%;
}

.g-auth-view.active {
  display: block;
}

.g-auth-card {
  background: var(--g-white);
  border-radius: var(--g-radius-xl);
  padding: 2.5rem;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--g-shadow-xl);
  text-align: center;
  margin: 0 auto;
}

.g-auth-logo {
  width: 80px;
  height: auto;
  margin: 0 auto 1rem;
  border-radius: var(--g-radius);
}

.g-auth-card h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.g-auth-card p {
  color: var(--g-text-light);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.g-auth-badge {
  display: inline-block;
  background: linear-gradient(135deg, rgba(232,114,42,0.12), rgba(232,114,42,0.05));
  color: var(--g-accent);
  font-weight: 600;
  font-size: 0.75rem;
  padding: 0.4rem 1rem;
  border-radius: var(--g-radius-full);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 1rem;
}

/* ===== Forms ===== */
.g-form-group {
  margin-bottom: 1rem;
  text-align: left;
}

.g-form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--g-text);
  margin-bottom: 0.4rem;
}

.g-form-group input,
.g-form-group textarea,
.g-form-group select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--g-border);
  border-radius: var(--g-radius);
  font-size: 0.95rem;
  transition: all var(--g-transition);
  background: var(--g-bg);
  color: var(--g-text);
}

.g-form-group input:focus,
.g-form-group textarea:focus,
.g-form-group select:focus {
  outline: none;
  border-color: var(--g-primary);
  background: var(--g-white);
  box-shadow: 0 0 0 4px rgba(27,58,92,0.08);
}

.g-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* ===== Buttons ===== */
.g-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0.75rem 1.5rem;
  border-radius: var(--g-radius);
  font-weight: 600;
  font-size: 0.9rem;
  transition: all var(--g-transition);
  border: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.g-btn-primary {
  background: linear-gradient(135deg, var(--g-accent) 0%, var(--g-accent-light) 100%);
  color: var(--g-white);
  box-shadow: 0 4px 15px rgba(232,114,42,0.3);
}

.g-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(232,114,42,0.4);
}

.g-btn-secondary {
  background: linear-gradient(135deg, var(--g-primary) 0%, var(--g-primary-light) 100%);
  color: var(--g-white);
  box-shadow: 0 4px 15px rgba(27,58,92,0.3);
}

.g-btn-secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(27,58,92,0.4);
}

.g-btn-outline {
  background: transparent;
  color: var(--g-primary);
  border: 2px solid var(--g-border);
}

.g-btn-outline:hover {
  border-color: var(--g-primary);
  background: rgba(27,58,92,0.04);
}

.g-btn-ghost {
  background: transparent;
  color: var(--g-text-light);
  padding: 0.5rem 0.75rem;
}

.g-btn-ghost:hover {
  color: var(--g-accent);
  background: rgba(232,114,42,0.06);
}

.g-btn-danger {
  background: var(--g-danger);
  color: var(--g-white);
}

.g-btn-success {
  background: var(--g-success);
  color: var(--g-white);
}

.g-btn-sm {
  padding: 0.45rem 0.9rem;
  font-size: 0.8rem;
}

.g-btn-lg {
  padding: 1rem 2rem;
  font-size: 1rem;
}

.g-btn-full {
  width: 100%;
}

.g-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ===== OTP Input ===== */
.g-otp-inputs {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 1.5rem 0;
}

.g-otp-inputs input {
  width: 50px;
  height: 56px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  border: 2px solid var(--g-border);
  border-radius: var(--g-radius);
  background: var(--g-bg);
  color: var(--g-bg-dark);
  transition: all var(--g-transition);
}

.g-otp-inputs input:focus {
  border-color: var(--g-accent);
  background: var(--g-white);
  box-shadow: 0 0 0 4px rgba(232,114,42,0.1);
  outline: none;
}

/* ===== Stats Grid ===== */
.g-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.g-stat-card {
  background: var(--g-white);
  border-radius: var(--g-radius-lg);
  padding: 1.25rem;
  box-shadow: var(--g-shadow);
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all var(--g-transition);
}

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

.g-stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--g-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.g-stat-icon.blue { background: linear-gradient(135deg, #4A90E2, #2E5C8A); }
.g-stat-icon.orange { background: linear-gradient(135deg, #E8722A, #F08A4A); }
.g-stat-icon.green { background: linear-gradient(135deg, #28A745, #34D058); }
.g-stat-icon.purple { background: linear-gradient(135deg, #6f42c1, #9B59B6); }

.g-stat-icon svg { color: white; width: 22px; height: 22px; stroke: white; fill: none; }

.g-stat-value {
  font-family: var(--g-font-heading);
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--g-bg-dark);
  line-height: 1;
}

.g-stat-label {
  font-size: 0.78rem;
  color: var(--g-text-light);
  margin-top: 2px;
}

/* ===== Cards ===== */
.g-card {
  background: var(--g-white);
  border-radius: var(--g-radius-lg);
  box-shadow: var(--g-shadow);
  overflow: hidden;
}

.g-card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--g-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--g-white);
}

.g-card-header h3 {
  font-size: 1.05rem;
  color: var(--g-bg-dark);
}

.g-card-body {
  padding: 1.25rem;
  overflow-x: auto;
  max-width: 100%;
}

/* ===== Product Grid ===== */
.g-products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
}

.g-product-card {
  background: var(--g-white);
  border-radius: var(--g-radius-lg);
  overflow: hidden;
  box-shadow: var(--g-shadow);
  transition: all var(--g-transition);
  display: flex;
  flex-direction: column;
}

.g-product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--g-shadow-lg);
}

.g-product-image {
  height: 160px;
  background: linear-gradient(135deg, #f0f4f8, #e2e8f0);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.g-product-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 10px;
  transition: transform var(--g-transition);
}

.g-product-card:hover .g-product-image img {
  transform: scale(1.05);
}

.g-product-image .g-no-image {
  color: var(--g-text-muted);
  font-size: 0.8rem;
  text-align: center;
}

.g-product-image .g-no-image svg {
  width: 40px;
  height: 40px;
  margin-bottom: 4px;
  stroke: var(--g-text-muted);
}

.g-product-category {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(13,27,42,0.75);
  color: var(--g-white);
  font-size: 0.65rem;
  padding: 3px 10px;
  border-radius: var(--g-radius-full);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  backdrop-filter: blur(4px);
}

.g-product-body {
  padding: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.g-product-name {
  font-family: var(--g-font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--g-bg-dark);
  margin-bottom: 0.25rem;
  line-height: 1.3;
}

.g-product-desc {
  font-size: 0.8rem;
  color: var(--g-text-light);
  margin-bottom: 0.75rem;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.g-product-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap; /* Allows wrapping on very small screens */
}

.g-product-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  width: 100%;
  justify-content: space-between;
}

@media (min-width: 380px) {
  .g-product-actions {
    width: auto;
    justify-content: flex-end;
  }
}

.g-product-price {
  font-family: var(--g-font-heading);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--g-accent);
}

.g-product-price.no-price {
  font-size: 0.8rem;
  color: var(--g-text-muted);
  font-weight: 500;
}

.g-product-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-left: auto;
}

.g-add-cart-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--g-radius);
  background: var(--g-accent);
  color: var(--g-white);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--g-transition);
  flex-shrink: 0;
}

.g-add-cart-btn:hover {
  background: var(--g-primary);
  transform: scale(1.1);
}

.g-add-cart-btn svg {
  width: 20px;
  height: 20px;
}

/* Disable spin buttons for number inputs */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
}

/* ===== Filter Bar ===== */
.g-filter-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.g-search-input {
  flex: 1;
  min-width: 200px;
  padding: 0.65rem 1rem 0.65rem 2.5rem;
  border: 2px solid var(--g-border);
  border-radius: var(--g-radius);
  font-size: 0.9rem;
  background: var(--g-white);
  transition: all var(--g-transition);
}

.g-search-input:focus {
  border-color: var(--g-primary);
  outline: none;
  box-shadow: 0 0 0 4px rgba(27,58,92,0.06);
}

.g-search-wrapper {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.g-search-wrapper svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  stroke: var(--g-text-muted);
}

.g-filter-select {
  padding: 0.65rem 1rem;
  border: 2px solid var(--g-border);
  border-radius: var(--g-radius);
  font-size: 0.9rem;
  background: var(--g-white);
  color: var(--g-text);
  cursor: pointer;
  min-width: 150px;
}

/* ===== Cart Drawer ===== */
.g-cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  z-index: 1100;
  opacity: 0;
  visibility: hidden;
  transition: all var(--g-transition);
}

.g-cart-overlay.active {
  opacity: 1;
  visibility: visible;
}

.g-cart-drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  right: -420px;
  width: min(90vw, 420px);
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: var(--g-white);
  z-index: 1200;
  transition: right var(--g-transition);
  display: flex;
  flex-direction: column;
  box-shadow: -10px 0 40px rgba(0,0,0,0.15);
}

.g-cart-drawer.active {
  right: 0;
}

.g-cart-drawer-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--g-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.g-cart-drawer-header h3 {
  font-size: 1.15rem;
}

.g-cart-items {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1rem 1.5rem;
}

.g-cart-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--g-border);
}

.g-cart-item-img {
  width: 50px;
  height: 50px;
  border-radius: 8px;
  background: var(--g-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.g-cart-item-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 2px;
}

.g-cart-item-info {
  flex: 1;
  min-width: 0;
}

.g-cart-item-name {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--g-bg-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.g-cart-item-price {
  font-size: 0.8rem;
  color: var(--g-accent);
  font-weight: 600;
}

.g-cart-qty {
  display: flex;
  align-items: center;
  gap: 4px;
}

.g-cart-qty button {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--g-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  color: var(--g-text);
  transition: all var(--g-transition);
}

.g-cart-qty button:hover {
  background: var(--g-primary);
  color: var(--g-white);
}

.g-cart-qty span {
  font-weight: 700;
  font-size: 0.9rem;
  min-width: 24px;
  text-align: center;
}

.g-cart-remove {
  color: var(--g-danger);
  padding: 4px;
}

.g-cart-remove:hover {
  background: rgba(220,53,69,0.08);
  border-radius: 6px;
}

.g-cart-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--g-border);
  background: var(--g-bg);
}

.g-cart-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.g-cart-total-label {
  font-weight: 600;
  font-size: 1rem;
  color: var(--g-text);
}

.g-cart-total-value {
  font-family: var(--g-font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--g-accent);
}

.g-cart-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--g-text-muted);
}

.g-cart-empty svg {
  width: 48px;
  height: 48px;
  margin: 0 auto 1rem;
  stroke: var(--g-text-muted);
}

/* ===== Checkout Representative Modal ===== */
.g-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 1300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

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

.g-modal {
  background: var(--g-white);
  border-radius: var(--g-radius-xl);
  padding: 2rem;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--g-shadow-xl);
  animation: gFadeIn 0.3s ease;
}

.g-modal h3 {
  margin-bottom: 0.5rem;
}

.g-modal p {
  color: var(--g-text-light);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.g-modal-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* ===== Tables ===== */
.g-table-wrapper {
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

.g-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.g-table thead th {
  background: var(--g-bg);
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--g-text-light);
  white-space: nowrap;
  border-bottom: 2px solid var(--g-border);
}

.g-table tbody td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--g-border);
  vertical-align: middle;
}

.g-table tbody tr:hover {
  background: rgba(0,0,0,0.015);
}

/* ===== Status Badges ===== */
.g-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  border-radius: var(--g-radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.g-badge-success { background: rgba(40,167,69,0.1); color: var(--g-success); }
.g-badge-warning { background: rgba(255,193,7,0.15); color: #856404; }
.g-badge-danger { background: rgba(220,53,69,0.1); color: var(--g-danger); }
.g-badge-info { background: rgba(23,162,184,0.1); color: var(--g-info); }
.g-badge-primary { background: rgba(27,58,92,0.1); color: var(--g-primary); }

/* ===== Alerts / Notifications ===== */
.g-alert {
  padding: 1rem 1.25rem;
  border-radius: var(--g-radius);
  margin-bottom: 1rem;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: gFadeIn 0.3s ease;
}

.g-alert-success { background: rgba(40,167,69,0.08); color: #155724; border: 1px solid rgba(40,167,69,0.2); }
.g-alert-error { background: rgba(220,53,69,0.08); color: #721c24; border: 1px solid rgba(220,53,69,0.2); }
.g-alert-info { background: rgba(23,162,184,0.08); color: #0c5460; border: 1px solid rgba(23,162,184,0.2); }
.g-alert-warning { background: rgba(255,193,7,0.1); color: #856404; border: 1px solid rgba(255,193,7,0.3); }

/* ===== Toast Notification ===== */
.g-toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.g-toast {
  background: var(--g-bg-dark);
  color: var(--g-white);
  padding: 0.85rem 1.25rem;
  border-radius: var(--g-radius);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--g-shadow-lg);
  animation: gSlideUp 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 350px;
}

.g-toast.success { border-left: 4px solid var(--g-success); }
.g-toast.error { border-left: 4px solid var(--g-danger); }

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

/* ===== Loading Spinner ===== */
.g-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--g-border);
  border-top-color: var(--g-accent);
  border-radius: 50%;
  animation: gSpin 0.7s linear infinite;
  margin: 2rem auto;
}

@keyframes gSpin {
  to { transform: rotate(360deg); }
}

.g-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--g-text-light);
}

/* ===== Empty States ===== */
.g-empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--g-text-muted);
}

.g-empty-state svg {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  stroke: var(--g-text-muted);
}

.g-empty-state h4 {
  color: var(--g-text-light);
  margin-bottom: 0.5rem;
}

/* ===== Sidebar Overlay (mobile) ===== */
.g-sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: all var(--g-transition);
}

.g-sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ===== Order Detail ===== */
.g-order-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

/* ===== Responsive ===== */

/* Tablet landscape and up */
@media (min-width: 768px) {
  .g-sidebar {
    left: 0;
    box-shadow: none;
  }

  .g-main {
    margin-left: 260px;
  }

  .g-menu-toggle {
    display: none;
  }

  .g-sidebar-close {
    display: none !important;
  }

  .g-sidebar-overlay {
    display: none !important;
  }

  .g-products-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }
}

/* Desktop */
@media (min-width: 1200px) {
  .g-products-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  }

  .g-content {
    padding: 2rem;
  }
}

/* Mobile only */
@media (max-width: 767px) {
  .g-sidebar-close {
    display: flex;
  }

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

  .g-header-title {
    font-size: 0.95rem;
  }

  .g-user-info span {
    display: none;
  }

  .g-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .g-stat-card {
    flex-direction: column;
    text-align: center;
    gap: 0.5rem;
    padding: 1rem;
  }

  .g-content {
    padding: 1rem;
  }

  .g-modal {
    padding: 1.5rem;
  }

  .g-modal-actions {
    flex-direction: column;
  }

  .g-auth-card {
    padding: 1.5rem;
  }

  .g-products-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .g-product-card {
    flex-direction: row;
  }

  .g-product-image {
    width: 120px;
    height: 120px;
    flex-shrink: 0;
  }

  .g-product-body {
    padding: 0.75rem;
    justify-content: center;
  }

  .g-product-name {
    font-size: 0.9rem;
    -webkit-line-clamp: 2;
    display: -webkit-box;
    -webkit-box-orient: vertical;
  }

  .g-product-desc {
    display: none;
  }

  .g-product-footer {
    margin-top: 0.5rem;
  }
}

/* Touch optimization for tablets */
@media (hover: none) and (pointer: coarse) {
  .g-btn {
    min-height: 48px;
  }

  .g-add-cart-btn {
    width: 48px;
    height: 48px;
  }

  .g-cart-qty button {
    width: 36px;
    height: 36px;
  }

  .g-form-group input,
  .g-form-group textarea,
  .g-form-group select {
    min-height: 48px;
    font-size: 16px; /* Prevent iOS zoom */
  }

  .g-sidebar-nav a,
  .g-sidebar-nav button {
    padding: 1rem 1.5rem;
  }
}
