
/* Site Banner */
#site-banner {
    /* Basic styling, color will be dynamic via PHP */
    padding: 0.75rem 1.25rem;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.5;
    text-align: center;
    position: relative;
    z-index: 50; /* Ensure it's above other content but below sticky header */
}

#site-banner.hidden {
    display: none;
}

#close-site-banner {
    /* Positioned absolutely */
    cursor: pointer;
    background: none;
    border: none;
    line-height: 1;
}

/* General Prose styles for consistent headings */
.prose h2, .prose h3, .prose h4 {
    font-weight: 700;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}
.prose h2 {
    font-size: 1.875rem; /* Equivalent to text-3xl */
}
.prose h3 {
    font-size: 1.5rem; /* Equivalent to text-2xl */
}
.prose h4 {
    font-size: 1.25rem; /* Equivalent to text-xl */
}

/* Product Label Ribbon from theme/header.php */
.product-label {
    position: absolute;
    left: -1px; 
    top: -1px;
    z-index: 1;
    overflow: hidden;
    width: 100px; 
    height: 100px;
    text-align: right;
}
.product-label span {
    position: absolute;
    display: block;
    width: 145px;
    color: white;
    font-size: 0.875rem;
    font-weight: bold;
    text-align: center;
    line-height: 25px;
    transform: rotate(-45deg);
    top: 30px;
    left: -30px;
}

/* Payment Method Icon from cart.php */
.payment-method-icon {
    width: 24px;
    height: 24px;
    color: #4B5563; /* gray-600 */
}
.dark .payment-method-icon {
    color: #D1D5DB; /* gray-300 */
}
.payment-method-icon svg { width: 100%; height: 100%; color: #768ebd;}


/* Back to Top Button */
.back-to-top-btn {
    position: fixed;
    bottom: 1.5rem;
    left: 1.5rem; /* Correct for RTL */
    z-index: 50;
    padding: 0.75rem; /* 12px */
    background-color: var(--color-primary);
    color: white;
    border-radius: 9999px; /* rounded-full */
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); /* shadow-lg */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s, background-color 0.2s;
}
.back-to-top-btn.visible { opacity: 0.5; visibility: visible; }
.back-to-top-btn:hover { opacity: 1; }

/* Share Buttons from y2admin/functions.php */
.share-btn { 
    display: inline-flex; 
    align-items: center; 
    justify-content: center; 
    width: 24px; 
    height: 24px; 
    border-radius: 9999px; 
    color: white; 
    transition: transform 0.2s; 
    font-size: 0.875rem; 
}
.share-btn:hover { transform: scale(1.1); }
.whatsapp-btn { background-color: #25D366; }
.email-btn { background-color: #777777; }
.facebook-btn { background-color: #1877F2; }
.twitter-btn { background-color: #000000; }
.copy-btn { background-color: var(--color-primary); }

/* Popup styles from y2admin/functions.php */
.popup-overlay { position: fixed; inset: 0; background-color: rgba(0,0,0,0.6); z-index: 1000; display: flex; align-items: center; justify-content: center; opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0.3s; }
.popup-overlay.visible { opacity: 1; visibility: visible; }
.popup-content { position: relative; padding: 2rem; border-radius: var(--border-radius-main); box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); max-width: 500px; width: 90%; transform: scale(0.95); transition: transform 0.3s; }
.popup-overlay.visible .popup-content { transform: scale(1); }
.popup-close-btn { position: absolute; top: 0.5rem; left: 0.5rem; background: transparent; border: 0; font-size: 1.5rem; line-height: 1; cursor: pointer; }

/* Variation Option Input from plugins/shop/shop-variations.php & shop-functions.php */
.variation-option-input:checked + label > div {
    border-color: var(--color-primary);
    --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
    --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);
    box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
    --tw-ring-color: var(--color-primary);
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 30%; /* 32px */
    left: 50%;
    transform: translateX(-50%);
    z-index: 1050; /* Above most elements */
    display: flex;
    flex-direction: column;
    gap: 0.5rem; /* 8px */
    align-items: center;
}
.toast {
    padding: 1rem 1.5rem;
    border-radius: 0.5rem; /* rounded-lg */
    color: white;
    font-weight: 600; /* font-semibold */
    text-align: center;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); /* shadow-lg */
    opacity: 0;
    transform: translateY(-20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.toast.show {
    opacity: 1;
    transform: translateY(0);
}
.toast-success { background-color: #16A34A; } /* green-600 */
.toast-error { background-color: #DC2626; } /* red-600 */
.toast-info { background-color: var(--color-primary); }

/* Confirmation Modal */
.confirm-modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 1040;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    direction: rtl;
}
.confirm-modal-content {
    background-color: white;
    padding: 1.5rem;
    border-radius: var(--border-radius-main);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -2px rgb(0 0 0 / 0.1); /* shadow-xl */
    width: 100%;
    max-width: 400px;
    text-align: center;
}
.dark .confirm-modal-content { background-color: #1F2937; } /* gray-800 */
.confirm-modal-title { font-size: 1.25rem; font-weight: 700; margin-bottom: 0.5rem; }
.confirm-modal-message { font-size: 1rem; color: #6B7280; margin-bottom: 1.5rem; }
.dark .confirm-modal-message { color: #D1D5DB; }
.confirm-modal-actions { display: flex; justify-content: center; gap: 1rem; }
.confirm-modal-btn { padding: 0.5rem 1.5rem; border: none; border-radius: 0.5rem; font-weight: 700; cursor: pointer; transition: background-color 0.2s; }
.btn-secondary { background-color: #E5E7EB; color: #1F2937; }
.dark .btn-secondary { background-color: #4B5563; color: #F9FAFB; }
.btn-secondary:hover { background-color: #D1D5DB; }
.dark .btn-secondary:hover { background-color: #6B7280; }
.btn-danger { background-color: #DC2626; color: white; }
.btn-danger:hover { background-color: #B91C1C; }

/* Flashing error animation for form validation */
@keyframes flash-error-shadow {
  0%, 100% { box-shadow: 0 0 0 2px rgba(220, 38, 38, 0); }
  50% { box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.5); }
}
.flash-error {
    animation: flash-error-shadow 0.7s 2; /* Run animation for 0.7s, twice */
    border-radius: var(--border-radius-main);
}

/* Product Review Star Rating from _product_reviews.php */
.star-rating > input:checked ~ label .fa-star,
.star-rating:not(:checked) > label:hover .fa-star,
.star-rating:not(:checked) > label:hover ~ label .fa-star {
    @apply fas text-amber-400;
}
.star-rating > input:checked + label:hover .fa-star,
.star-rating > input:checked ~ label:hover .fa-star,
.star-rating > input:checked ~ label:hover ~ label .fa-star,
.star-rating > label:hover ~ input:checked ~ label .fa-star {
    @apply fas text-amber-500;
}

/* Custom Tooltip for Color Swatches */
.custom-tooltip {
    position: relative;
    display: inline-block;
}

.custom-tooltip .tooltip-text {
    visibility: hidden;
    background-color: #1f2937; /* gray-800 */
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px 10px;
    position: absolute;
    z-index: 10;
    bottom: 140%; /* Position the tooltip further above */
    left: 50%;
    transform: translateX(-50%) scale(0.9); /* Start slightly smaller */
    opacity: 0;
    transition: opacity 0.2s ease-out, transform 0.2s ease-out;
    white-space: nowrap;
}

/* Add the arrow */
.custom-tooltip .tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #1f2937 transparent transparent transparent;
}

/* Show the tooltip on hover */
.custom-tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) scale(1); /* Scale to full size */
}


/* Jump Menu Styles */
.jump-menu-container {
    /* Mobile default styles (full width, static) */
    position: static;
    width: 100%;
    margin-bottom: 1.5rem; /* Space below on mobile */

    /* General styling */
    background-color: var(--color-card-bg);
    border: 1px solid #e5e7eb; /* gray-200 */
    border-radius: var(--border-radius-main);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); /* shadow-xl */
    padding: 1.5rem; /* Padding inside the container */
    z-index: 10; /* Ensure it stays above other content */
    align-self: flex-start; /* Important for sticky in flex containers */

    /* Desktop adjustments */
    @media (min-width: 1024px) { /* Tailwind's 'lg' breakpoint */
        position: sticky; /* Make it sticky on desktop */
        top: 120px; /* Space from the top when sticky, to account for the sticky header */
        /* width is handled by lg:w-1/4 in HTML */
        margin-bottom: 0; /* Remove bottom margin on desktop */
    }
}

.dark .jump-menu-container {
    background-color: #1f2937; /* Darker background for dark mode */
    border-color: #374151; /* Darker border for dark mode */
}


.jump-menu-title {
    font-size: 1.125rem; /* text-lg */
    font-weight: 800; /* font-extrabold */
    color: var(--color-text);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--color-primary);
}

.dark .jump-menu-title {
    color: #f3f4f6; /* Lighter text for dark mode */
}

.jump-menu-list {
    list-style: none; /* Remove default list bullets */
    padding: 0;
    margin: 0;
}

.jump-menu-list li {
    margin-bottom: 0.25rem; /* Tighter spacing */
}

.jump-menu-link {
    display: block; /* Make the entire link clickable */
    padding: 0.5rem 0.75rem; /* py-2 px-3 */
    color: #4b5563; /* text-gray-600 */
    text-decoration: none;
    border-radius: 0; /* Remove rounded corners */
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: center;
    border-right: 3px solid transparent;
    font-size: 0.95rem;
}

.dark .jump-menu-link {
    color: #9ca3af; /* gray-400 */
}

.jump-menu-link:hover,
.jump-menu-link.active {
    background-color: #f3f4f6; /* bg-gray-100 */
    color: var(--color-primary);
    border-right-color: var(--color-primary);
    padding-right: 1rem; /* Move text slightly left (RTL) */
}

.dark .jump-menu-link:hover,
.dark .jump-menu-link.active { 
    background-color: #374151; /* Darker hover background */ 
    color: var(--color-primary); 
}

/* Offset for fixed header when jumping to H2 anchors */
h2[id^="jump-"] {
    scroll-margin-top: 90px; /* Adjust this value based on your fixed header's actual height */
}

/* Text shadow for slider text */
.text-shadow { text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5); }
.text-shadow-md { text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.5); }

/* Subtle grow animation for WhatsApp button */
@keyframes subtle-grow {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.animate-subtle-grow {
  animation: subtle-grow 0.5s ease-in-out;
}

/* Cart Sidebar Layout Shift */
body {
    transition: padding-left 0.3s ease-in-out;
}

body.cart-is-open {
    /* 
       Match the width of the sidebar (max-w-md is 28rem / 448px).
       The sidebar is on the LEFT, so we add padding-left.
    */
    padding-left: 448px;
}

/* 
   Important: Keep overlay behavior on mobile to avoid 
   squeezing the content too much on small screens.
*/
@media (max-width: 768px) {
    body.cart-is-open {
        padding-left: 0 !important;
    }
}

/* Cart Badge Animation */
@keyframes cart-badge-pop {
  0% { transform: scale(1) rotate(0deg); }
  20% { transform: scale(1.5) rotate(-15deg); }
  40% { transform: scale(1.5) rotate(15deg); }
  60% { transform: scale(1.5) rotate(-15deg); }
  80% { transform: scale(1.2) rotate(0deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.cart-badge-animate {
  animation: cart-badge-pop 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  transform-origin: center center;
}
