/* ============================================
   style.css - 海医文创全局样式 v3.0
   琼岛医礼 · 前后端分离架构
   现代化移动优先 · 触摸优化 · 无障碍支持
   ============================================ */

/* ========== Design Tokens ========== */
:root {
  /* Brand Colors */
  --primary: #1a3c8b;
  --primary-light: #2d6bc3;
  --primary-dark: #0f2660;
  --primary-surface: #e8f0fe;

  /* Accent */
  --gold: #f0c040;
  --gold-light: #f8d66b;
  --gold-dark: #c49a20;
  --gold-surface: #fff8e1;

  /* Semantic Colors */
  --danger: #d93025;
  --danger-light: #fce8e6;
  --success: #1e8e3e;
  --success-light: #e6f4ea;
  --warning: #f09d00;
  --warning-light: #fef7e0;
  --info: #1967d2;
  --info-light: #e8f0fe;
  --purple: #8338ec;
  --purple-light: #f3e8ff;

  /* Neutral */
  --dark: #1a1a2e;
  --bg: #f2f4f7;
  --bg-alt: #f8f9fb;
  --card-bg: #ffffff;
  --border: #e2e5ea;
  --border-light: #f0f1f3;

  /* Text */
  --text: #1f2937;
  --text-secondary: #5f6b7a;
  --text-tertiary: #9ca3af;
  --text-inverse: #ffffff;

  /* Spacing Scale (4dp system) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* Typography Scale */
  --text-xs: 0.75rem;    /* 12px */
  --text-sm: 0.8125rem;  /* 13px */
  --text-base: 0.9375rem; /* 15px */
  --text-md: 1.0625rem;   /* 17px */
  --text-lg: 1.25rem;     /* 20px */
  --text-xl: 1.5rem;      /* 24px */
  --text-2xl: 1.875rem;   /* 30px */
  --text-3xl: 2.25rem;    /* 36px */
  --text-4xl: 3rem;       /* 48px */

  /* Radii */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Elevation */
  --shadow-xs: 0 1px 3px rgba(0,0,0,0.04);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
  --shadow: 0 4px 16px rgba(0,0,0,0.07);
  --shadow-hover: 0 8px 30px rgba(0,0,0,0.10);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.12);
  --shadow-xl: 0 20px 60px rgba(0,0,0,0.18);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);

  /* Touch */
  --touch-target: 44px;

  /* Layout */
  --navbar-height: 64px;
  --sidebar-width: 250px;
  --content-max: 1200px;
}

/* ========== Reset & Base ========== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

body {
  font-family: 'Noto Sans SC', 'Microsoft YaHei', 'PingFang SC', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  font-size: var(--text-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition-fast);
}
a:hover {
  color: var(--primary-light);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Remove default list styles */
ul, ol {
  list-style: none;
}

/* ========== Container System ========== */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--space-5);
}
.container-sm {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 var(--space-5);
}
.container-xs {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 0 var(--space-5);
}

/* ========== Section System ========== */
.section {
  padding: var(--space-16) 0;
}
.section-sm {
  padding: var(--space-10) 0;
}
.section-title {
  text-align: center;
  margin-bottom: var(--space-10);
}
.section-title h2 {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  color: var(--primary);
  margin-bottom: var(--space-3);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.section-title h2::after {
  content: '';
  display: block;
  width: 64px;
  height: 4px;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  margin: var(--space-4) auto 0;
  border-radius: 2px;
}
.section-title p {
  color: var(--text-secondary);
  max-width: 640px;
  margin: 0 auto;
  font-size: var(--text-md);
  line-height: 1.7;
}

/* ========== Navbar ========== */
.navbar {
  background: var(--primary);
  color: var(--text-inverse);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 12px rgba(0,0,0,0.18);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.navbar-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--space-5);
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: var(--navbar-height);
  gap: var(--space-4);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-inverse);
  text-decoration: none;
  font-size: var(--text-lg);
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: -0.01em;
}
.navbar-brand:hover {
  color: var(--gold-light);
}

.navbar-logo {
  height: 42px;
  width: auto;
  border-radius: var(--radius-xs);
  background: white;
  padding: 3px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.brand-text span {
  color: var(--gold);
}
.brand-text small {
  font-size: 10px;
  opacity: 0.6;
  font-weight: 400;
  letter-spacing: 0.02em;
}

.navbar-nav {
  display: flex;
  list-style: none;
  gap: 2px;
  align-items: center;
}

.navbar-nav a {
  color: rgba(255,255,255,0.88);
  text-decoration: none;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  min-height: var(--touch-target);
}
.navbar-nav a:hover {
  color: var(--gold);
  background: rgba(255,255,255,0.1);
}
.navbar-nav a.active {
  color: var(--gold);
  background: rgba(255,215,0,0.15);
  font-weight: 600;
}

/* User group in nav */
.user-group {
  display: inline-flex !important;
  align-items: center;
  gap: 2px;
}
.user-group a {
  padding: var(--space-2) var(--space-3);
}

/* Cart badge */
.cart-badge {
  background: var(--danger);
  color: white;
  border-radius: var(--radius-full);
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 700;
  min-width: 20px;
  text-align: center;
  line-height: 1.4;
}

/* Navbar hamburger */
.navbar-toggle {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 22px;
  cursor: pointer;
  padding: var(--space-2);
  min-width: var(--touch-target);
  min-height: var(--touch-target);
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}
.navbar-toggle:hover {
  background: rgba(255,255,255,0.1);
}

/* ========== Buttons ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 24px;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: 2px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  font-family: inherit;
  line-height: 1.4;
  min-height: var(--touch-target);
  -webkit-user-select: none;
  user-select: none;
  position: relative;
  overflow: hidden;
}
.btn:active {
  transform: scale(0.97);
}
.btn:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

/* Button Variants */
.btn-primary {
  background: var(--primary);
  color: var(--text-inverse);
}
.btn-primary:hover {
  background: var(--primary-light);
  box-shadow: 0 4px 16px rgba(26,60,139,0.3);
  transform: translateY(-1px);
}

.btn-gold {
  background: var(--gold);
  color: var(--primary-dark);
  border-color: var(--gold);
}
.btn-gold:hover {
  background: var(--gold-light);
  box-shadow: 0 4px 16px rgba(240,192,64,0.35);
  transform: translateY(-1px);
}

.btn-success {
  background: var(--success);
  color: white;
}
.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-warning {
  background: var(--warning);
  color: var(--text);
}
.btn-info {
  background: var(--info);
  color: white;
}
.btn-purple {
  background: var(--purple);
  color: white;
}

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text-secondary);
}
.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-surface);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: var(--bg-alt);
  color: var(--text);
}

/* Button Sizes */
.btn-xs {
  padding: 4px 12px;
  font-size: var(--text-xs);
  min-height: 32px;
  border-radius: var(--radius-full);
}
.btn-sm {
  padding: 7px 16px;
  font-size: var(--text-xs);
  min-height: 36px;
}
.btn-lg {
  padding: 15px 32px;
  font-size: var(--text-md);
  min-height: 52px;
  border-radius: var(--radius-full);
}
.btn-block {
  display: flex;
  width: 100%;
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  pointer-events: none;
}

/* ========== Cards ========== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: var(--transition);
  border: 1px solid transparent;
}
.card:hover {
  border-color: var(--border);
}

.card-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
}
.card-header h3 {
  font-size: var(--text-md);
  color: var(--primary);
  font-weight: 700;
}

.card-body {
  padding: var(--space-6);
}
.card-body.padded {
  padding: var(--space-5);
}

.card-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
}

/* ========== Forms ========== */
.form-group {
  margin-bottom: var(--space-4);
}
.form-group label {
  display: block;
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--text);
  margin-bottom: 6px;
}
.form-group label .required {
  color: var(--danger);
  margin-left: 2px;
}
.form-group .helper-text {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: 4px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 11px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  font-family: inherit;
  outline: none;
  transition: var(--transition-fast);
  background: #fafbfc;
  color: var(--text);
  -webkit-appearance: none;
  appearance: none;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(26,60,139,0.08);
  background: white;
}
.form-input.error,
.form-select.error,
.form-textarea.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 4px rgba(217,48,37,0.08);
}
.form-textarea {
  resize: vertical;
  min-height: 96px;
}
.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235f6b7a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

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

.form-check {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  min-height: var(--touch-target);
}
.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  flex-shrink: 0;
}

.form-error {
  color: var(--danger);
  font-size: var(--text-xs);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Search input */
.search-input {
  border-radius: var(--radius-full) !important;
  padding-left: 42px !important;
}
.search-wrapper {
  position: relative;
}
.search-wrapper i {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
}

/* ========== Tables ========== */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  white-space: nowrap;
}
thead th {
  background: #f8f9fb;
  color: var(--text-secondary);
  padding: 12px 14px;
  text-align: left;
  font-weight: 600;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1;
}
tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
  color: var(--text);
}
tbody tr {
  transition: background 0.15s;
}
tbody tr:hover {
  background: #f8f9ff;
}
tbody tr:last-child td {
  border-bottom: none;
}

/* Mobile table - card view */
@media (max-width: 640px) {
  .table-card-view thead {
    display: none;
  }
  .table-card-view tbody tr {
    display: block;
    margin-bottom: var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-4);
    box-shadow: var(--shadow-xs);
    background: var(--card-bg);
  }
  .table-card-view tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-light);
    gap: var(--space-2);
  }
  .table-card-view tbody td:last-child {
    border-bottom: none;
  }
  .table-card-view tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: var(--text-xs);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    flex-shrink: 0;
    margin-right: var(--space-2);
  }
  .table-card-view tbody tr:hover {
    background: var(--card-bg);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
  }
}

/* ========== Badges ========== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.1px;
  line-height: 1.4;
  white-space: nowrap;
}

.badge-pending,
.badge-pending_payment {
  background: var(--warning-light);
  color: #92600a;
}
.badge-paid {
  background: var(--info-light);
  color: #1a4fa0;
}
.badge-shipped {
  background: #e8f0fe;
  color: var(--primary-dark);
}
.badge-completed {
  background: var(--success-light);
  color: #0e5a20;
}
.badge-cancelled {
  background: var(--danger-light);
  color: #a61c10;
}
.badge-refunded {
  background: #f3e8ff;
  color: #6b21a8;
}
.badge-active {
  background: var(--success-light);
  color: #0e5a20;
}
.badge-inactive {
  background: var(--danger-light);
  color: #a61c10;
}
.badge-custom {
  background: var(--purple-light);
  color: #6b21a8;
}
.badge-discount {
  background: var(--purple-light);
  color: #6b21a8;
}
.badge-primary {
  background: var(--primary-surface);
  color: var(--primary);
}

/* ========== Product Grid & Cards ========== */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-6);
}

.product-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  border: 1px solid transparent;
}
.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--border);
}

.product-card-img {
  height: 200px;
  background: linear-gradient(135deg, var(--primary-surface), #e8edf8);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.product-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.product-card:hover .product-card-img img {
  transform: scale(1.05);
}
.product-card-img .icon-placeholder {
  font-size: 52px;
  color: var(--primary-light);
  opacity: 0.5;
}

.product-card-body {
  padding: var(--space-5);
  flex: 1;
  display: flex;
  flex-direction: column;
}
.product-card-body .category-tag {
  font-size: var(--text-xs);
  color: var(--primary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.product-card-body h3 {
  font-size: var(--text-md);
  color: var(--text);
  margin-bottom: 4px;
  font-weight: 600;
  line-height: 1.4;
}
.product-card-body .product-price {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--danger);
  margin: var(--space-2) 0;
}
.product-card-body .product-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  flex: 1;
  margin-bottom: var(--space-4);
  line-height: 1.5;
}

/* ========== Hero Section ========== */
.hero {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 40%, var(--primary-light) 100%);
  color: var(--text-inverse);
  text-align: center;
  padding: clamp(40px, 8vw, 80px) var(--space-5);
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 50%, rgba(255,255,255,0.05) 0%, transparent 60%),
              radial-gradient(circle at 70% 20%, rgba(255,215,0,0.08) 0%, transparent 50%);
  pointer-events: none;
}
.hero .container {
  position: relative;
  z-index: 1;
}
.hero h1 {
  font-size: clamp(1.75rem, 5vw, 3rem);
  font-weight: 700;
  margin-bottom: var(--space-4);
  letter-spacing: -0.01em;
}
.hero p {
  font-size: clamp(0.9rem, 2vw, 1.15rem);
  opacity: 0.88;
  max-width: 640px;
  margin: 0 auto var(--space-8);
  line-height: 1.8;
}
.hero .btn-group {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
  flex-wrap: wrap;
}

/* ========== Modal ========== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 2000;
  justify-content: center;
  align-items: flex-start;
  padding: var(--space-10) var(--space-5);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.modal-overlay.show {
  display: flex;
}
.modal-dialog {
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-xl);
  animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  margin: auto;
}

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

.modal-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h3 {
  font-size: var(--text-lg);
  color: var(--primary);
  font-weight: 700;
}
.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-tertiary);
  cursor: pointer;
  min-width: var(--touch-target);
  min-height: var(--touch-target);
  border-radius: var(--radius-full);
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover {
  background: var(--danger-light);
  color: var(--danger);
}
.modal-body {
  padding: var(--space-6);
  max-height: 60vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.modal-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}

/* ========== Toast Notifications ========== */
.toast-container {
  position: fixed;
  top: var(--space-5);
  right: var(--space-5);
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
  max-width: calc(100vw - 2 * var(--space-5));
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  color: white;
  font-weight: 600;
  font-size: var(--text-sm);
  box-shadow: var(--shadow-lg);
  animation: toastSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 260px;
  pointer-events: auto;
  line-height: 1.4;
}
.toast i {
  font-size: 16px;
  flex-shrink: 0;
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(80px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.toast-success {
  background: var(--success);
}
.toast-error {
  background: var(--danger);
}
.toast-info {
  background: var(--info);
}
.toast-warning {
  background: var(--warning);
  color: var(--text);
}

/* ========== Footer ========== */
.footer {
  background: var(--primary-dark);
  color: #b0c4ff;
  padding: var(--space-12) 0 var(--space-8);
  margin-top: var(--space-16);
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-8);
  margin-bottom: var(--space-8);
}
.footer-grid h4 {
  color: white;
  font-size: var(--text-md);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: 2px solid var(--gold);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.footer-grid p,
.footer-grid li {
  font-size: var(--text-sm);
  line-height: 1.9;
}
.footer-grid a {
  color: #b0c4ff;
  transition: var(--transition-fast);
}
.footer-grid a:hover {
  color: var(--gold);
}
.footer-bottom {
  text-align: center;
  padding-top: var(--space-6);
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: var(--text-xs);
  color: rgba(255,255,255,0.4);
}

/* ========== Empty State ========== */
.empty-state {
  text-align: center;
  padding: var(--space-16) var(--space-5);
  color: var(--text-secondary);
}
.empty-state i {
  font-size: 56px;
  color: #d0d5dd;
  margin-bottom: var(--space-4);
  display: block;
}
.empty-state h3 {
  font-size: var(--text-lg);
  color: var(--text);
  margin-bottom: var(--space-2);
}
.empty-state p {
  max-width: 400px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ========== Loading States ========== */
.loading {
  text-align: center;
  padding: var(--space-10) var(--space-5);
  color: var(--text-secondary);
}
.loading p {
  margin-top: var(--space-3);
  font-size: var(--text-sm);
}

.spinner {
  display: inline-block;
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, var(--border-light) 25%, #e8eaed 37%, var(--border-light) 63%);
  background-size: 400% 100%;
  animation: skeleton-shimmer 1.4s ease infinite;
  border-radius: var(--radius-sm);
}
@keyframes skeleton-shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}
.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
}
.skeleton-title {
  height: 20px;
  width: 60%;
  margin-bottom: 12px;
}
.skeleton-img {
  height: 180px;
}

/* ========== Utilities ========== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-secondary); }
.text-primary { color: var(--primary); }

/* Spacing utilities */
.mt-1 { margin-top: var(--space-2); }
.mt-2 { margin-top: var(--space-4); }
.mt-3 { margin-top: var(--space-6); }
.mt-4 { margin-top: var(--space-8); }
.mt-5 { margin-top: var(--space-10); }
.mb-1 { margin-bottom: var(--space-2); }
.mb-2 { margin-bottom: var(--space-4); }
.mb-3 { margin-bottom: var(--space-6); }
.mb-4 { margin-bottom: var(--space-8); }
.mr-1 { margin-right: var(--space-2); }
.mr-2 { margin-right: var(--space-4); }
.ml-1 { margin-left: var(--space-2); }
.ml-2 { margin-left: var(--space-4); }
.py-2 { padding-top: var(--space-4); padding-bottom: var(--space-4); }
.py-3 { padding-top: var(--space-6); padding-bottom: var(--space-6); }
.py-4 { padding-top: var(--space-8); padding-bottom: var(--space-8); }
.px-2 { padding-left: var(--space-4); padding-right: var(--space-4); }
.px-3 { padding-left: var(--space-6); padding-right: var(--space-6); }
.gap-1 { gap: var(--space-2); }
.gap-2 { gap: var(--space-4); }
.gap-3 { gap: var(--space-6); }

/* Display */
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Flex / Grid helpers */
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-1 { flex: 1; }

/* Divider */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-6) 0;
}

/* ========== Admin Layout ========== */
.admin-layout {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
}

.admin-sidebar {
  width: var(--sidebar-width);
  background: var(--dark);
  color: white;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
}
.admin-sidebar .brand {
  padding: 22px var(--space-5);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: white;
  font-size: var(--text-md);
  font-weight: 700;
}
.admin-sidebar .brand i {
  font-size: 24px;
  color: var(--gold);
}
.admin-sidebar .brand span {
  color: var(--gold);
}
.admin-sidebar .brand small {
  font-size: 10px;
  opacity: 0.4;
}

.admin-sidebar nav {
  flex: 1;
  padding: var(--space-3) 0;
  overflow-y: auto;
}
.admin-sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px var(--space-5);
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: var(--transition-fast);
  min-height: var(--touch-target);
}
.admin-sidebar nav a:hover,
.admin-sidebar nav a.active {
  background: rgba(255,215,0,0.08);
  color: var(--gold);
  border-left-color: var(--gold);
}
.admin-sidebar nav a i {
  width: 18px;
  text-align: center;
  font-size: 15px;
}

.admin-sidebar .sidebar-footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid rgba(255,255,255,0.08);
}
.admin-sidebar .sidebar-footer a {
  color: rgba(255,255,255,0.45);
  text-decoration: none;
  font-size: var(--text-xs);
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: var(--touch-target);
  transition: var(--transition-fast);
}
.admin-sidebar .sidebar-footer a:hover {
  color: var(--gold);
}

.admin-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
}

.admin-topbar {
  background: var(--card-bg);
  padding: 14px var(--space-6);
  box-shadow: var(--shadow-xs);
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
}
.admin-topbar h2 {
  font-size: var(--text-lg);
  color: var(--primary);
  font-weight: 700;
}
.admin-topbar .menu-btn {
  display: none;
}

.admin-content {
  padding: var(--space-6);
}

/* Admin stat cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-xs);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  border: 1px solid transparent;
  transition: var(--transition);
}
.stat-card:hover {
  box-shadow: var(--shadow-sm);
  border-color: var(--border);
  transform: translateY(-2px);
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: white;
  flex-shrink: 0;
}
.stat-icon.blue {
  background: linear-gradient(135deg, #3a86ff, #6ab1ff);
}
.stat-icon.green {
  background: linear-gradient(135deg, #38b000, #70e000);
}
.stat-icon.orange {
  background: linear-gradient(135deg, #ff9f43, #feca57);
}
.stat-icon.purple {
  background: linear-gradient(135deg, #8338ec, #b066ff);
}
.stat-icon.gold {
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
}
.stat-icon.teal {
  background: linear-gradient(135deg, #0d9488, #2dd4bf);
}

.stat-info h4 {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
  font-weight: 600;
}
.stat-info .val {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

/* ========== Feature Cards (Home) ========== */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-6);
}

.feature-card {
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  border: 1px solid transparent;
  cursor: pointer;
}
.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--border);
}
.feature-card .feature-icon {
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 56px;
  color: white;
  position: relative;
  overflow: hidden;
}
.feature-card .feature-icon i {
  position: relative;
  z-index: 1;
}
.feature-card .feature-body {
  padding: var(--space-5);
  flex: 1;
}
.feature-card .feature-body h3 {
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--space-2);
}
.feature-card .feature-body p {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ========== Order Cards ========== */
.order-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}
.order-card-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  background: var(--bg-alt);
}
.order-card-body {
  padding: var(--space-5);
}
.order-card-footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* ========== Breadcrumb ========== */
.breadcrumb {
  padding: var(--space-3) 0;
  color: var(--text-tertiary);
  font-size: var(--text-sm);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
}
.breadcrumb a:hover {
  color: var(--primary);
}
.breadcrumb .separator {
  color: var(--text-tertiary);
  font-size: var(--text-xs);
}

/* ========== Pagination ========== */
.pagination {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
}
.pagination .page-btn {
  min-width: 40px;
  min-height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: var(--text-sm);
  cursor: pointer;
  border: 2px solid var(--border);
  background: var(--card-bg);
  color: var(--text-secondary);
  transition: var(--transition-fast);
}
.pagination .page-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.pagination .page-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.pagination .page-ellipsis {
  padding: var(--space-2);
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
}

/* ========== Tabs ========== */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  gap: 2px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tab {
  padding: var(--space-3) var(--space-5);
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition-fast);
  white-space: nowrap;
  min-height: var(--touch-target);
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: inherit;
}
.tab:hover {
  color: var(--primary);
}
.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ========== Mobile Bottom Nav ========== */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  z-index: 999;
  padding: var(--space-1) 0;
  padding-bottom: env(safe-area-inset-bottom, 4px);
  box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
}
.mobile-bottom-nav .nav-items {
  display: flex;
  justify-content: space-around;
  align-items: center;
}
.mobile-bottom-nav .nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-1) var(--space-2);
  color: var(--text-tertiary);
  text-decoration: none;
  font-size: 10px;
  font-weight: 500;
  min-width: 56px;
  min-height: var(--touch-target);
  justify-content: center;
  transition: var(--transition-fast);
  border-radius: var(--radius-sm);
}
.mobile-bottom-nav .nav-item i {
  font-size: 20px;
}
.mobile-bottom-nav .nav-item.active {
  color: var(--primary);
  font-weight: 600;
}

/* ========== Responsive - Navbar ========== */
@media (max-width: 768px) {
  :root {
    --navbar-height: 56px;
  }

  .navbar-inner {
    flex-wrap: wrap;
    height: auto;
    padding: var(--space-3) var(--space-4);
  }

  .navbar-brand {
    font-size: var(--text-md);
  }
  .navbar-logo {
    height: 34px;
  }

  .navbar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
  }

  .navbar-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 2px;
    padding: var(--space-3) 0 var(--space-4);
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: var(--space-2);
  }

  .navbar-nav.show {
    display: flex;
  }

  .navbar-nav a {
    width: 100%;
    padding: 11px var(--space-4);
    border-radius: var(--radius-sm);
    font-size: var(--text-base);
  }

  .user-group {
    width: 100%;
    justify-content: flex-start;
  }
  .user-group a {
    padding: 11px var(--space-4);
  }

  /* Show mobile bottom nav on small screens */
  .mobile-bottom-nav {
    display: block;
  }
  body.has-mobile-nav {
    padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
  }
}

/* ========== Responsive - General ========== */
@media (max-width: 1024px) {
  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--space-4);
  }
  .section {
    padding: var(--space-10) 0;
  }
  .container {
    padding: 0 var(--space-4);
  }
}

@media (max-width: 640px) {
  .products-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: var(--space-3);
  }
  .section {
    padding: var(--space-8) 0;
  }
  .section-title {
    margin-bottom: var(--space-6);
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .hero .btn-group {
    flex-direction: column;
    align-items: center;
  }
  .hero .btn {
    width: 100%;
    max-width: 300px;
  }
  .card-body {
    padding: var(--space-4);
  }
  .product-card-img {
    height: 150px;
  }
  .product-card-body {
    padding: var(--space-3);
  }

  /* Single column grid */
  .products-grid.single-col-mobile {
    grid-template-columns: 1fr;
  }

  /* Feature cards single column */
  .features-grid {
    grid-template-columns: 1fr;
  }
}

/* ========== Responsive - Admin ========== */
@media (max-width: 992px) {
  .admin-sidebar {
    transform: translateX(-100%);
  }
  .admin-sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-xl);
  }
  .admin-main {
    margin-left: 0;
  }
  .admin-topbar .menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: var(--touch-target);
    min-height: var(--touch-target);
  }
  .admin-content {
    padding: var(--space-4);
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .admin-content {
    padding: var(--space-3);
  }
  .admin-topbar {
    padding: 12px var(--space-4);
  }
  .admin-topbar h2 {
    font-size: var(--text-md);
  }
}

/* ========== Accessibility ========== */
/* Visible focus outline for keyboard navigation */
:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Print styles */
@media print {
  .navbar,
  .admin-sidebar,
  .admin-topbar,
  .footer,
  .btn,
  .mobile-bottom-nav {
    display: none !important;
  }
  .admin-main {
    margin-left: 0 !important;
  }
  body {
    background: white;
    font-size: 12pt;
  }
}

/* ========== iOS Safe Area Support ========== */
@supports (padding: env(safe-area-inset-bottom)) {
  .mobile-bottom-nav {
    padding-bottom: calc(var(--space-1) + env(safe-area-inset-bottom));
  }
  body.has-mobile-nav {
    padding-bottom: calc(56px + env(safe-area-inset-bottom));
  }
}
