/* ============================================
   SmartCar Customer Viewer - Design System
   Premium Dark Theme with Glassmorphism
   ============================================ */

/* CSS Variables / Tokens */
:root {
  /* Colors */
  --bg-primary: #0a0e1a;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.7);
  --bg-card-hover: rgba(30, 41, 59, 0.8);
  --bg-glass: rgba(255, 255, 255, 0.03);
  --bg-glass-border: rgba(255, 255, 255, 0.08);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-blue: #3b82f6;
  --accent-blue-glow: rgba(59, 130, 246, 0.3);
  --accent-purple: #8b5cf6;
  --accent-purple-glow: rgba(139, 92, 246, 0.3);
  --accent-emerald: #10b981;
  --accent-emerald-glow: rgba(16, 185, 129, 0.3);
  --accent-amber: #f59e0b;
  --accent-amber-glow: rgba(245, 158, 11, 0.3);
  --accent-rose: #f43f5e;
  --accent-rose-glow: rgba(244, 63, 94, 0.3);

  --border-color: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);

  /* Sidebar */
  --sidebar-width: 260px;
  --sidebar-bg: rgba(15, 23, 42, 0.95);

  /* Gradients */
  --gradient-blue: linear-gradient(135deg, #3b82f6, #1d4ed8);
  --gradient-purple: linear-gradient(135deg, #8b5cf6, #6d28d9);
  --gradient-emerald: linear-gradient(135deg, #10b981, #059669);
  --gradient-amber: linear-gradient(135deg, #f59e0b, #d97706);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow-blue: 0 0 30px rgba(59, 130, 246, 0.15);
  --shadow-glow-purple: 0 0 30px rgba(139, 92, 246, 0.15);

  /* Typography */
  --font-primary: 'Noto Sans Thai', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

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

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

body {
  font-family: var(--font-primary);
  background: var(--bg-primary);
  color: var(--text-primary);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* Animated background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 600px 400px at 20% 20%, rgba(59, 130, 246, 0.06), transparent),
    radial-gradient(ellipse 500px 500px at 80% 80%, rgba(139, 92, 246, 0.05), transparent),
    radial-gradient(ellipse 400px 300px at 50% 50%, rgba(16, 185, 129, 0.03), transparent);
  pointer-events: none;
  z-index: 0;
}

/* ============================================
   Sidebar
   ============================================ */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 100;
  backdrop-filter: blur(20px);
  transition: transform var(--transition-normal);
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  width: 42px;
  height: 42px;
  background: var(--gradient-blue);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glow-blue);
  flex-shrink: 0;
}

.logo-icon svg {
  width: 22px;
  height: 22px;
  color: white;
}

.logo-text h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #f1f5f9, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-text span {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.9rem;
  transition: all var(--transition-fast);
  position: relative;
}

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

.nav-item:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
  color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.1);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--accent-blue);
  border-radius: 0 3px 3px 0;
}

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
}

.version-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* ============================================
   Store Selector
   ============================================ */
.store-selector {
  padding: 0.75rem;
  border-top: 1px solid var(--border-color);
}

.store-selector-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.4rem 0.5rem;
  margin-bottom: 0.25rem;
}

.store-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0.85rem;
  color: var(--text-secondary);
  position: relative;
}

.store-option:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.store-option.active {
  background: rgba(59, 130, 246, 0.08);
  color: var(--text-primary);
}

.store-option input[type="radio"] {
  display: none;
}

.store-radio {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--text-muted);
  flex-shrink: 0;
  position: relative;
  transition: all var(--transition-fast);
}

.store-option.active .store-radio {
  border-color: var(--accent-blue);
}

.store-option.active .store-radio::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--accent-blue);
}

.store-name {
  flex: 1;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.store-dot.viriyah { background: var(--accent-blue); }
.store-dot.bancha { background: var(--accent-amber); }

/* Store Badge (in table) */
.store-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.55rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}

.store-badge.viriyah {
  background: rgba(59, 130, 246, 0.12);
  color: var(--accent-blue);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.store-badge.bancha {
  background: rgba(245, 158, 11, 0.12);
  color: var(--accent-amber);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.store-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.store-badge.viriyah .store-badge-dot { background: var(--accent-blue); }
.store-badge.bancha .store-badge-dot { background: var(--accent-amber); }

/* Store breakdown cards on dashboard */
.store-breakdown {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.store-breakdown-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: all var(--transition-fast);
}

.store-breakdown-card:hover {
  border-color: var(--border-hover);
}

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

.store-breakdown-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.store-breakdown-name {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.store-breakdown-count {
  font-size: 1.25rem;
  font-weight: 700;
}

/* ============================================
   Main Content
   ============================================ */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

/* ============================================
   Top Header
   ============================================ */
.top-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 2rem;
  background: rgba(10, 14, 26, 0.8);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
}

.menu-toggle:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.menu-toggle svg {
  width: 22px;
  height: 22px;
}

.header-search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0 1rem;
  max-width: 560px;
  transition: all var(--transition-fast);
}

.header-search:focus-within {
  border-color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.05);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.header-search svg {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.header-search input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 0.9rem;
  padding: 0.6rem 0;
}

.header-search input::placeholder {
  color: var(--text-muted);
}

.header-search kbd {
  font-family: var(--font-primary);
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  white-space: nowrap;
}

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

.current-time {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
}

/* ============================================
   Pages
   ============================================ */
.page {
  display: none;
  padding: 2rem;
  animation: fadeIn 0.3s ease;
}

.page.active {
  display: block;
}

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

.page-header {
  margin-bottom: 2rem;
}

.page-header h2 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ============================================
   Stats Cards
   ============================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  backdrop-filter: blur(10px);
  transition: all var(--transition-normal);
  cursor: default;
}

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

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

.stat-icon svg {
  width: 24px;
  height: 24px;
}

.stat-icon.customers {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(59, 130, 246, 0.05));
  color: var(--accent-blue);
  box-shadow: inset 0 0 20px rgba(59, 130, 246, 0.1);
}

.stat-icon.sales {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(139, 92, 246, 0.05));
  color: var(--accent-purple);
  box-shadow: inset 0 0 20px rgba(139, 92, 246, 0.1);
}

.stat-icon.products {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.05));
  color: var(--accent-emerald);
  box-shadow: inset 0 0 20px rgba(16, 185, 129, 0.1);
}

.stat-icon.recent {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(245, 158, 11, 0.05));
  color: var(--accent-amber);
  box-shadow: inset 0 0 20px rgba(245, 158, 11, 0.1);
}

.stat-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

/* ============================================
   Glass Card
   ============================================ */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  backdrop-filter: blur(10px);
}

/* ============================================
   Dashboard Search
   ============================================ */
.dashboard-search-section {
  max-width: 650px;
}

.dashboard-search-section h3 {
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}

.dashboard-search-section p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
}

.dashboard-search-box {
  display: flex;
  gap: 0.75rem;
}

.dashboard-search-box input {
  flex: 1;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 1rem;
  outline: none;
  transition: all var(--transition-fast);
}

.dashboard-search-box input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ============================================
   Buttons
   ============================================ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.5rem;
  background: var(--gradient-blue);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-primary);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow-blue);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  background: none;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: var(--font-primary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-ghost:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
  background: rgba(255, 255, 255, 0.03);
}

.btn-view {
  padding: 0.4rem 0.9rem;
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent-blue);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-sm);
  font-family: var(--font-primary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-view:hover {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.4);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.15);
}

/* ============================================
   Search Panel
   ============================================ */
.search-panel {
  margin-bottom: 1.5rem;
}

.search-row {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.search-input-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0 1rem;
  transition: all var(--transition-fast);
}

.search-input-wrapper:focus-within {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-input-wrapper svg {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-input-wrapper input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 0.95rem;
  padding: 0.75rem 0;
}

.search-input-wrapper input::placeholder {
  color: var(--text-muted);
}

.filter-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: flex-end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 160px;
}

.filter-group label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.filter-group select {
  padding: 0.55rem 0.75rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  appearance: auto;
}

.filter-group select:focus {
  border-color: var(--accent-blue);
}

.filter-group select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* ============================================
   Results
   ============================================ */
.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

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

/* ============================================
   Customer Table
   ============================================ */
.customer-table-wrapper {
  padding: 0;
  overflow: hidden;
}

.customer-table {
  width: 100%;
  border-collapse: collapse;
}

.customer-table thead th {
  background: rgba(255, 255, 255, 0.03);
  padding: 0.85rem 1rem;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.customer-table tbody tr {
  border-bottom: 1px solid var(--border-color);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.customer-table tbody tr:last-child {
  border-bottom: none;
}

.customer-table tbody tr:hover {
  background: rgba(59, 130, 246, 0.04);
}

.customer-table tbody td {
  padding: 0.85rem 1rem;
  font-size: 0.88rem;
  vertical-align: middle;
}

.plate-number {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.7rem;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.15);
  border-radius: var(--radius-sm);
  font-weight: 600;
  color: var(--accent-blue);
  font-size: 0.88rem;
  letter-spacing: 0.02em;
}

.customer-name {
  font-weight: 500;
  color: var(--text-primary);
}

.car-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.car-brand {
  font-weight: 600;
  font-size: 0.85rem;
}

.car-series {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.car-type-badge {
  display: inline-flex;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(139, 92, 246, 0.1);
  color: var(--accent-purple);
  border: 1px solid rgba(139, 92, 246, 0.15);
}

.phone-number {
  color: var(--accent-emerald);
  font-weight: 500;
}

.province-name {
  color: var(--text-secondary);
}

.date-text {
  color: var(--text-muted);
  font-size: 0.82rem;
}

/* ============================================
   Empty & Loading States
   ============================================ */
.empty-state,
.loading-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.empty-state svg {
  color: var(--text-muted);
  opacity: 0.3;
  margin-bottom: 1rem;
}

.empty-state p {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
}

.empty-state span {
  font-size: 0.85rem;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border-color);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

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

.loading-state p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ============================================
   Pagination
   ============================================ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.pagination button {
  padding: 0.5rem 0.85rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-primary);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.pagination button:hover:not(:disabled) {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.05);
}

.pagination button.active {
  background: var(--gradient-blue);
  border-color: transparent;
  color: white;
  font-weight: 600;
}

.pagination button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.pagination .page-info {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 0 0.5rem;
}

/* ============================================
   Modal
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  padding: 2rem;
  overflow-y: auto;
}

.modal-overlay.active {
  display: flex;
  animation: fadeIn 0.2s ease;
}

.modal {
  width: 100%;
  max-width: 850px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease;
  margin: auto 0;
}

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

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

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.4rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.modal-close:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.modal-close svg {
  width: 20px;
  height: 20px;
}

.modal-body {
  padding: 1.5rem;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-body::-webkit-scrollbar {
  width: 6px;
}

.modal-body::-webkit-scrollbar-track {
  background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

/* Detail Sections */
.detail-section {
  margin-bottom: 2rem;
}

.detail-section:last-child {
  margin-bottom: 0;
}

.detail-section h4 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  border-radius: 12px;
  background: var(--accent-blue);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  margin-left: 0.5rem;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.detail-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.detail-value {
  font-size: 0.95rem;
  color: var(--text-primary);
  font-weight: 500;
}

.detail-value.highlight {
  color: var(--accent-blue);
  font-weight: 700;
  font-size: 1.1rem;
}

.detail-value.phone {
  color: var(--accent-emerald);
}

/* ============================================
   History Timeline
   ============================================ */
.history-loading {
  text-align: center;
  padding: 2rem;
}

.history-timeline {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.history-empty {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.history-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all var(--transition-fast);
}

.history-card:hover {
  border-color: var(--border-hover);
}

.history-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.1rem;
  cursor: pointer;
  gap: 1rem;
}

.history-card-header:hover {
  background: rgba(255, 255, 255, 0.02);
}

.history-date-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  color: var(--accent-blue);
  font-size: 0.9rem;
  white-space: nowrap;
}

.history-date-badge svg {
  width: 16px;
  height: 16px;
  opacity: 0.7;
}

.history-total {
  font-weight: 700;
  color: var(--accent-emerald);
  font-size: 0.95rem;
  white-space: nowrap;
}

.history-items {
  display: none;
  border-top: 1px solid var(--border-color);
}

.history-items.open {
  display: block;
  animation: fadeIn 0.2s ease;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1.1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  font-size: 0.85rem;
  gap: 1rem;
}

.history-item:last-child {
  border-bottom: none;
}

.history-item-name {
  flex: 1;
  color: var(--text-secondary);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item-code {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  flex-shrink: 0;
}

.history-item-qty {
  color: var(--text-muted);
  font-size: 0.82rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.history-item-price {
  color: var(--accent-amber);
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 80px;
  text-align: right;
}

.history-expand-icon {
  transition: transform var(--transition-fast);
  color: var(--text-muted);
  flex-shrink: 0;
}

.history-expand-icon.open {
  transform: rotate(180deg);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .menu-toggle {
    display: block;
  }

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

  .filter-row {
    flex-direction: column;
    gap: 0.75rem;
  }

  .filter-group {
    min-width: 100%;
  }
}

@media (max-width: 640px) {
  .page {
    padding: 1rem;
  }

  .top-header {
    padding: 0.75rem 1rem;
  }

  .header-search kbd {
    display: none;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .customer-table {
    font-size: 0.82rem;
  }

  .customer-table thead th,
  .customer-table tbody td {
    padding: 0.7rem 0.6rem;
  }

  /* Hide some columns on mobile */
  .customer-table th:nth-child(4),
  .customer-table td:nth-child(4),
  .customer-table th:nth-child(6),
  .customer-table td:nth-child(6),
  .customer-table th:nth-child(7),
  .customer-table td:nth-child(7) {
    display: none;
  }

  .modal {
    border-radius: var(--radius-lg);
    margin: 1rem;
  }

  .modal-body {
    padding: 1rem;
  }

  .detail-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* Selection */
::selection {
  background: rgba(59, 130, 246, 0.3);
  color: white;
}
