:root {
  --primary: #0f172a; /* Deep Slate */
  --primary-hover: #1e293b;
  --primary-dark: #020617; /* Darker Slate for gradients/nav */
  --accent: #e11d48; /* Crimson Red / Premium Accent */
  --accent-hover: #be123c;
  --bg-color: #f8fafc; /* Very light slate */
  --surface-color: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  
  --shadow-soft: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
  --shadow-hover: 0 10px 30px -5px rgba(0, 0, 0, 0.1);
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.3);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Poppins', sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Glassmorphism Header */
.main-header {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-soft);
}

.top-header {
  background: var(--primary);
  color: #e2e8f0;
  padding: 0.4rem 2rem;
  font-size: 0.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 300;
  letter-spacing: 0.5px;
}

.top-header a {
  color: #cbd5e1;
  text-decoration: none;
  margin-left: 1.5rem;
  transition: color 0.3s;
}

.top-header a:hover { color: #fff; }

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.2rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 3rem;
}

.logo {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  letter-spacing: -0.5px;
}
.logo span { color: var(--accent); }

/* Premium Search Bar */
.search-bar {
  flex: 1;
  max-width: 600px;
  position: relative;
  display: flex;
  align-items: center;
}

.search-bar i {
  position: absolute;
  left: 1rem;
  color: var(--text-muted);
  font-size: 1.2rem;
}

.search-bar input {
  width: 100%;
  padding: 0.8rem 1rem 0.8rem 3rem;
  border: 2px solid transparent;
  background-color: #f1f5f9;
  border-radius: 99px; /* Pill shape */
  outline: none;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  font-family: 'Poppins', sans-serif;
}

.search-bar input:focus {
  border-color: var(--accent);
  background-color: #fff;
  box-shadow: 0 0 0 4px rgba(225, 29, 72, 0.1);
}

.search-bar button {
  position: absolute;
  right: 0.5rem;
  padding: 0.5rem 1.2rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 99px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  transition: all 0.3s;
}

.search-bar button:hover { background: var(--accent-hover); }

/* Nav Actions */
.nav-actions {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}
.nav-actions button, .nav-actions a {
  color: var(--text-main);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  background: none; border: none; cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: color 0.3s;
}
.nav-actions button:hover, .nav-actions a:hover {
  color: var(--accent);
}
.nav-actions i { font-size: 1.5rem; }

.cart-btn { position: relative; }
.cart-badge {
  position: absolute;
  top: -8px;
  right: -10px;
  background: var(--accent);
  color: white;
  border-radius: 99px;
  padding: 0.15rem 0.4rem;
  font-size: 0.7rem;
  font-weight: 700;
  border: 2px solid var(--surface-color);
}

.cat-nav {
  border-top: 1px solid var(--border);
}
.cat-nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  gap: 2.5rem;
}
.cat-nav a {
  padding: 1rem 0;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  border-bottom: 2px solid transparent;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.cat-nav a:hover {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* WOW Hero Section */
.hero {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 2rem;
}
.hero-banner {
  background: linear-gradient(135deg, #0f172a 0%, #334155 100%);
  border-radius: 20px;
  color: white;
  padding: 5rem 4rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-hover);
}
/* Abstract shape overlay */
.hero-banner::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(225,29,72,0.4) 0%, rgba(0,0,0,0) 70%);
  border-radius: 50%;
  z-index: 1;
}
.hero-content {
  position: relative;
  z-index: 2;
  max-width: 600px;
}
.hero-badge {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  padding: 0.4rem 1rem;
  border-radius: 99px;
  font-size: 0.85rem;
  display: inline-block;
  margin-bottom: 1rem;
  backdrop-filter: blur(4px);
  color: #fca5a5;
  font-weight: 600;
}
.hero-banner h1 {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 1.2rem;
}
.hero-banner p {
  font-size: 1.1rem;
  opacity: 0.9;
  margin-bottom: 2.5rem;
  font-weight: 300;
}

/* Pulse Button Animation */
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(225, 29, 72, 0.7); }
  70% { box-shadow: 0 0 0 15px rgba(225, 29, 72, 0); }
  100% { box-shadow: 0 0 0 0 rgba(225, 29, 72, 0); }
}
.btn-pulse {
  background: var(--accent);
  color: white;
  padding: 1rem 2.5rem;
  border-radius: 99px;
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  display: inline-block;
  animation: pulse 2s infinite;
  transition: transform 0.3s, background 0.3s;
}
.btn-pulse:hover {
  background: var(--accent-hover);
  transform: translateY(-3px);
  animation: none;
}

/* Products Grid - Soft UI */
.products-section {
  max-width: 1200px;
  margin: 0 auto 4rem;
  padding: 0 2rem;
}
.section-title {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 2rem;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 2rem;
}
.card {
  background-color: var(--surface-color);
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Bouncy hover */
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  border: 1px solid var(--border);
}
.card:hover {
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  transform: translateY(-8px);
}
.product-img-wrapper {
  width: 100%;
  height: 220px;
  padding: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, #ffffff 0%, #f1f5f9 100%);
  position: relative;
}
.product-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.5s;
}
.card:hover .product-img {
  transform: scale(1.1);
}
.category-tag {
  background: rgba(255,255,255,0.9);
  padding: 0.3rem 0.8rem;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(4px);
  z-index: 2;
  display: inline-block;
  border: 1px solid var(--border);
}

.card .category-tag {
  position: absolute;
  top: 1rem;
  left: 1rem;
  border: none;
}

.card-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  position: relative;
}
.card-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.4;
  margin-bottom: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-price {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent);
  margin-top: auto;
}
.card-stock {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* Slide Up Button on Hover -> Changed to static for clarity */
.add-to-cart-wrapper {
  margin-top: 1rem;
  width: 100%;
}
.btn-cart {
  width: 100%;
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.8rem;
  border-radius: 8px;
  font-weight: 600;
  font-family: 'Poppins', sans-serif;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}
.btn-cart:hover { background: var(--accent); }
.btn-cart:disabled {
  background: #cbd5e1;
  color: #64748b;
  cursor: not-allowed;
}
.btn-cart i { font-size: 1.2rem; }

/* General Buttons */
.btn {
  display: inline-block;
  padding: 0.6rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
}
.btn-primary { background-color: var(--primary); color: white; }
.btn-primary:hover { background-color: var(--primary-hover); }

/* Footer */
footer {
  margin-top: auto;
  background: #020617; /* Very dark slate */
  color: #94a3b8;
  padding: 5rem 2rem 2rem;
  border-top: 4px solid var(--accent);
}
.footer-grid {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 3rem;
  margin-bottom: 4rem;
}
.footer-col h4 {
  color: white;
  margin-bottom: 1.5rem;
  font-size: 1.2rem;
  font-weight: 600;
}
.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 0.8rem; }
.footer-col a {
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.3s;
}
.footer-col a:hover { color: white; padding-left: 5px; } /* subtle shift on hover */
.footer-bottom {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
  padding-top: 2rem;
  border-top: 1px solid #1e293b;
  font-size: 0.9rem;
}

/* Keep old Admin Styles Intact */
.admin-layout { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { background-color: var(--surface-color); border-right: 1px solid var(--border); padding: 2rem 1rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 50; }
.sidebar-nav { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 2rem; }
.sidebar-nav a { padding: 0.75rem 1rem; border-radius: 0.5rem; color: var(--text-muted); text-decoration: none; transition: all 0.2s; }
.sidebar-nav a:hover, .sidebar-nav a.active { background-color: #f1f5f9; color: var(--primary); }
.admin-main { padding: 2rem; }
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; }
.data-table { width: 100%; min-width: 800px; border-collapse: collapse; background-color: var(--surface-color); border-radius: 0.5rem; overflow: hidden; border: 1px solid var(--border); }
.data-table th, .data-table td { padding: 1rem; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table th { background-color: #f8fafc; font-weight: 600; color: var(--text-muted); }
.data-table tr:last-child td { border-bottom: none; }
.action-btns { display: flex; gap: 0.5rem; }
.btn-sm { padding: 0.25rem 0.5rem; font-size: 0.875rem; border-radius: 0.25rem; }
.btn-danger { background-color: #e11d48; color: white; }
.btn-danger:hover { background-color: #be123c; }
.form-group { margin-bottom: 1.5rem; }
.form-label { display: block; margin-bottom: 0.5rem; color: var(--text-muted); font-weight: 500; }
.form-control { width: 100%; padding: 0.75rem; background-color: #f8fafc; border: 1px solid var(--border); border-radius: 8px; color: var(--text-main); font-family: 'Poppins', sans-serif; }
.form-control:focus { outline: none; border-color: var(--primary); }
.login-card { max-width: 400px; margin: 10vh auto; background-color: var(--surface-color); padding: 2.5rem; border-radius: 16px; border: 1px solid var(--border); box-shadow: var(--shadow-hover); }

/* Mobile & Responsive Utilities */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Sidebar Toggle for Mobile Admin */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 999;
}
.sidebar-overlay.active { display: block; }

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--primary);
  cursor: pointer;
  padding: 0.5rem;
}

@media (max-width: 768px) {
  /* Prevent horizontal page panning */
  body { overflow-x: hidden; width: 100%; }
  
  /* Admin adjustments */
  .admin-main { padding: 1rem; max-width: 100vw; box-sizing: border-box; }
  
  /* Responsive Tables as Cards */
  .data-table, .data-table tbody, .data-table tr, .data-table td {
    display: block; width: 100%; box-sizing: border-box; min-width: 0 !important; white-space: normal !important;
  }
  .data-table thead { display: none; }
  .data-table tr { margin-bottom: 1rem; border: 1px solid var(--border); border-radius: 8px; }
  .data-table td {
    text-align: right; padding-left: 50%; position: relative; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; align-items: flex-end; justify-content: center; min-height: 48px;
  }
  .data-table td::before {
    content: attr(data-label); position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); width: 45%; text-align: left; font-weight: 600; color: var(--text-muted);
  }
  .data-table td:last-child { border-bottom: none; }
  .table-responsive { overflow-x: visible; }
  
  /* Enlarge images inside mobile tables */
  .data-table td[data-label="Foto"] img, .data-table td[data-label="Produk"] img {
    width: 80px !important; height: 80px !important; margin: 0.5rem 0;
  }
  .data-table td[data-label="Foto"]::before, .data-table td[data-label="Produk"]::before {
    top: 50%; transform: translateY(-50%);
  }

  
  /* Storefront Header adjustments */
  .top-header { flex-direction: column; gap: 0.5rem; text-align: center; padding: 0.5rem; }
  .header-container { flex-direction: column; gap: 1rem; padding: 1rem; }
  .search-bar { width: 100%; }
  
  /* Horizontal scroll for category nav */
  .cat-nav ul { 
    flex-wrap: nowrap; 
    overflow-x: auto; 
    padding-bottom: 0.5rem; 
    -webkit-overflow-scrolling: touch;
    justify-content: flex-start;
  }
  .cat-nav li { white-space: nowrap; }

  /* Hero banner & Pulse button */
  .hero-banner { padding: 3rem 1.5rem; text-align: center; }
  .hero-banner h1 { font-size: 2rem; }
  .btn-pulse { align-self: center; }
  
  /* Admin Sidebar Off-canvas */
  .mobile-menu-btn { display: block; }
  .admin-layout { grid-template-columns: 1fr; }
  
  .sidebar { 
    position: fixed; 
    top: 0; 
    left: -280px; 
    width: 250px; 
    height: 100vh; 
    z-index: 1000; 
    transition: left 0.3s ease;
    box-shadow: var(--shadow-hover);
  }
  .sidebar.active { left: 0; }
  
  /* Make side-by-side elements stack */
  .card-row, .flex-row-mobile { flex-direction: column; }
}

@media print {
  /* Hide UI elements not meant for printing */
  .top-header, .main-header, .cat-nav, footer, button, .btn, .btn-outline-secondary, .cart-btn, .order-stepper {
    display: none !important;
  }
  
  /* Reset background and sizing for A4 printing */
  body, main {
    background: white !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 12pt;
    color: black;
  }
  
  /* Remove box shadows and borders from containers to make them clean */
  .card, .checkout-container {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  
  /* Ensure colors print correctly (like the green success icon) */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Add corporate letterhead and stamp layout to print elements */
  .print-only {
    display: block !important;
  }

  .no-print {
    display: none !important;
  }

  /* Force page breaks if necessary */
  .page-break {
    page-break-before: always;
  }
}

/* Slide-out Cart Sidebar */
.cart-sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
}

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

.cart-sidebar {
  position: fixed;
  top: 0;
  right: -400px;
  width: 100%;
  max-width: 400px;
  height: 100%;
  background: white;
  z-index: 1001;
  box-shadow: -5px 0 15px rgba(0,0,0,0.1);
  transition: right 0.3s ease;
  display: flex;
  flex-direction: column;
}

.cart-sidebar.active {
  right: 0;
}

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

.cart-sidebar-body {
  padding: 1.5rem;
  flex: 1;
  overflow-y: auto;
}

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

/* Mega Menu Styles */
.mega-menu-trigger:hover .mega-menu {
  display: flex !important;
  animation: fadeIn 0.2s ease-out forwards;
}
.mega-menu-trigger:hover > a {
  color: var(--secondary) !important;
}

.mega-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  transition: all 0.2s;
  display: block;
  padding: 0.2rem 0;
}
.mega-link:hover {
  color: var(--primary);
  transform: translateX(5px);
}

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