/* ===================================
   DESIGN TOKENS & CSS VARIABLES
   =================================== */
:root {
  /* Mango-themed Color Palette */
  --color-primary: #FF9500;
  --color-primary-light: #FFB340;
  --color-primary-dark: #E68600;
  --color-secondary: #34C759;
  --color-secondary-light: #5DD97C;
  --color-secondary-dark: #28A745;

  --color-accent: #FFD60A;
  --color-background: #FFFFFF;
  --color-surface: #F8F9FA;
  --color-text: #1D1D1F;
  --color-text-secondary: #6E6E73;
  --color-border: #E5E5EA;

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #FF9500 0%, #FFD60A 100%);
  --gradient-hero: linear-gradient(135deg, rgba(255, 149, 0, 0.95) 0%, rgba(255, 214, 10, 0.95) 100%);
  --gradient-card: linear-gradient(145deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 249, 250, 0.9) 100%);

  /* Typography */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-heading: 'Outfit', 'Inter', sans-serif;

  /* Spacing */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;
  --spacing-2xl: 4rem;

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.16);
  --shadow-glow: 0 0 40px rgba(255, 149, 0, 0.3);

  /* Transitions */
  --transition-fast: 0.2s ease;
  --transition-base: 0.3s ease;
  --transition-slow: 0.5s ease;
}

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

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

body {
  font-family: var(--font-primary);
  color: var(--color-text);
  background-color: var(--color-background);
  line-height: 1.6;
  overflow-x: hidden;
}

/* ===================================
   TYPOGRAPHY
   =================================== */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: var(--spacing-md);
}

h1 {
  font-size: 3.5rem;
}

h2 {
  font-size: 2.5rem;
}

h3 {
  font-size: 2rem;
}

h4 {
  font-size: 1.5rem;
}

h5 {
  font-size: 1.25rem;
}

h6 {
  font-size: 1rem;
}

p {
  margin-bottom: var(--spacing-sm);
  color: var(--color-text-secondary);
}

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

a:hover {
  color: var(--color-primary-dark);
}

/* ===================================
   NAVIGATION
   =================================== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
  padding: var(--spacing-sm) 0;
  transition: all var(--transition-base);
}

.navbar.scrolled {
  box-shadow: var(--shadow-md);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.logo img {
  height: 40px;
  /* Slightly larger for better visibility */
  width: auto;
  object-fit: contain;
}

.nav-menu {
  display: flex;
  gap: var(--spacing-lg);
  list-style: none;
}

.nav-link {
  color: var(--color-text);
  font-weight: 500;
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.nav-link:hover {
  background: var(--color-surface);
  color: var(--color-primary);
}

.cart-icon {
  position: relative;
  cursor: pointer;
  padding: var(--spacing-xs);
  font-size: 1.5rem;
  /* Standardized size */
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition-fast);
}

.cart-icon:hover {
  transform: scale(1.1);
}

.cart-count {
  position: absolute;
  top: -8px;
  right: -8px;
  background: var(--color-primary);
  color: white;
  border-radius: 50%;
  min-width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
}

/* ===================================
   HERO SECTION
   =================================== */
.hero {
  position: relative;
  min-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-hero);
  overflow: hidden;
  margin-top: 70px;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url('../shared/images/hero-banner.png');
  background-size: cover;
  background-position: center;
  opacity: 0.3;
  z-index: 0;
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  color: white;
  max-width: 800px;
  padding: var(--spacing-xl);
  animation: fadeInUp 1s ease;
}

.hero h1 {
  font-size: 4rem;
  margin-bottom: var(--spacing-md);
  text-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.hero p {
  font-size: 1.5rem;
  margin-bottom: var(--spacing-xl);
  color: rgba(255, 255, 255, 0.95);
}

/* ===================================
   BUTTONS
   =================================== */
.btn {
  display: inline-block;
  padding: var(--spacing-sm) var(--spacing-lg);
  border-radius: var(--radius-md);
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  border: none;
  transition: all var(--transition-base);
  font-size: 1rem;
}

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

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.btn-secondary {
  background: white;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}

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

.btn-large {
  padding: var(--spacing-md) var(--spacing-xl);
  font-size: 1.125rem;
}

/* ===================================
   PRODUCT CARDS
   =================================== */
.products-section {
  padding: var(--spacing-2xl) var(--spacing-md);
  max-width: 1200px;
  margin: 0 auto;
}

.section-title {
  text-align: center;
  margin-bottom: var(--spacing-xl);
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--spacing-lg);
}

.product-card {
  position: relative;
  /* Added for badge positioning */
  background: var(--gradient-card);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  display: flex;
  flex-direction: column;
  height: 100%;
  /* Ensure all cards in a row are same height */
}

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

.product-image {
  width: 100%;
  height: 200px;
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-md);
  background: white;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-image img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 180px;
  /* Leave space for padding */
  object-fit: contain;
  /* Changed back to contain to ensure full product is visible */
  transition: transform var(--transition-base);
}

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

.product-title {
  font-size: 1.5rem;
  margin-bottom: var(--spacing-xs);
  color: var(--color-text);
}

.product-description {
  font-size: 0.95rem;
  margin-bottom: var(--spacing-md);
  color: var(--color-text-secondary);
}

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

.product-stock {
  font-size: 0.875rem;
  margin-bottom: var(--spacing-md);
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  display: inline-block;
}

.badge {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  z-index: 2;
  box-shadow: var(--shadow-sm);
}

.badge-warning {
  background: var(--color-primary);
  color: white;
}

.badge-danger {
  background: #FF3B30;
  color: white;
}

/* ===================================
   PRODUCT INFORMATION
   =================================== */
.product-info {
  padding: var(--spacing-md) 0 0 0;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.product-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: var(--spacing-md);
}

.product-size {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  font-weight: 600;
  margin-bottom: var(--spacing-xs);
}

/* ===================================
   FOOTER
   =================================== */
.footer {
  background: var(--color-text);
  color: white;
  padding: var(--spacing-xl) var(--spacing-md);
  margin-top: var(--spacing-2xl);
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--spacing-lg);
}

.footer-section h3 {
  color: var(--color-primary);
  margin-bottom: var(--spacing-md);
}

.footer-section p,
.footer-section a {
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: var(--spacing-xs);
}

.footer-section a:hover {
  color: var(--color-primary);
}

.footer-bottom {
  text-align: center;
  margin-top: var(--spacing-xl);
  padding-top: var(--spacing-lg);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.6);
}

/* ===================================
   ANIMATIONS
   =================================== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-up {
  animation: fadeInUp 0.8s ease;
}

/* ===================================
   PROFILE BUTTON & DROPDOWN
   =================================== */
.profile-section {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.profile-btn {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-xs) var(--spacing-md);
  border-radius: var(--radius-md);
  background: white;
  color: var(--color-primary);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 2px solid var(--color-primary);
  font-size: 0.9rem;
  box-shadow: var(--shadow-sm);
}

.profile-btn:hover {
  background: var(--gradient-primary);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.profile-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  padding: var(--spacing-sm);
  display: none;
  z-index: 1001;
}

.profile-dropdown.active {
  display: block;
  animation: fadeInUp 0.3s ease;
}

.profile-dropdown-header {
  padding: var(--spacing-sm);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--spacing-xs);
}

.profile-dropdown-header p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--color-text-secondary);
}

.profile-dropdown-header strong {
  color: var(--color-text);
  font-size: 1rem;
}

.profile-dropdown-item {
  display: block;
  padding: var(--spacing-sm);
  color: var(--color-text);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.profile-dropdown-item:hover {
  background: var(--color-surface);
  color: var(--color-primary);
}

.profile-dropdown-item.logout {
  color: #FF3B30;
}

.profile-dropdown-item.logout:hover {
  background: rgba(255, 59, 48, 0.1);
}

/* ===================================
   AUTHENTICATION MODAL
   =================================== */
.auth-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-md);
}

.auth-modal.active {
  display: flex;
}

.auth-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.auth-modal-content {
  position: relative;
  background: white;
  border-radius: var(--radius-xl);
  padding: var(--spacing-xl);
  max-width: 450px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: var(--shadow-lg);
  animation: fadeInUp 0.3s ease;
  z-index: 2001;
  /* Ensure content is above overlay */
}

.auth-modal-close {
  position: absolute;
  top: var(--spacing-md);
  right: var(--spacing-md);
  background: none;
  border: none;
  font-size: 2rem;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: color var(--transition-fast);
  line-height: 1;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-modal-close:hover {
  color: var(--color-text);
}

.auth-tabs {
  display: flex;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-lg);
  border-bottom: 2px solid var(--color-border);
}

.auth-tab {
  flex: 1;
  padding: var(--spacing-sm);
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-bottom: -2px;
}

.auth-tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
  animation: fadeInUp 0.3s ease;
}

.auth-form h2 {
  margin-bottom: var(--spacing-xs);
  color: var(--color-text);
}

.auth-subtitle {
  color: var(--color-text-secondary);
  margin-bottom: var(--spacing-lg);
  font-size: 0.95rem;
}

.form-group {
  margin-bottom: var(--spacing-md);
}

.form-group label {
  display: block;
  margin-bottom: var(--spacing-xs);
  font-weight: 600;
  color: var(--color-text);
  font-size: 0.9rem;
}

.form-group input {
  width: 100%;
  padding: var(--spacing-sm);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: var(--font-primary);
  /* Ensure explicit font match */
  color: var(--color-text);
  /* Ensure explicit color match */
  transition: all var(--transition-fast);
}

.form-group input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(255, 149, 0, 0.1);
}

.form-select {
  width: 100%;
  padding: var(--spacing-sm);
  padding-right: 2.5rem;
  /* Space for arrow */
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: var(--font-primary);
  /* Match input font */
  color: var(--color-text);
  /* Match input color */
  background: white;
  transition: all var(--transition-fast);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;

  /* Modern Chevron Arrow */
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236E6E73' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1rem;
}

.form-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(255, 149, 0, 0.1);
  /* Rotate arrow on focus? Not possible with background-image efficiently without class toggle, keeping simple */
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FF9500' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
}

.phone-group {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
  /* Ensure equal height */
}

.phone-group select {
  width: 135px;
  /* Fixed width as requested indirectly by "good position" comment */
  flex: none;
}

.phone-group input {
  flex: 1;
  width: auto;
  /* Allow flex to control width */
}

.forgot-password {
  font-size: 0.875rem;
  color: var(--color-primary);
  text-decoration: none;
}

.forgot-password:hover {
  text-decoration: underline;
}

.auth-btn {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-lg);
  background: var(--gradient-primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
  margin-top: var(--spacing-sm);
}

.auth-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.auth-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-message {
  margin-top: var(--spacing-sm);
  padding: var(--spacing-sm);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  display: none;
}

.auth-message.success {
  background: rgba(52, 199, 89, 0.1);
  color: var(--color-secondary-dark);
  border: 1px solid var(--color-secondary);
}

.auth-message.error {
  background: rgba(255, 59, 48, 0.1);
  color: #FF3B30;
  border: 1px solid #FF3B30;
}

/* ===================================
   HIDE NUMBER INPUT SPINNERS
   =================================== */
/* Chrome, Safari, Edge, Opera */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Firefox */
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* ===================================
   RESPONSIVE DESIGN
   =================================== */
@media (max-width: 768px) {
  h1 {
    font-size: 2.5rem;
  }

  h2 {
    font-size: 2rem;
  }

  .hero h1 {
    font-size: 2.5rem;
  }

  .hero p {
    font-size: 1.125rem;
  }

  .nav-menu {
    display: none;
  }

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

  .footer-content {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  :root {
    font-size: 14px;
  }

  .hero {
    min-height: 70vh;
  }
}

/* ===================================
   TOAST NOTIFICATIONS
   =================================== */
.toast-notification {
  position: fixed;
  top: 2rem;
  right: 2rem;
  background: white;
  padding: 1rem 1.5rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  z-index: 20000;
  transform: translateX(120%);
  transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  font-family: var(--font-primary);
  font-weight: 500;
  border-left: 4px solid var(--color-primary);
  min-width: 300px;
}

.toast-notification.active {
  transform: translateX(0);
}

.toast-notification.success {
  border-left-color: var(--color-secondary);
}

.toast-notification.error {
  border-left-color: #dc2626;
}

.toast-icon {
  font-size: 1.25rem;
}