/* ===================================
   Trendy Corner - Main Stylesheet
   =================================== */

/* ===================================
   Base Styles & Typography
   =================================== */
.font-elegant {
  font-family: 'Playfair Display', serif;
}

body {
  background-color: #ffffff;
  color: #000000;
}

/* ===================================
   Price Display Styles
   =================================== */
.price {
  font-size: 18px;
}

.old-price {
  text-decoration: line-through;
  color: #888;
  margin-right: 8px;
}

.sale-price {
  color: #e60023;
  font-weight: bold;
}

/* ===================================
   Slideshow Styles
   =================================== */
.slideshow-container {
  position: relative;
  width: 100%;
  height: 80vh;
  overflow: hidden;
}

/* General slide styles - but hero slideshow uses #hero .slideshow-container .slide for specificity */
.slide {
  display: none;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1s ease-in-out;
}

.slide.active {
  display: block;
  opacity: 1;
}

/* Ensure hero slideshow slides are not affected by general .slide rules */
#hero .slideshow-container .slide {
  display: block !important;
}

#hero .slideshow-container .slide.active {
  display: block !important;
  opacity: 1 !important;
}

.slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ===================================
   Product Card Image Container Styles
   =================================== */
.image-slideshow-container {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  min-height: 300px;
  overflow: hidden;
  background: #f3f4f6;
}

.image-slideshow-container .slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.5s ease-in-out;
}

.image-slideshow-container .slide[style*="display: block"],
.image-slideshow-container .slide:not([style*="display: none"]) {
  opacity: 1;
  z-index: 2;
}

.image-slideshow-container .slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.product-card {
  position: relative;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.product-card .overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 10;
}

.product-card:hover .overlay {
  opacity: 1;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
}

@media (max-width: 640px) {
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
  
  .image-slideshow-container {
    min-height: 250px;
  }
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: background 0.3s ease;
}

.dot.active {
  background: white;
}

/* ===================================
   Mobile Optimization Styles
   =================================== */
html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

img, video, canvas, svg {
  max-width: 100%;
  height: auto;
}

input, select, textarea, button {
  max-width: 100%;
}

@media (max-width: 767px) {
  input, select, textarea {
    font-size: 16px;
  }

  .container {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
  
  /* Mobile Navigation Styles */
  header {
    position: sticky;
    top: 0;
  }
  
  header nav {
    position: relative;
    flex-wrap: nowrap;
  }
  
  /* Ensure mobile button is visible and clickable */
  button#tcMobileButton {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 44px !important;
    min-height: 44px !important;
    z-index: 60 !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    padding: 0.5rem !important;
  }
  
  /* Mobile Menu Container */
  div#tcMobileMenu {
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    background: white !important;
    z-index: 40 !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
    max-height: calc(100vh - 80px) !important;
    overflow-y: auto !important;
  }
  
  /* Hide menu when hidden class is present */
  div#tcMobileMenu.hidden {
    display: none !important;
    visibility: hidden !important;
  }
  
  /* Show menu when not hidden */
  div#tcMobileMenu:not(.hidden) {
    display: block !important;
    visibility: visible !important;
  }
  
  /* Ensure mobile menu items are clickable */
  #tcMobileMenu a,
  #tcMobileMenu button {
    cursor: pointer !important;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1) !important;
    user-select: none !important;
    touch-action: manipulation !important;
  }
  
  /* Submenu button styles */
  #tcMobileMenu button[data-tc-sub] {
    width: 100% !important;
    text-align: left !important;
    background: transparent !important;
    border: none !important;
    padding: 0.75rem 0 !important;
  }
  
  /* Mobile submenu styles */
  #tcMobileMenu [data-tc-submenu] {
    transition: max-height 0.3s ease, opacity 0.3s ease !important;
    overflow: hidden !important;
  }
  
  #tcMobileMenu [data-tc-submenu].hidden {
    max-height: 0 !important;
    opacity: 0 !important;
    display: none !important;
    visibility: hidden !important;
  }
  
  #tcMobileMenu [data-tc-submenu]:not(.hidden) {
    max-height: 500px !important;
    opacity: 1 !important;
    display: block !important;
    visibility: visible !important;
  }
}

/* ===================================
   Cart Popup Modal Styles
   =================================== */
.cart-popup {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  animation: fadeIn 0.3s ease;
}

.cart-popup.active {
  display: block;
}

.cart-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9998;
}

.cart-popup-content {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border-radius: 12px;
  max-width: 400px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  z-index: 9999;
  animation: slideUp 0.3s ease;
}

.cart-popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #e5e7eb;
}

.cart-popup-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #1f2937;
}

.cart-popup-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #6b7280;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s ease;
}

.cart-popup-close:hover {
  background: #f3f4f6;
}

.cart-popup-body {
  padding: 20px;
}

.cart-popup-product {
  display: flex;
  gap: 15px;
  margin-bottom: 20px;
}

.cart-popup-product img {
  width: 80px;
  height: 100px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.cart-popup-details h4 {
  margin: 0 0 8px 0;
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
}

.cart-popup-details p {
  margin: 4px 0;
  font-size: 14px;
  color: #6b7280;
}

.cart-popup-details p:first-of-type {
  color: #db2777;
  font-weight: 600;
}

.cart-popup-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.cart-popup-btn {
  flex: 1;
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cart-popup-btn.continue {
  background: #f3f4f6;
  color: #374151;
}

.cart-popup-btn.continue:hover {
  background: #e5e7eb;
}

.cart-popup-btn.view-cart {
  background: #db2777;
  color: white;
}

.cart-popup-btn.view-cart:hover {
  background: #be185d;
}

.cart-popup-btn.place-order {
  background: #25d366;
  color: white;
}

.cart-popup-btn.place-order:hover {
  background: #128c7e;
}

.cart-summary {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 15px;
  margin: 20px 0;
}

.cart-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 8px 0;
}

.cart-total span:first-child {
  color: #6b7280;
  font-size: 14px;
}

.cart-total span:last-child {
  color: #1f2937;
  font-size: 16px;
}

.order-form {
  margin: 20px 0;
}

.order-form h4 {
  margin: 0 0 15px 0;
  font-size: 16px;
  font-weight: 600;
  color: #1f2937;
}

.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

/* ===================================
   Animations
   =================================== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { 
    opacity: 0;
    transform: translate(-50%, -40%);
  }
  to { 
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

/* ===================================
   Responsive Design
   =================================== */
@media (max-width: 480px) {
  .cart-popup-content {
    width: 95%;
    margin: 20px;
  }
  
  .cart-popup-product img {
    width: 60px;
    height: 80px;
  }
  
  .cart-popup-actions {
    flex-direction: column;
  }
  
  .cart-popup-btn {
    width: 100%;
  }
}

/* ===================================
   Component Specific Styles
   =================================== */

/* Header Navigation */
header {
  position: sticky;
  top: 0;
  z-index: 50;
  background-color: white;
  border-bottom: 1px solid #e5e7eb;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

/* Mobile header positioning */
@media (max-width: 767px) {
  header {
    position: relative;
  }
  
  header nav {
    position: relative;
  }
}

.nav-link {
  color: black;
  font-weight: 500;
  transition: color 0.2s ease;
}

.nav-link:hover {
  color: #db2777;
}

/* Dropdown Menus */
.group:hover .group-hover\\:opacity-100 {
  opacity: 1;
}

.group:hover .group-hover\\:visible {
  visibility: visible;
}

/* Search Bar Styles */
#searchInput,
#mobileSearchInput {
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
}

#searchInput:focus,
#mobileSearchInput:focus {
  outline: none;
  border-color: #ec4899;
  box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.1);
}

/* Filter Dropdown Styles */
.relative {
  position: relative;
}

.bg-white {
  background-color: white;
}

.border-gray-200 {
  border-color: #e5e7eb;
}

.rounded-lg {
  border-radius: 0.5rem;
}

.shadow-lg {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Product Card Styles */
.border {
  border: 1px solid #e5e7eb;
}

.border-gray-200 {
  border-color: #e5e7eb;
}

.rounded-lg {
  border-radius: 0.5rem;
}

.aspect-\[3\/4\] {
  aspect-ratio: 3 / 4;
}

.overflow-hidden {
  overflow: hidden;
}

/* Footer Styles */
footer {
  background-color: #f9fafb;
  border-top: 1px solid #e5e7eb;
}

/* Button Styles */
.bg-black {
  background-color: black;
}

.bg-pink-600 {
  background-color: #db2777;
}

.bg-pink-600:hover {
  background-color: #be185d;
}

.text-white {
  color: white;
}

.px-3 {
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

.py-1\.5 {
  padding-top: 0.375rem;
  padding-bottom: 0.375rem;
}

.text-xs {
  font-size: 0.75rem;
}

.rounded {
  border-radius: 0.25rem;
}

/* Mobile Menu Styles */
.md\\:hidden {
  display: none;
}

@media (min-width: 768px) {
  .md\\:hidden {
    display: block;
  }
  
  .md\\:flex {
    display: flex;
  }
  
  /* Hide mobile menu on desktop */
  #tcMobileMenu {
    display: none !important;
  }
  
  /* Hide mobile cart button on desktop */
  #cartCountMobile {
    display: none !important;
  }
}

/* Cart Badge Styles */
.relative {
  position: relative;
}

.-top-2 {
  top: -0.5rem;
}

.-right-2 {
  right: -0.5rem;
}

.bg-pink-500 {
  background-color: #ec4899;
}

.min-w-\[1\.25rem\] {
  min-width: 1.25rem;
}

.h-5 {
  height: 1.25rem;
}

.px-1 {
  padding-left: 0.25rem;
  padding-right: 0.25rem;
}

.flex {
  display: flex;
}

.items-center {
  align-items: center;
}

.justify-center {
  justify-content: center;
}

.text-xs {
  font-size: 0.75rem;
}

.rounded-full {
  border-radius: 9999px;
}

/* Utility Classes */
.container {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

@media (min-width: 640px) {
  .container {
    max-width: 640px;
  }
}

@media (min-width: 768px) {
  .container {
    max-width: 768px;
  }
}

@media (min-width: 1024px) {
  .container {
    max-width: 1024px;
  }
}

@media (min-width: 1280px) {
  .container {
    max-width: 1280px;
  }
}

/* ===================================
   Mobile-Only Fixes (max-width: 768px)
   =================================== */
@media (max-width: 768px) {
  /* Ensure cart popup is fixed-position and doesn't appear after footer */
  .cart-popup {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 10000 !important;
    overflow: hidden !important;
  }
  
  .cart-popup-content {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
    z-index: 10001 !important;
  }
  
  /* Ensure search bar is visible and functional on mobile */
  #searchContainer:not(.hidden) {
    position: fixed !important;
    top: 70px !important;
    left: 1rem !important;
    right: 1rem !important;
    width: auto !important;
    max-width: calc(100vw - 2rem) !important;
    z-index: 1000 !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
  
  /* Fix mobile menu button toggle */
  #tcMobileButton {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    cursor: pointer !important;
    z-index: 100 !important;
    position: relative !important;
    touch-action: manipulation !important;
    min-width: 44px !important;
    min-height: 44px !important;
  }
  
  #tcMobileMenu:not(.hidden) {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
  
  /* Remove any duplicate footer content appearing after footer */
  footer + *:not(script):not(style) {
    display: none !important;
  }
  
  /* Hide any stray footer-like content after the main footer */
  body > footer ~ footer,
  body > footer + .footer,
  body > footer + [class*="footer"] {
    display: none !important;
  }
}

/* ===================================
   Print Styles
   =================================== */
@media print {
  .cart-popup,
  header,
  footer {
    display: none !important;
  }
  
  body {
    background: white !important;
    color: black !important;
  }
}
