
/* Form & Input Alignment Fixes for RTL */
input[type="tel"],
input[type="email"],
input[type="number"],
input[type="url"] {
    text-align: right;
}

/* 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 */
}

/* Aspect Ratio Utilities (for YouTube embeds, etc.) */
.aspect-w-16 {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
}
.aspect-h-9 {
    /* Used in conjunction with aspect-w-16 */
}

/* Ensure iframes fill the aspect-ratio container */
.aspect-w-16 > iframe,
.aspect-w-16 > video {
    width: 100%;
    height: 100% !important;
    border-radius: 0.75rem; /* rounded-xl */
    display: block;
}

/* Fallback for browsers without aspect-ratio support */
@supports not (aspect-ratio: 16 / 9) {
    .aspect-w-16 {
        padding-bottom: 56.25%;
        height: 0;
        overflow: hidden;
    }
    .aspect-w-16 > iframe,
    .aspect-w-16 > video {
        position: absolute;
        top: 0;
        left: 0;
    }
}


/* 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: 2rem;
    left: 2rem; /* Left side for RTL sites */
    z-index: 100;
    width: 3.5rem;
    height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border-radius: 1.25rem; /* Modern playful shape */
    box-shadow: 0 10px 25px -5px rgba(59, 130, 246, 0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) rotate(-10deg);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
}

.back-to-top-btn.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) rotate(0deg);
}

.back-to-top-btn:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    transform: translateY(-8px) scale(1.15) rotate(5deg);
    box-shadow: 0 15px 30px -5px rgba(59, 130, 246, 0.6);
    color: white;
}

.back-to-top-btn svg {
    width: 1.75rem;
    height: 1.75rem;
    transition: transform 0.3s ease;
}

.back-to-top-btn:hover svg {
    transform: translateY(-3px);
}

/* 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;
}

/* Footer Link Hover Effects */
footer a.transition-colors {
    transition: color 0.3s ease-in-out !important;
}

footer a.transition-colors:hover {
    color: var(--color-primary) !important;
}

/* Bottom Mobile Bar */
.bottom-mobile {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

@media (max-width: 768px) {
    .bottom-mobile {
        display: flex;
    }
    /* Add padding to body to prevent footer content overlap */
    body {
        padding-bottom: 70px;
    }
}

.bottom-mobile a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 0;
    text-decoration: none;
    color: white !important;
    font-weight: bold;
    font-size: 14px;
    gap: 4px;
    transition: background-color 0.2s;
}

.bottom-mobile a i {
    font-size: 22px;
}

.bottom-mobile .btn-call {
    background-color: #C2185B; /* Dark Pink */
}

.bottom-mobile .btn-whatsapp {
    background-color: #25D366; /* WhatsApp Green */
}

.bottom-mobile a:active {
    filter: brightness(0.9);
}
/* Dynamic Form within Content (Horizontal on Desktop) */
#the-content .in-content-form,
.the-content .in-content-form {
    margin: 2rem 0 !important;
    padding: 1.25rem 1.5rem !important;
    background: #f8fafc !important; /* Opaque solid color */
    border-radius: 1.5rem !important;
    border: 1px solid #cbd5e1 !important;
    box-shadow: 0 4px 15px -3px rgba(0, 0, 0, 0.05) !important;
    position: relative;
    overflow: visible !important;
}

.dark #the-content .in-content-form,
.dark .the-content .in-content-form {
    background: #1e293b !important;
    border-color: #334155 !important;
}

#the-content .in-content-form .dynamic-form,
.the-content .in-content-form .dynamic-form {
    display: flex !important;
    flex-direction: column !important;
    gap: 1rem !important;
}

@media (min-width: 1024px) {
    #the-content .in-content-form .dynamic-form,
    .the-content .in-content-form .dynamic-form {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        align-items: center !important; 
        justify-content: center !important;
        gap: 0.75rem !important;
    }

    #the-content .in-content-form .dynamic-form > div,
    .the-content .in-content-form .dynamic-form > div {
        flex: 0 1 180px !important;
        margin: 0 !important;
    }

    #the-content .in-content-form .dynamic-form label,
    .the-content .in-content-form .dynamic-form label {
        display: none !important;
    }

    #the-content .in-content-form .dynamic-form input,
    #the-content .in-content-form .dynamic-form select,
    .the-content .in-content-form .dynamic-form input,
    .the-content .in-content-form .dynamic-form select {
        height: 2.75rem !important; 
        border-radius: 0.75rem !important;
        padding: 0 1rem !important;
        font-size: 0.95rem !important;
    }

    #the-content .in-content-form .dynamic-form button[type="submit"],
    .the-content .in-content-form .dynamic-form button[type="submit"] {
        height: 2.75rem !important;
        border-radius: 0.75rem !important;
        padding: 0 1.5rem !important;
        font-size: 1rem !important;
        min-width: 140px !important;
    }

    /* Subtle, compact checkbox - CENTERED */
    #the-content .in-content-form .dynamic-form > div:has(input[type="checkbox"]),
    .the-content .in-content-form .dynamic-form > div:has(input[type="checkbox"]) {
        flex: 1 1 100% !important;
        margin-top: 0.5rem !important;
        font-size: 0.8rem !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    #the-content .in-content-form .dynamic-form input[type="checkbox"],
    .the-content .in-content-form .dynamic-form input[type="checkbox"] {
        transform: scale(0.8) !important;
        margin-left: 0.5rem !important;
    }

    /* Style for the new title */
    /* Ensure checkbox label is visible even if others are hidden */
    #the-content .in-content-form .dynamic-form > div:has(input[type="checkbox"]) label,
    .the-content .in-content-form .dynamic-form > div:has(input[type="checkbox"]) label {
        display: inline !important;
        cursor: pointer;
    }

    /* Style for the new title - Scoped to content */
    #the-content .in-content-form .inline-form-title,
    .the-content .in-content-form .inline-form-title {
        font-size: 1.4rem !important;
        font-weight: 900 !important;
        margin-bottom: 1.5rem !important;
        color: #0f172a !important;
        text-align: center;
        width: 100%;
    }

    .dark #the-content .in-content-form .inline-form-title,
    .dark .the-content .in-content-form .inline-form-title {
        color: #f8fafc !important;
    }
}

/* Fix for Prose interfering with form elements */
.prose .in-content-form .dynamic-form > div {
    margin-bottom: 0 !important;
}

.prose .in-content-form .dynamic-form input,
.prose .in-content-form .dynamic-form select {
    margin-top: 0 !important;
}

/* Core content image behavior - ensures alignment and responsiveness globally */
.the-content img, #the-content img {
    max-width: 100%;
    height: auto;
    display: inline-block; /* Allows text-align: center on parent to work */
    vertical-align: middle;
}
