@import url('https://fonts.googleapis.com/css2?family=Red+Hat+Display:wght@400;500;600;700&display=swap');

:root {
  /* Rivly-Inspired Color Palette */
  --primary-color: #635EF7;
  --primary-light: #E6E5FF;
  
  --color-black: #000000;
  --color-white: #ffffff;
  --color-bg-creamy: #f9f9fc; /* Very soft off-white background */
  
  --accent-yellow: #FEEB9D;
  --accent-blue: #2A61DB;
  --accent-blue-light: #D9E4FC;
  --accent-orange: #F99D49;
  --accent-rose: #FDCAE4;

  --text-dark: #1A1A1A;
  --text-gray: #6B7280;
  --text-light: #9CA3AF;
  
  --border-light: #E5E7EB;

  --font-family: 'Red Hat Display', sans-serif;
  
  --border-radius-sm: 8px;
  --border-radius-md: 16px;
  --border-radius-lg: 24px;
  --border-radius-pill: 9999px;
  
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  --shadow-primary: 0 10px 20px -5px rgba(99, 94, 247, 0.4);
}

/* Base Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  background-color: var(--color-bg-creamy);
  color: var(--text-dark);
  line-height: 1.6;
}

a {
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
}

ul {
  list-style: none;
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; letter-spacing: -0.02em; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: var(--border-radius-pill);
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:active {
  transform: scale(0.98);
}

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

.btn-primary:hover {
  background-color: #554bdb;
}

.btn-outline {
  border: 2px solid var(--border-light);
  color: var(--text-dark);
}

.btn-outline:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-white);
  border: 1px solid var(--border-light);
}

.btn-icon:hover {
  background-color: var(--color-bg-creamy);
}

/* Utility Classes */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-column { flex-direction: column; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.gap-4 { gap: 2rem; }

/* Header & Navbar */
.site-header {
  background-color: var(--color-white);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border-light);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.search-bar {
  flex: 1;
  max-width: 500px;
  margin: 0 2rem;
  position: relative;
}

.search-bar input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  border-radius: var(--border-radius-pill);
  border: 1px solid var(--border-light);
  background-color: var(--color-bg-creamy);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.search-bar input:focus {
  border-color: var(--primary-color);
  background-color: var(--color-white);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

/* Sidebar Drawer System */
.hamburger-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  color: var(--text-dark);
  border-radius: 4px;
}
.hamburger-btn:hover {
  background: var(--color-bg-creamy);
}
.mobile-sidebar {
  position: fixed;
  top: 0;
  left: -320px;
  width: 320px;
  max-width: 85vw;
  height: 100vh;
  background: var(--color-white);
  z-index: 9999;
  transition: 0.3s ease-in-out;
  box-shadow: 2px 0 15px rgba(0,0,0,0.15);
  overflow-y: auto;
}
.mobile-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.4);
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: 0.3s ease-in-out;
}
body.menu-open .mobile-sidebar {
  left: 0;
}
body.menu-open .mobile-overlay {
  opacity: 1;
  pointer-events: all;
}
body.menu-open {
  overflow: hidden;
}

.cart-icon-wrapper {
  position: relative;
}

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

/* User Dropdown */
.user-menu {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: var(--border-radius-pill);
  border: 1px solid var(--border-light);
  transition: background-color 0.2s;
}
.user-menu:hover { background-color: var(--color-bg-creamy); }
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: var(--accent-blue-light);
}

/* Hero Section */
.hero-section {
  padding: 4rem 0;
  text-align: center;
}

.hero-title {
  font-size: 3.5rem;
  max-width: 800px;
  margin: 0 auto 1rem;
  line-height: 1.1;
}

.hero-title span {
  color: var(--primary-color);
}

.hero-subtitle {
  color: var(--text-gray);
  font-size: 1.125rem;
  margin-bottom: 2rem;
}

/* Category Pills */
.category-nav {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 3rem;
  flex-wrap: wrap;
}

.cat-pill {
  padding: 0.5rem 1.25rem;
  border-radius: var(--border-radius-pill);
  background-color: var(--color-white);
  font-weight: 500;
  font-size: 0.9rem;
  border: 1px solid var(--border-light);
  cursor: pointer;
}
.cat-pill:hover, .cat-pill.active {
  background-color: var(--primary-color);
  color: var(--color-white);
  border-color: var(--primary-color);
}

/* Product Grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2rem;
  margin-bottom: 4rem;
}

/* Product Card */
.product-card {
  background-color: var(--color-white);
  border-radius: var(--border-radius-lg);
  padding: 1rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
  display: flex;
  flex-direction: column;
}

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

.product-img-wrapper {
  background-color: var(--color-bg-creamy);
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-light);
  margin-bottom: 1rem;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.product-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

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

.product-category {
  font-size: 0.8rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.product-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  flex-grow: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.product-price {
  font-size: 1.25rem;
  font-weight: 700;
  background-color: var(--primary-color);
  color: var(--color-white);
  padding: 0.25rem 0.75rem;
  border-radius: var(--border-radius-pill);
  white-space: nowrap;
}

/* Quick order link on product card */
.hover-actions {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  opacity: 0;
  transform: translateX(10px);
  transition: all 0.3s ease;
  z-index: 10;
}
.product-card:hover .hover-actions {
  opacity: 1;
  transform: translateX(0);
}
@media (hover: none) {
  .product-card .hover-actions {
      opacity: 1;
      transform: translateX(0);
  }
}
.hover-action-btn {
  background: var(--color-white);
  border: 1px solid var(--border-light);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  color: var(--text-dark);
  transition: all 0.2s;
}
.hover-action-btn:hover {
  background: var(--primary-color);
  color: var(--color-white);
  border-color: var(--primary-color);
}

/* Colorful Banners (Mimicking the third dribbble shot) */
.featured-banners {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.banner-card {
  border-radius: var(--border-radius-lg);
  padding: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.banner-card h3 {
  font-size: 2rem;
  margin-bottom: 1rem;
  max-width: 60%;
}

.banner-light-purple { background-color: var(--primary-light); }
.banner-yellow { background-color: var(--accent-yellow); }
.banner-light-blue { background-color: var(--accent-blue-light); }

.banner-img {
  position: absolute;
  right: -5%;
  bottom: -10%;
  height: 120%;
  object-fit: cover;
}

/* Single Product Page */
.product-detail-layout {
  display: grid;
  grid-template-columns: 100px 1fr 1fr;
  gap: 2rem;
  padding: 3rem 0;
}

.product-thumbnails {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.thumb-item {
  width: 80px;
  height: 80px;
  border-radius: var(--border-radius-md);
  background-color: var(--color-white);
  border: 2px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.thumb-item.active { border-color: var(--primary-color); }
.thumb-item img { max-width: 80%; max-height: 80%; }

.product-main-image {
  background-color: var(--color-white);
  border-radius: var(--border-radius-lg);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 1rem;
  max-height: 600px;
  height: fit-content;
}
.product-main-image img {
  width: 100%;
  height: auto;
  max-height: 560px;
  object-fit: contain;
  border-radius: var(--border-radius-md);
}

.product-info h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.product-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  color: var(--text-gray);
}

.product-price-large {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.action-buttons {
  display: flex;
  gap: 1rem;
  margin: 2rem 0;
}
.btn-buy-now {
  flex: 1;
  background-color: var(--primary-color);
  color: var(--color-white);
  padding: 1rem;
  border-radius: var(--border-radius-pill);
  font-size: 1.1rem;
  font-weight: 700;
  box-shadow: var(--shadow-primary);
}
.btn-add-cart {
  width: 60px;
  background-color: var(--color-bg-creamy);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-pill);
  display:flex;
  align-items:center;
  justify-content:center;
}
.btn-add-cart:hover { border-color: var(--primary-color); }

/* Quick Order Modal */
.modal-overlay {
  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: 1000;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s;
}
.modal-overlay.active {
  opacity: 1; pointer-events: auto;
}
.modal-content {
  background: var(--color-white);
  width: 90%; max-width: 500px;
  border-radius: var(--border-radius-lg);
  padding: 2rem;
  transform: translateY(20px);
  transition: transform 0.3s;
  position: relative;
}
.modal-overlay.active .modal-content {
  transform: translateY(0);
}
.modal-close {
  position: absolute; right: 1rem; top: 1rem;
  font-size: 1.5rem; cursor: pointer; color: var(--text-gray);
}
.form-group {
  margin-bottom: 1rem;
}
.form-group label {
  display: block; font-weight: 600; margin-bottom: 0.25rem; font-size: 0.9rem;
}
.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-sm);
  font-family: inherit; font-size: 1rem;
}
.form-group input:focus {
  outline: none; border-color: var(--primary-color);
}

/* Success Animation inside Modal */
.success-animation {
  display: none;
  text-align: center;
  padding: 2rem 0;
}
.success-animation.active {
  display: block;
}
.truck-icon {
  font-size: 4rem;
  color: var(--primary-color);
  animation: drive 2s ease-in-out forwards;
}

@keyframes drive {
  0% { transform: translateX(-50px); opacity: 0; }
  20% { opacity: 1; }
  80% { transform: translateX(50px); opacity: 1; }
  100% { transform: translateX(100px); opacity: 0; }
}

/* Reels & Reviews */
.reels-section, .reviews-section {
  padding: 3rem 0;
  border-top: 1px solid var(--border-light);
}

.reels-container {
  display: flex; gap: 1rem; overflow-x: auto; padding-bottom: 1rem;
}
.reel-item {
  min-width: 250px; height: 450px;
  background: var(--color-black);
  border-radius: var(--border-radius-md);
  overflow: hidden; position: relative;
}
.reel-item iframe { width: 100%; height: 100%; border: none; }

/* Dashboard Basics */
.admin-layout {
  display: flex;
  min-height: 100vh;
  background-color: var(--color-bg-creamy);
}
.admin-sidebar {
  width: 250px;
  background-color: var(--color-white);
  padding: 2rem 1rem;
  border-right: 1px solid var(--border-light);
}
.admin-main {
  flex: 1;
  padding: 2rem;
}
.admin-card {
  background: var(--color-white);
  border-radius: var(--border-radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

/* Footer */
.site-footer {
  background-color: var(--color-white);
  padding: 3rem 0;
  margin-top: 4rem;
  border-top: 1px solid var(--border-light);
}

/* Enhancements (Bug Fixes & Polish) */

/* Strict 1:1 Image Ratios for Single Layout */
.single-main-image {
    aspect-ratio: 1 / 1;
    object-fit: contain;
}

/* Floating Cart Badge & Notifications */
.floating-cart-badge {
    position: fixed; bottom: 2rem; right: 2rem; background: var(--primary-color); color: white;
    width: 60px; height: 60px; border-radius: 50%; display: flex; justify-content: center; align-items: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3); z-index: 9999; cursor: pointer; transition: transform 0.3s;
}
.floating-cart-badge:hover { transform: scale(1.05); }
.floating-cart-badge .badge-count {
    position: absolute; top: -5px; right: -5px; background: var(--accent-orange); color: white;
    font-size: 0.8rem; font-weight: bold; width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
@keyframes badgeBlink {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 138, 0, 0.7); }
    50% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(255, 138, 0, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 138, 0, 0); }
}
.badge-blink { animation: badgeBlink 0.6s ease-in-out; }

/* Toast Notification */
.toast-notification {
    position: fixed; top: -100px; left: 50%; transform: translateX(-50%); background: var(--primary-color);
    color: white; padding: 1rem 2rem; border-radius: var(--border-radius-pill); box-shadow: var(--shadow-sm);
    z-index: 10000; transition: top 0.4s ease-out; font-weight: 500; display:flex; align-items:center; gap:0.5rem;
}
.toast-notification.show { top: 2rem; }

/* Admin Variations CSS */
.var-row input {
  padding: 0.5rem;
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
}
.var-row input:focus {
  outline: none; border-color: var(--primary-color);
}

/* Shop Sidebar Layout */
.shop-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 2rem;
}
.sidebar-filters {
    background: var(--color-white);
    padding: 1.5rem;
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-sm);
    height: fit-content;
}
.filter-group { margin-bottom: 1.5rem; }
.filter-group h4 { margin-bottom: 0.75rem; font-size: 1.1rem; }
.filter-group label { display: block; margin-bottom: 0.5rem; color: var(--text-gray); font-size: 0.95rem; cursor: pointer; }

/* Dynamic Hero Slider */
.hero-slider-container {
    position: relative;
    overflow: hidden;
    border-radius: var(--border-radius-lg);
    background: var(--primary-light);
    margin-bottom: 4rem;
}
.hero-slide {
    display: none;
    align-items: center;
    padding: 2rem 4rem;
    animation: fadeEffect 1s;
    min-width: 100%;
    scroll-snap-align: start;
    box-sizing: border-box;
}
.hero-slide-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4rem 2rem;
    min-width: 100%;
}
.hero-slide.scroll-snap { display: flex; animation: none; }
.slide-content { flex: 1; }
.slide-content h2 { font-size: 3rem; margin-bottom: 1rem; color: var(--text-dark); line-height: 1.1; }
.slide-content p { color: var(--text-gray); margin-bottom: 2rem; font-size: 1.1rem; }
.slide-image { flex: 1; text-align: right; }
.slide-image img { max-height: 400px; aspect-ratio: 1/1; object-fit: contain; }
.slide-image img { max-height: 400px; aspect-ratio: 1/1; object-fit: contain; }
.slider-dots { position: absolute; bottom: 1rem; left: 50%; transform: translateX(-50%); display:flex; gap:0.5rem; }
.dot { width:12px; height:12px; border-radius:50%; background:rgba(0,0,0,0.2); cursor:pointer; }
.dot.active { background:var(--primary-color); }

/* Alternating Creamy Backgrounds */
.section-creamy {
    background: var(--color-bg-creamy);
    padding: 4rem 0;
}
.section-white {
    background: var(--color-white);
    padding: 4rem 0;
}

/* Full Mobile Responsiveness */
@media (max-width: 900px) {
    .shop-layout { grid-template-columns: 1fr; }
    .hero-slider-container { border-radius: 0; margin-left: -1.5rem; margin-right: -1.5rem; margin-bottom: 2rem;}
    .hero-slide { flex-direction: column-reverse; text-align: center; padding: 2.5rem 1.5rem !important; gap: 1rem; }
    .hero-slide-empty { padding: 2rem 1rem !important; }
    .slide-image img { max-height: 200px; margin-bottom: 0; }
    .slide-content h2 { 
        font-size: 1.75rem; 
        line-height: 1.2;
        margin-bottom: 0.75rem;
        display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    }
    .slide-content p {
        font-size: 0.95rem;
        margin-bottom: 1.5rem;
        display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
    }
    .product-detail-layout { grid-template-columns: 1fr; }
    .product-thumbnails { flex-direction: row; overflow-x: auto; order: 2; }
    .product-main-image { order: 1; min-height: 300px; padding: 1rem; }
}

@media (max-width: 768px) {
    .site-header { position: relative; }
    .site-header .container { flex-direction: column; gap: 1rem; padding: 1rem; }
    .search-bar { width: 100%; margin: 0; }
    .product-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1rem; }
    
    /* Dedicated Cart Page Overrides */
    .cart-grid { grid-template-columns: 1fr !important; gap: 2rem !important; }
    .cart-table, .cart-table tbody, .cart-table tr, .cart-table td { display: block; width: 100%; white-space: normal; }
    .cart-table thead, .cart-table th { display: none; } /* Hide labels on mobile */
    .cart-table tr { 
        padding: 1.5rem !important; 
        position: relative; 
        border: 1px solid var(--border-light) !important; 
        border-radius: var(--border-radius-lg); 
        box-shadow: var(--shadow-sm); 
        margin-bottom: 1.5rem; 
        background: var(--color-white); 
    }
    .cart-table td { padding: 0.5rem 0 !important; text-align: left; }
    .cart-table td:nth-child(1) { font-weight: bold; font-size: 1.05rem; padding-right: 2rem !important; margin-bottom: 0.5rem; }
    .cart-table td:nth-child(2)::before { content: "Price: "; font-weight: bold; color: var(--text-gray); }
    .cart-table td:nth-child(3) { margin: 0.5rem 0; }
    .cart-table td:nth-child(4)::before { content: "Total: "; font-weight: bold; color: var(--text-gray); }
    .cart-table td:nth-child(4) { font-size: 1.1rem; color: var(--primary-color); }
    .cart-table td:nth-child(5) form { position: absolute; top: 1rem; right: 0; }
    .checkout-box { margin-top: 1rem; }
    .banner-card { flex-direction: column; text-align: center; }
    .banner-card h3 { max-width: 100%; font-size: 1.5rem; }
    .banner-img { position: relative; height: 150px; right: 0; bottom: 0; }
    .admin-layout { flex-direction: column; }
    .admin-sidebar { width: 100%; display: flex; flex-wrap: wrap; justify-content: center; border-right: none; border-bottom: 1px solid var(--border-light); }
    .admin-sidebar a { margin-bottom: 0; }
    .table-admin { font-size: 0.8rem; }
    .table-admin th, .table-admin td { padding: 0.5rem; }
}
