/* =========================================
   DESIGN SYSTEM & VARIABLES
========================================= */
:root {
  /* Colors - Dark theme (default) */
  --bg-main: #0a0a0f;
  --bg-secondary: #13131a;
  --bg-card: rgba(255, 255, 255, 0.03);
  --text-main: #f0f0f5;
  --text-muted: #9494a0;
  --accent-primary: #6c63ff;
  --accent-hover: #5a52d5;
  --accent-gradient: linear-gradient(135deg, #6c63ff 0%, #b845ff 100%);
  --success: #00d287;
  --danger: #ff4757;
  --warning: #ffa502;
  --glass-border: rgba(255, 255, 255, 0.05);
  --img-bg: #ffffff;
  --navbar-bg: rgba(10, 10, 15, 0.8);
  --input-bg: rgba(255, 255, 255, 0.05);
  --input-border: rgba(255, 255, 255, 0.1);

  /* Shadows */
  --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 10px 20px rgba(0, 0, 0, 0.2);
  --shadow-glow: 0 0 20px rgba(108, 99, 255, 0.3);

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  /* Transitions */
  --transition: all 0.3s ease;
}

/* Light theme */
[data-theme="light"] {
  --bg-main: #f5f5fa;
  --bg-secondary: #ffffff;
  --bg-card: rgba(0, 0, 0, 0.02);
  --text-main: #1a1a2e;
  --text-muted: #5a5a6e;
  --accent-primary: #5a52d5;
  --accent-hover: #4840b0;
  --accent-gradient: linear-gradient(135deg, #5a52d5 0%, #9b45d5 100%);
  --glass-border: rgba(0, 0, 0, 0.08);
  --img-bg: #f0f0f5;
  --navbar-bg: rgba(255, 255, 255, 0.9);
  --input-bg: rgba(0, 0, 0, 0.03);
  --input-border: rgba(0, 0, 0, 0.12);
  --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 10px 20px rgba(0, 0, 0, 0.08);
  --shadow-glow: 0 0 20px rgba(90, 82, 213, 0.15);
}

/* =========================================
   BASE STYLES
========================================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: hidden;
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: var(--transition);
}

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

ul {
  list-style: none;
}

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

.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

/* =========================================
   TYPOGRAPHY
========================================= */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1rem;
}

.text-gradient {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.section-title {
  font-size: 2rem;
  margin-bottom: 2rem;
  text-align: center;
}

/* =========================================
   BUTTONS & INPUTS
========================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  font-family: inherit;
  font-size: 1rem;
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 30px rgba(108, 99, 255, 0.5);
  color: white;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--accent-primary);
  color: var(--text-main);
}

.btn-outline:hover {
  background: var(--accent-primary);
  color: white;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.btn-block {
  width: 100%;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-muted);
}

.form-control {
  width: 100%;
  padding: 0.8rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: inherit;
  font-size: 1rem;
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.1);
}

/* =========================================
   NAVBAR
========================================= */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--navbar-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--glass-border);
  padding: 1rem 0;
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
}

.navbar-logo {
  height: 36px;
}

.brand-accent {
  color: var(--accent-primary);
}

.navbar-search {
  flex: 1;
  max-width: 500px;
}

.search-form {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 1rem;
  color: var(--text-muted);
}

.search-input {
  width: 100%;
  padding: 0.8rem 1rem 0.8rem 2.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  color: var(--text-main);
  transition: var(--transition);
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  background: var(--input-bg);
}

.search-btn {
  position: absolute;
  right: 0.3rem;
  background: var(--accent-primary);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition);
}

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

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-icon-btn {
  position: relative;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-secondary);
  color: var(--text-main);
  font-size: 1.1rem;
  border: 1px solid var(--glass-border);
  transition: var(--transition);
}

.nav-icon-btn:hover {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
  transform: translateY(-2px);
}

.nav-icon-label {
  display: none; /* Only show on mobile menu */
}

.cart-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--danger);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 2px solid var(--bg-main);
}

.burger-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  width: 30px;
  height: 20px;
  position: relative;
  z-index: 1001;
}

.burger-btn span {
  position: absolute;
  width: 100%;
  height: 2px;
  background: var(--text-main);
  transition: var(--transition);
  left: 0;
}

.burger-btn span:nth-child(1) { top: 0; }
.burger-btn span:nth-child(2) { top: 9px; }
.burger-btn span:nth-child(3) { top: 18px; }

.burger-btn.active span:nth-child(1) {
  transform: rotate(45deg);
  top: 9px;
}
.burger-btn.active span:nth-child(2) {
  opacity: 0;
}
.burger-btn.active span:nth-child(3) {
  transform: rotate(-45deg);
  top: 9px;
}

.mobile-menu {
  position: fixed;
  top: 0;
  right: -100%;
  width: 80%;
  max-width: 300px;
  height: 100vh;
  background: var(--bg-secondary);
  padding: 80px 20px 20px;
  transition: var(--transition);
  z-index: 999;
  box-shadow: -10px 0 30px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  gap: 2rem;
  overflow-y: auto;
}

.mobile-menu.active {
  right: 0;
}

.mobile-search {
  display: flex;
  gap: 0.5rem;
}

.mobile-search input {
  flex: 1;
}

.mobile-search button {
  background: var(--accent-primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0 1rem;
}

.mobile-cats, .mobile-links {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.mobile-cats a, .mobile-links a {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-main);
}

.mobile-cats a:hover, .mobile-links a:hover {
  background: var(--accent-primary);
  color: white;
}

/* =========================================
   CATEGORY NAV
========================================= */
.cat-nav {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--glass-border);
  padding: 0.5rem 0;
  overflow-x: auto;
  scrollbar-width: none; /* Firefox */
}

.cat-nav::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.cat-nav-inner {
  display: flex;
  gap: 1rem;
  white-space: nowrap;
}

.cat-nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
}

.cat-nav-link:hover, .cat-nav-link.active {
  background: rgba(108, 99, 255, 0.1);
  color: var(--accent-primary);
}

/* =========================================
   MESSAGES ALERT
========================================= */
.messages-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 1050;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 1rem 1.5rem;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border-left: 4px solid var(--accent-primary);
  box-shadow: var(--shadow-md);
  color: var(--text-main);
  animation: slideInRight 0.3s ease forwards;
  max-width: 350px;
}

.alert-success { border-color: var(--success); }
.alert-error, .alert-danger { border-color: var(--danger); }
.alert-warning { border-color: var(--warning); }
.alert-info { border-color: var(--accent-primary); }

.alert-close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* =========================================
   PRODUCT CARDS
========================================= */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 2rem;
}

.product-card {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  transition: var(--transition);
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.product-card:hover {
  transform: translateY(-5px);
  border-color: rgba(108, 99, 255, 0.3);
  box-shadow: var(--shadow-glow);
}

.product-badges {
  position: absolute;
  top: 1rem;
  left: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 2;
}

.badge {
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-new { background: var(--accent-primary); color: white; }
.badge-sale { background: var(--danger); color: white; }

.product-img-wrap {
  position: relative;
  padding-top: 100%; /* 1:1 aspect ratio */
  margin-bottom: 1rem;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--img-bg);
}

.product-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 1rem;
  transition: var(--transition);
}

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

.wishlist-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--bg-secondary);
  backdrop-filter: blur(4px);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
  transition: var(--transition);
  z-index: 2;
}

.wishlist-btn:hover {
  background: var(--danger);
}

.wishlist-btn.active {
  color: var(--danger);
}

.product-cat {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.product-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  flex-grow: 1;
}

.product-title a {
  color: var(--text-main);
}

.product-title a:hover {
  color: var(--accent-primary);
}

.product-rating {
  color: var(--warning);
  font-size: 0.8rem;
  margin-bottom: 1rem;
}

.product-rating span {
  color: var(--text-muted);
  margin-left: 0.3rem;
}

.product-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}

.product-price {
  display: flex;
  flex-direction: column;
}

.price-current {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent-primary);
}

.price-old {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-decoration: line-through;
}

.add-to-cart-btn {
  background: var(--input-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.add-to-cart-btn:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}

/* =========================================
   FOOTER
========================================= */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--glass-border);
  padding: 4rem 0 2rem;
  margin-top: 4rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 3rem;
  margin-bottom: 3rem;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 1rem;
}

.footer-brand p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.social-links {
  display: flex;
  gap: 1rem;
}

.social-link {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--input-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
  border: 1px solid var(--glass-border);
}

.social-link:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  transform: translateY(-3px);
}

.footer-col h4 {
  font-size: 1.2rem;
  margin-bottom: 1.5rem;
  position: relative;
  padding-bottom: 0.5rem;
}

.footer-col h4::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 40px;
  height: 2px;
  background: var(--accent-primary);
}

.footer-col a, .footer-col p {
  display: block;
  color: var(--text-muted);
  margin-bottom: 0.8rem;
}

.footer-col a:hover {
  color: var(--accent-primary);
  padding-left: 5px;
}

.footer-col p i {
  width: 20px;
  color: var(--accent-primary);
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 2rem;
  border-top: 1px solid var(--glass-border);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-pay {
  display: flex;
  gap: 1rem;
  font-size: 1.5rem;
  color: var(--text-muted);
}

/* =========================================
   FLOAT CHAT & SCROLL TOP
========================================= */
.float-chat-btn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: var(--shadow-glow);
  z-index: 99;
  animation: pulse 2s infinite;
}

.float-chat-btn:hover {
  transform: scale(1.1);
  color: white;
  animation: none;
}

.float-chat-tooltip {
  position: absolute;
  right: 75px;
  background: var(--bg-secondary);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  border: 1px solid var(--glass-border);
}

.float-chat-btn:hover .float-chat-tooltip {
  opacity: 1;
  visibility: visible;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(108, 99, 255, 0.4); }
  70% { box-shadow: 0 0 0 15px rgba(108, 99, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(108, 99, 255, 0); }
}

.scroll-top-btn {
  position: fixed;
  bottom: 100px;
  right: 30px;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  background: var(--bg-secondary);
  color: var(--text-main);
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  z-index: 98;
}

.scroll-top-btn.visible {
  opacity: 1;
  visibility: visible;
}

.scroll-top-btn:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}

/* =========================================
   RESPONSIVE
========================================= */
@media (max-width: 992px) {
  .navbar-search { display: none; }
  .burger-btn { display: block; }
  .nav-icon-btn { display: none; }
  .cart-btn { display: flex; } /* Keep cart visible */
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .products-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; gap: 1rem; text-align: center; }
}

/* =========================================
   THEME TOGGLE
========================================= */
.theme-toggle {
  background: none;
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  font-size: 1.1rem;
}

.theme-toggle:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.theme-toggle .fa-sun { display: none; }
.theme-toggle .fa-moon { display: inline; }
[data-theme="light"] .theme-toggle .fa-sun { display: inline; }
[data-theme="light"] .theme-toggle .fa-moon { display: none; }

/* Light theme specific overrides */
[data-theme="light"] .mobile-menu {
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .mobile-cats a,
[data-theme="light"] .mobile-links a {
  background: rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .search-input:focus {
  background: rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .product-card {
  border-color: rgba(0, 0, 0, 0.08);
  background: var(--bg-secondary);
}

[data-theme="light"] .footer {
  background: #1a1a2e;
  color: #f0f0f5;
}

[data-theme="light"] .footer a,
[data-theme="light"] .footer p,
[data-theme="light"] .footer h4 {
  color: #f0f0f5;
}

[data-theme="light"] .footer-col a,
[data-theme="light"] .footer-col p {
  color: #9494a0;
}

[data-theme="light"] .alert {
  background: var(--bg-secondary);
  border-color: var(--glass-border);
}
