/* --- Google Font Import --- */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');
@import url('https://unpkg.com/swiper/swiper-bundle.min.css');

/* --- CSS Variables --- */
:root {
    --primary-color: #00b894;
    --primary-hover: #00a884;
    --light-green: #e6f8f5;
    --text-color: #2d3436;
    --secondary-text: #636e72;
    --background-color: #f7f8fa;
    --white-color: #ffffff;
    --border-color: #e0e6ed;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
    --progress-height: 3px;
    
    /* Card & Status Variables */
    --card-bg: #ffffff;
    --success-light: #f0fdf4;
    --success-color: #16a34a;
    --warning-light: #fff7ed;
    --warning-color: #ea580c;
    --danger-light: #fef2f2;
    --danger-color: #dc2626;
    --bg-color-alt: #f1f5f9;
}

/* Global Dark Mode overrides */
.dark {
    --text-color: #e6e6e6;
    --secondary-text: #aeb3b8;
    --background-color: #0f1114;
    --white-color: #161a1f;
    --border-color: #2b3138;
    --shadow: 0 6px 18px rgba(0, 0, 0, 0.45);

    /* Card & Status Variables Light/Dark Overrides */
    --card-bg: #161a1f;
    --success-light: rgba(22, 163, 74, 0.15);
    --success-color: #4ade80;
    --warning-light: rgba(234, 88, 12, 0.15);
    --warning-color: #fb923c;
    --danger-light: rgba(220, 38, 38, 0.15);
    --danger-color: #f87171;
    --bg-color-alt: #1c2128;
}

/* --- Global Styles --- */
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Poppins', sans-serif; }
body { background-color: var(--white-color); color: var(--text-color); }
a { text-decoration: none; color: var(--primary-color); }
.main-container { padding: 0 0 100px 0; display: flex; flex-direction: column; min-height: calc(100vh - 70px); }
.static-top { flex: 0 0 auto; }
.scroll-area { flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* Mobile: avoid auto-zoom on inputs (iOS) by using >=16px */
input, select, textarea, button {
  font-size: 16px;
  line-height: 1.2;
}

/* --- Top Progress Bar --- */
#page-progress { position: fixed; top: 0; left: 0; height: var(--progress-height); width: 0%; z-index: 2000; background: linear-gradient(90deg, #00b894, #34d399, #06b6d4); background-size: 200% 100%; box-shadow: 0 2px 8px rgba(0,0,0,.12); transition: width .2s ease; }
.speed-on #page-progress.anim { animation: progAnim 1s linear infinite; }
@keyframes progAnim { from { background-position: 0% 0; } to { background-position: 200% 0; } }

/* Floating Speed Mode toggle */
.speed-toggle { position: fixed; right: 16px; bottom: 90px; z-index: 1100; display: inline-flex; align-items: center; gap: 8px; background: #111; color: #fff; border-radius: 999px; padding: 8px 12px; box-shadow: 0 10px 20px rgba(0,0,0,.18); cursor: pointer; opacity: .85; }
.speed-toggle .dot { width: 10px; height: 10px; border-radius: 50%; background: #ef4444; box-shadow: 0 0 0 0 rgba(239,68,68,.7); transition: background .2s; }
.speed-toggle.on .dot { background: #22c55e; animation: pulseDot 1.4s ease-out infinite; }
@keyframes pulseDot { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.6);} 70% { box-shadow: 0 0 0 10px rgba(34,197,94,0);} 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0);} }

/* ================================================= */
/* == HEADER & SEARCH BAR SPACING - FINAL GUARANTEED FIX == */
/* ================================================= */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 15px 10px 15px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1200;
    background-color: var(--white-color);
}
.static-top { padding: 8px 15px 12px; background: var(--white-color); border-bottom: 1px solid rgba(0,0,0,0.03); }
.search-container { 
    position: relative;
    padding: 0 18px;
    margin-top: 10px;
    margin-bottom: 18px;
    background: #f8fafc; 
    border: 1px solid var(--border-color); 
    border-radius: 50px; 
    display: flex; 
    align-items: center; 
    gap: 12px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
    transition: all 0.2s ease;
}
.dark .search-container { background: #1a1f26; }
.search-container:focus-within { 
    background: #fff; 
    border-color: var(--primary-color); 
    box-shadow: 0 0 0 4px rgba(0,184,148,0.1); 
}
.search-container input { 
    width: 100%;
    padding: 12px 0; 
    background: transparent; 
    font-size: 15px; 
    border: none;
    outline: none;
    color: var(--text-color);
}
.search-container .search-icon { 
    position: static; 
    transform: none; 
    color: var(--primary-color); 
    font-size: 16px; 
}

/* Search suggestions dropdown */
.search-suggest {
  position: absolute;
  left: 15px;
  right: 15px;
  top: calc(100% + 6px);
  background: var(--white-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.08);
  overflow: hidden;
  z-index: 50;
  animation: suggestIn .18s ease-out;
}
.suggest-item {
  padding: 12px 14px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid #f3f5f7;
  cursor: pointer;
}
.suggest-item:last-child { border-bottom: none; }
.suggest-item:hover { background: var(--background-color); }
.suggest-title { font-weight: 500; color: var(--text-color); font-size: 14px; }
.suggest-meta { margin-left: auto; font-size: 12px; color: var(--secondary-text); }
@keyframes suggestIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* --- Logo & Header Icons --- */
.logo { display: flex; align-items: center; gap: 12px; }
.logo-text { display: flex; flex-direction: column; line-height: 1.2; }
.logo-text strong { font-size: 18px; font-weight: 600; }
.logo-text span { font-size: 12px; color: var(--secondary-text); }
.header-icons { display: flex; gap: 20px; }
.header-icons i { font-size: 22px; color: var(--text-color); }
.logo-circle-container { width: 42px; height: 42px; }
.logo-circle-bg { fill: var(--primary-color); }
.logo-path { fill: none; stroke: var(--white-color); stroke-width: 10; stroke-linecap: round; stroke-dasharray: 120; stroke-dashoffset: 120; animation: draw-s 2s ease-in-out forwards; }
@keyframes draw-s { to { stroke-dashoffset: 0; } }

/* --- Hero Slider --- (Removed duplicate old styles, clean up) */

/* --- Categories & PDF Sections --- */
.categories-section, .pdf-section { padding: 0 15px; margin-bottom: 30px; }
.categories-section { padding: 10px 15px; position: relative; }
.categories-section { padding: 15px; position: relative; }
.categories-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 20px; }
.categories-header h2 { margin: 0; font-size: 24px; font-weight: 800; color: var(--text-color); letter-spacing: -0.6px; }
.see-all { font-size: 13px; color: var(--primary-color); font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; opacity: 0.8; transition: opacity 0.2s; }
.see-all:hover { opacity: 1; text-decoration: underline; }

.categories-list { 
  display: flex; gap: 12px; overflow-x: auto; padding: 10px 5px 25px 5px; 
  scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; scrollbar-width: none; 
}
.categories-list::-webkit-scrollbar { display: none; }

.category-card {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 22px;
  background: #f8fafc;
  border-radius: 50px;
  text-decoration: none;
  white-space: nowrap;
  scroll-snap-align: start;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid #edf2f7;
  min-width: fit-content;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02), 0 2px 4px -1px rgba(0, 0, 0, 0.01);
}
.dark .category-card { background: #1c2128; border-color: #2d333b; box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3); }

.category-card:hover { 
  transform: translateY(-2px); 
  background: #fff; 
  border-color: var(--primary-color);
  box-shadow: 0 10px 15px -3px rgba(0, 184, 148, 0.1);
}
.dark .category-card:hover { background: #242b35; border-color: var(--primary-color); }
.category-card:active { transform: scale(0.96); }

.category-label {
  font-size: 13.5px;
  font-weight: 600;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.3s ease;
  letter-spacing: -0.2px;
}
.dark .category-label { color: #94a3b8; }

.category-label i {
  font-size: 15px;
  color: var(--primary-color);
}

/* Active State - Premium Gradient & Glow */
.category-card.active {
  background: linear-gradient(135deg, #00b894, #00d2d3);
  border-color: transparent;
  box-shadow: 0 12px 20px -8px rgba(0, 184, 148, 0.45);
}
.category-card.active .category-label {
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.category-card.active .category-label i {
  color: #fff;
}

@media (max-width: 600px) {
  .categories-header h2 { font-size: 20px; }
  .categories-list { gap: 8px; }
  .category-card { padding: 6px 14px; }
  .category-label { font-size: 12px; }
}

/* --- Entrance Animation --- */
@keyframes card-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.categories-list .category-card { animation: card-pop .4s ease-out both; }
.categories-list .category-card:nth-child(n+1) { animation-delay: calc(0.04s * var(--i, 0)); }

/* --- PDF Grid & Card Styles --- */
.pdf-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.pdf-section{ max-width: 100%; margin: 0; padding: 0 15px; }
@media (min-width: 768px){
  .pdf-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1024px){
  .pdf-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 1300px){
  .pdf-grid { grid-template-columns: repeat(5, 1fr); }
}
@media (min-width: 1600px){
  .pdf-grid { grid-template-columns: repeat(6, 1fr); }
}
.pdf-card { 
  background-color: var(--white-color); 
  border-radius: 18px; 
  overflow: hidden; 
  color: var(--text-color); 
  border: 1px solid var(--border-color); 
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.3s ease, border-color 0.3s ease; 
  box-shadow: 0 4px 16px rgba(0,0,0,0.02); 
  display: flex;
  flex-direction: column;
  height: 100%;
}
.pdf-card:hover { 
  transform: translateY(-5px); 
  box-shadow: 0 16px 32px rgba(0,0,0,0.07); 
  border-color: rgba(0,184,148,0.25);
}
.dark .pdf-card {
  background: #1a1f26;
  border-color: rgba(255,255,255,0.05);
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
.dark .pdf-card:hover {
  background: #242b36;
  border-color: rgba(0,184,148,0.3);
}
.card-image { 
  background: linear-gradient(135deg, #f8fafc, #f1f5f9); 
  border-bottom: 1px solid rgba(0,0,0,0.03); 
  overflow: hidden;
  position: relative;
}
.dark .card-image {
  background: linear-gradient(135deg, #1c2128, #161a1f);
  border-bottom: 1px solid rgba(255,255,255,0.02);
}
.card-image img { 
  width: 100%; 
  aspect-ratio: 4 / 3;
  object-fit: cover; 
  display: block; 
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.pdf-card:hover .card-image img { transform: scale(1.06); }

.card-content { 
  padding: 16px; 
  display: flex;
  flex-direction: column;
  flex: 1;
}
.card-content h3 { 
  font-size: 13.5px; 
  font-weight: 500; 
  margin: 6px 0; 
  line-height: 1.4; 
  display: -webkit-box; 
  -webkit-line-clamp: 2; 
  line-clamp: 2; 
  -webkit-box-orient: vertical; 
  overflow: hidden; 
  color: #444;
  transition: color 0.2s ease;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.dark .card-content h3 { color: #f1f5f9; }
.pdf-card:hover .card-content h3 { color: var(--primary-color); }
.price-info { display: flex; align-items: baseline; gap: 4px; margin-bottom: 2px; overflow: hidden; white-space: nowrap; }
.price-tag { font-size: 16px; font-weight: 800; color: #212121; }
.dark .price-tag { color: #fff; }

.old-price { font-size: 12px; color: #878787; text-decoration: line-through; margin: 0 2px; }
.discount-text { font-size: 12px; color: #388e3c; font-weight: 700; }

.rating-badge { 
  display: inline-flex; 
  align-items: center; 
  gap: 3px; 
  background-color: #388e3c; 
  color: #fff; 
  padding: 2px 6px; 
  border-radius: 4px; 
  font-size: 10px; 
  font-weight: 700; 
  margin-top: auto;
  width: fit-content;
}
.rating-badge i { font-size: 8px; }
.rating-badge.new { background-color: #26a541; }
.dark .rating-badge.new { background-color: #16a34a; }

.price-tag.free {
  background: rgba(0, 184, 148, 0.1);
  color: var(--primary-color);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 800;
}

/* --- Reveal-in animation for product cards --- */
.reveal-pending { opacity: 0; transform: translateY(12px); pointer-events: none; }
.reveal-in { opacity: 1; transform: translateY(0); transition: opacity 0.3s ease-out, transform 0.3s ease-out; }
/* --- Hero Banner / Slider (Flipkart Style) --- */
.hero-slider-wrapper {
    max-width: 100%;
    margin: 0 auto 16px;
    padding: 0 15px;
}

@media (min-width: 1024px) {
    .hero-slider-wrapper {
        padding: 0 8px;
    }
}

.hero-slider {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    background: #f1f3f6;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    /* Flipkart usually has a 2.5:1 or 2.8:1 ratio on desktop */
    aspect-ratio: 16 / 9; /* Mobile fallback */
}

@media (min-width: 768px) {
    .hero-slider {
        aspect-ratio: 21 / 9; /* Wider for desktop */
    }
}

.hero-slider .swiper-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* This makes it "adjust" nicely to fill the box */
    display: block;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.hero-slider .swiper-slide:hover img {
    transform: scale(1.02);
}

/* Swiper Navigation Customization */
/* Pagination Customization */
.hero-slider .swiper-pagination-bullet {
    width: 8px;
    height: 8px;
    background: #fff;
    opacity: 0.6;
    transition: all 0.3s;
    z-index: 101;
}

.hero-slider .swiper-pagination-bullet-active {
    opacity: 1;
    width: 24px;
    border-radius: 5px;
    background: #fff;
    z-index: 101;
}

/* Dark mode adjustments */
.dark .hero-slider { background: #1a1f26; }

/* --- Bottom Navigation Bar --- */
.bottom-nav { position: fixed; bottom: 0; left: 0; width: 100%; height: 70px; background-color: var(--white-color); display: flex; justify-content: space-around; align-items: center; box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.07); border-top: 1px solid var(--border-color); z-index: 999; }
.nav-item { display: flex; flex-direction: column; align-items: center; color: #b0b0b0; font-size: 12px; }
.nav-item i { font-size: 22px; margin-bottom: 4px; }
.nav-item.active { color: var(--primary-color); }

/* --- Notification Bell & Panel Styles --- */
.notification-bell-container { position: relative; }
.notification-count { position: absolute; top: -5px; right: -8px; background-color: #e74c3c; color: var(--white-color); width: 18px; height: 18px; border-radius: 50%; display: flex; justify-content: center; align-items: center; font-size: 11px; font-weight: 600; }
.notification-panel { position: absolute; top: 70px; right: 15px; width: 320px; max-width: calc(100vw - 30px); max-height: 400px; background-color: var(--white-color); border-radius: 12px; box-shadow: 0 8px 25px rgba(0,0,0,0.15); z-index: 1000; overflow: hidden; display: flex; flex-direction: column; }
.notification-header { padding: 15px; border-bottom: 1px solid var(--border-color); }
.notification-header h4 { font-size: 16px; margin: 0; }
.notification-list { overflow-y: auto; }
.notification-item { position: relative; padding: 16px 40px 16px 16px; border-bottom: 1px solid var(--border-color); cursor: pointer; transition: background-color 0.2s; background-color: var(--white-color); border-left: 4px solid transparent; }
.notification-item:last-child { border-bottom: none; }
.notification-item:hover { background-color: var(--background-color); }
.notification-item.unread { background-color: rgba(0,184,148,0.06); border-left-color: var(--primary-color); }
.dark .notification-item.unread { background-color: rgba(0,184,148,0.12); }
.notification-item p { margin: 0 0 6px 0; font-size: 14px; line-height: 1.4; color: var(--text-color); }
.notification-item span { font-size: 12px; color: var(--secondary-text); }
.notif-del { position: absolute; right: 12px; top: 16px; width: 28px; height: 28px; background: transparent; border: none; border-radius: 6px; color: var(--secondary-text); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.notif-del:hover { background-color: rgba(231,76,60,0.1); color: #e74c3c; }
.no-notification { padding: 40px 15px; text-align: center; color: var(--secondary-text); }

/* --- Authentication & Other Page Styles --- */
.auth-container { padding: 40px 15px; }
.auth-box { background: var(--white-color); padding: 30px; border-radius: 12px; box-shadow: var(--shadow); width: 100%; max-width: 400px; text-align: center; margin: 0 auto; }
.auth-box h2, .auth-box p { text-align: center; }
.input-group, input[type="text"], input[type="email"], input[type="password"] { width: 100%; }
.btn-primary { width: 100%; padding: 14px; border: none; border-radius: 8px; background-color: var(--primary-color); color: var(--white-color); font-size: 16px; font-weight: 600; cursor: pointer; transition: background-color 0.3s; }
.btn-primary:hover { background-color: var(--primary-hover); }
.form-switch { margin-top: 20px; font-size: 14px; }
.form-switch a { font-weight: 600; }
.error-msg, .success-msg { text-align: center; }
.error-msg { background-color: #f8d7da; color: #721c24; padding: 10px; border-radius: 8px; margin-bottom: 15px; border: 1px solid #f5c6cb; }
.success-msg { background-color: #d4edda; color: #155724; padding: 10px; border-radius: 8px; margin-bottom: 15px; border: 1px solid #c3e6cb; }

/* ================= User Dashboard (Profile) ================= */
.profile-wrapper { padding: 16px 15px 100px; }
.profile-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.profile-header h1 { font-size: 20px; font-weight: 600; margin: 0 auto 0 0; }
.back-btn { width: 36px; height: 36px; border: 1px solid var(--border-color); background: var(--white-color); border-radius: 10px; display: grid; place-items: center; color: var(--text-color); }

.profile-card { background: var(--white-color); border-radius: 16px; box-shadow: var(--shadow); padding: 20px; text-align: center; margin-bottom: 16px; }
.avatar-wrap { position: relative; width: 96px; height: 96px; margin: 0 auto 10px; }
.avatar-wrap img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; border: 4px solid #f4f7f9; }
.avatar-edit { position: absolute; right: -2px; bottom: -2px; width: 28px; height: 28px; border-radius: 50%; border: none; background: var(--primary-color); color: #fff; display: grid; place-items: center; box-shadow: 0 4px 12px rgba(0,0,0,.15); }
.profile-card h2 { margin: 8px 0 2px; font-size: 18px; }
.muted { color: var(--secondary-text); font-size: 13px; }

.profile-section { background: var(--white-color); border-radius: 16px; box-shadow: var(--shadow); padding: 6px 8px; margin: 16px 0; }
.section-title { font-size: 14px; color: var(--secondary-text); font-weight: 600; padding: 8px 10px; margin: 0; }
.list-item { display: flex; align-items: center; justify-content: space-between; padding: 12px 10px; border-bottom: 1px solid #f1f3f5; color: var(--text-color); }
.list-item:last-child { border-bottom: none; }
.list-item .left { display: flex; align-items: center; gap: 12px; }
.icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--background-color); color: var(--text-color); }
.icon.green { background: var(--light-green); color: var(--primary-color); }
.icon.red { background: #fdecea; color: #e74c3c; }
.list-item.logout { color: #e74c3c; }

/* Switch (Dark mode) */
.switch { position: relative; display: inline-block; width: 48px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #e9eef3; transition: .2s; border-radius: 999px; }
.slider:before { position: absolute; content: ""; height: 20px; width: 20px; left: 3px; top: 3px; background-color: white; transition: .2s; border-radius: 50%; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.switch input:checked + .slider { background-color: var(--primary-color); }
.switch input:checked + .slider:before { transform: translateX(22px); }

/* Dark mode support */
.dark body { background: #0f1114; color: #e6e6e6; }
.dark .profile-card, .dark .profile-section, .dark .bottom-nav { background: #161a1f; }
.dark .list-item { border-color: #22272e; }
.dark .switch .slider { background: #2b3138; }

/* Custom Image Adjustments for Cart & Global */
.cart-item-img, .thumbnail-sm {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}
.product-hero-img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 20px;
}