/* ===== Variables ===== */
:root {
  --primary: #4F46E5;
  --primary-dark: #4338CA;
  --secondary: #EC4899;
  --accent: #F59E0B;
  --success: #10B981;
  --danger: #EF4444;
  --dark: #1F2937;
  --dark-light: #374151;
  --gray: #9CA3AF;
  --light-gray: #D1D5DB;
  --bg: #F9FAFB;
  --card-bg: #FFFFFF;
  --text: #111827;
  --text-light: #6B7280;
  --border: #E5E7EB;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --radius: 8px;
  --radius-lg: 12px;
  --transition: all 0.2s ease;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== Layout ===== */
.container {
  width: min(90%, 1240px);
  margin-inline: auto;
}

.header {
  background: var(--card-bg);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}

.logo-text {
  color: var(--primary);
  font-weight: 700;
}

.nav {
  display: flex;
  align-items: center;
}

.nav-list {
  display: flex;
  list-style: none;
  gap: 1.25rem;
}

.nav-link {
  text-decoration: none;
  color: var(--dark-light);
  font-weight: 500;
  font-size: 0.95rem;
  transition: var(--transition);
  padding: 0.5rem 0;
  position: relative;
}

.nav-link:hover, .nav-link.active {
  color: var(--primary);
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--primary);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}

.hamburger, .hamburger::before, .hamburger::after {
  content: '';
  display: block;
  width: 24px;
  height: 2px;
  background: var(--dark);
  transition: var(--transition);
  border-radius: 2px;
}

.hamburger::before, .hamburger::after {
  margin-top: 6px;
}

.main {
  flex: 1;
  padding: 1.5rem 0;
}

.footer {
  background: var(--dark);
  color: var(--light-gray);
  padding: 2rem 0 1rem;
  margin-top: auto;
}

.footer-inner {
  flex-direction: column;
  gap: 1.5rem;
  text-align: center;
}

.footer-brand .logo-text {
  color: var(--card-bg);
}

.footer-tagline {
  color: var(--gray);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-links a {
  color: var(--light-gray);
  text-decoration: none;
  transition: var(--transition);
}

.footer-links a:hover {
  color: var(--accent);
}

.footer-copy {
  font-size: 0.75rem;
  color: var(--gray);
}

/* ===== Cards ===== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

.card-header {
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--dark);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius);
  padding: 0.625rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  gap: 0.5rem;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--secondary);
  color: #fff;
}

.btn-secondary:hover {
  opacity: 0.9;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--dark);
}

.btn-outline:hover {
  background: var(--bg);
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 0.875rem 1.75rem;
  font-size: 1.05rem;
}

/* ===== Grid ===== */
.grid {
  display: grid;
  gap: 1.5rem;
}

.grid-2 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

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

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.375rem;
  color: var(--dark);
}

.form-control {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  transition: var(--transition);
  background: var(--card-bg);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* ===== Search ===== */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box input {
  width: 100%;
  padding: 0.625rem 2.75rem 0.625rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
}

.search-box .search-icon {
  position: absolute;
  right: 0.75rem;
  color: var(--gray);
  font-size: 1.1rem;
}

/* ===== Product Card ===== */
.product-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}

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

.product-image {
  width: 100;
  height: 200px;
  background: linear-gradient(135deg, #E0E7FF, #C7D2FE);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.product-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.375rem;
  color: var(--dark);
}

.product-description {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 0.75rem;
  flex: 1;
}

.product-price {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 1rem;
}

.product-actions {
  display: flex;
  gap: 0.5rem;
}

/* ===== Category Card ===== */
.category-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-align: center;
  box-shadow: var(--shadow);
  transition: var(--transition);
  cursor: pointer;
}

.category-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  background: linear-gradient(135deg, #EEF2FF, var(--card-bg));
}

.category-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

.category-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--dark);
}

/* ===== Auth Pages ===== */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #EEF2FF, #F0F9FF);
  padding: 2rem;
}

.auth-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow-lg);
  max-width: 400px;
  width: 100%;
}

.auth-card h1 {
  font-size: 1.75rem;
  text-align: center;
  margin-bottom: 1.5rem;
  color: var(--primary);
}

.auth-form .form-group {
  margin-bottom: 1rem;
}

.auth-footer {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.9rem;
}

.auth-footer a {
  color: var(--primary);
  text-decoration: none;
}

.auth-footer a:hover {
  text-decoration: underline;
}

/* ===== Orders ===== */
.order-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
  border-left: 4px solid var(--primary);
}

.order-card.pending { border-left-color: var(--accent); }
.order-card.processing { border-left-color: var(--primary); }
.order-card.completed { border-left-color: var(--success); }
.order-card.cancelled { border-left-color: var(--danger); }

.order-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.order-id {
  font-weight: 600;
  color: var(--dark);
  font-size: 0.95rem;
}

.order-status {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  text-transform: uppercase;
}

.order-status.pending { background: #FEF3C7; color: #92400E; }
.order-status.processing { background: #E0E7FF; color: #373787; }
.order-status.completed { background: #D1FAE5; color: #065F46; }
.order-status.cancelled { background: #FEE2E2; color: #991B1B; }

.order-items {
  margin: 0.75rem 0;
}

.order-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--border);
}

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

.order-total {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--primary);
  margin-top: 0.75rem;
  text-align: right;
}

.order-date {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-bottom: 0.75rem;
}

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

.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 0.25rem;
}

/* ===== Settings ===== */
.settings-section {
  margin-bottom: 2rem;
}

.settings-section h2 {
  font-size: 1.25rem;
  color: var(--dark);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 2rem;
  font-weight: 700;
}

.profile-info {
  flex: 1;
}

.profile-info h3 { font-size: 1.2rem; }
.profile-info p { color: var(--text-light); font-size: 0.9rem; }

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--border);
}

.setting-row:last-child { border-bottom: none; }

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--gray);
  border-radius: 26px;
  transition: var(--transition);
}

.toggle-slider:before {
  content: '';
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: var(--transition);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--primary);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(24px);
}

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

.empty-state svg { font-size: 3rem; margin-bottom: 1rem; opacity: 0.3; }

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--dark);
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  transform: translateX(400px);
  transition: transform 0.3s ease;
  z-index: 1000;
}

.toast.show { transform: translateX(0); }

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* ===== Badges ===== */
.badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 999px;
  text-transform: uppercase;
}

.badge-primary { background: var(--primary); color: #fff; }
.badge-secondary { background: var(--secondary); color: #fff; }
.badge-accent { background: var(--accent); color: #fff; }
.badge-outline { background: transparent; border: 1px solid var(--border); color: var(--text-light); }

/* ===== Spinner ===== */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--light-gray);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .nav-list {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--card-bg);
    flex-direction: column;
    gap: 0;
    width: 200px;
    padding: 0.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    transform: scale(0);
    transform-origin: top right;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
  }

  .nav-list.open {
    transform: scale(1);
    opacity: 1;
    visibility: visible;
  }

  .nav-list .nav-item {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border);
  }

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

  .nav-toggle {
    display: block;
  }

  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .auth-card { padding: 1.75rem; }
}

@media (max-width: 480px) {
  .header-inner { flex-direction: column; gap: 0.75rem; }
  .grid-4 { grid-template-columns: 1fr; }
}

/* ===== Page Transitions ===== */
.page-enter {
  opacity: 0;
  transform: translateY(20px);
}

.page-enter-active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* ===== Hero ===== */
.hero {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  text-align: center;
  margin-bottom: 2rem;
}

.hero-content h1 {
  font-size: 2.25rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.hero-content p {
  font-size: 1.1rem;
  opacity: 0.9;
  margin-bottom: 1.5rem;
  max-width: 640px;
  margin-inline: auto;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ===== Sections ===== */
.section {
  margin-bottom: 2.5rem;
}

.section-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 0.5rem;
}

.section-subtitle {
  color: var(--text-light);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

/* ===== Categories ===== */
.category-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1rem;
  text-align: center;
  box-shadow: var(--shadow);
  transition: var(--transition);
  cursor: pointer;
  border: 2px solid transparent;
}

.category-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.category-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

.category-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--dark);
}

.category-desc {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 0.25rem;
}

.category-btn {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.category-btn:hover {
  background: var(--primary);
  color: #fff;
}

.category-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ===== Placeholder ===== */
.placeholder-icon {
  opacity: 0.3;
  font-size: 3rem;
}

/* ===== Auth ===== */
.auth-page {
  min-height: calc(100vh - 200px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #EEF2FF, #F0F9FF);
  padding: 2rem;
}

.auth-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow-lg);
  max-width: 400px;
  width: 100%;
}

.auth-card h1 {
  font-size: 1.75rem;
  text-align: center;
  margin-bottom: 1.5rem;
  color: var(--primary);
}

.auth-form .form-group {
  margin-bottom: 1rem;
}

.auth-footer {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.9rem;
}

.auth-footer a {
  color: var(--primary);
  text-decoration: none;
}

.auth-footer a:hover {
  text-decoration: underline;
}

.auth-error {
  background: #FEE2E2;
  color: #991B1B;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.85rem;
  text-align: center;
  visibility: visible;
  height: auto;
}

/* ===== Modal ===== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal-content {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  max-width: 500px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

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

.modal-header h3 {
  font-size: 1.25rem;
  color: var(--dark);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--gray);
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
}

/* ===== Utility ===== */
.text-small {
  font-size: 0.75rem;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  opacity: 0.9;
}

/* ===== Product Image ===== */
.product-image {
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, #E0E7FF, #C7D2FE);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

