/* ============================================================
   Apothecary Grade — Custom Styles
   Animations, transitions, WooCommerce overrides, and polish
   that go beyond Tailwind utility classes.
   ============================================================ */

/* ------------------------------------------------------------------
   Alpine.js — hide [x-cloak] elements until Alpine initialises
   ------------------------------------------------------------------ */
[x-cloak] {
    display: none !important;
}

/* ------------------------------------------------------------------
   Smooth scrolling
   ------------------------------------------------------------------ */
html {
    scroll-behavior: smooth;
}

/* ------------------------------------------------------------------
   Custom scrollbar (Webkit)
   ------------------------------------------------------------------ */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: #FFFDD0;
}
::-webkit-scrollbar-thumb {
    background: #71797E;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #5A6268;
}

/* ------------------------------------------------------------------
   Animations
   ------------------------------------------------------------------ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes pulse-soft {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.7; }
}

.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out both;
}

.animate-fade-in {
    animation: fadeIn 0.4s ease-out both;
}

.animate-slide-down {
    animation: slideDown 0.3s ease-out both;
}

.animate-shimmer {
    background: linear-gradient(90deg, transparent 30%, rgba(255,253,208,0.3) 50%, transparent 70%);
    background-size: 200% 100%;
    animation: shimmer 2s ease-in-out infinite;
}

/* Stagger children */
.stagger-children > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.10s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.20s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.30s; }
.stagger-children > *:nth-child(7) { animation-delay: 0.35s; }
.stagger-children > *:nth-child(8) { animation-delay: 0.40s; }

/* ------------------------------------------------------------------
   Product card hover effects
   ------------------------------------------------------------------ */
.product-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(54, 69, 79, 0.12);
}
.product-card .product-card-img {
    transition: transform 0.5s ease;
}
.product-card:hover .product-card-img {
    transform: scale(1.05);
}

/* ------------------------------------------------------------------
   Logo hover
   ------------------------------------------------------------------ */
.apothecary-logo img {
    max-height: 60px;
    width: auto;
    transition: opacity 0.2s ease;
}
.apothecary-logo:hover img {
    opacity: 0.85;
}

/* ------------------------------------------------------------------
   WooCommerce form styling overrides
   ------------------------------------------------------------------ */
.woocommerce form .form-row input.input-text,
.woocommerce form .form-row textarea,
.woocommerce form .form-row select {
    background-color: rgba(255, 253, 208, 0.4);
    border: 1px solid rgba(113, 121, 126, 0.2);
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.875rem;
    color: #36454F;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.woocommerce form .form-row input.input-text:focus,
.woocommerce form .form-row textarea:focus,
.woocommerce form .form-row select:focus {
    outline: none;
    border-color: rgba(113, 121, 126, 0.4);
    box-shadow: 0 0 0 3px rgba(113, 121, 126, 0.1);
}

.woocommerce form .form-row label {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #36454F;
    margin-bottom: 0.375rem;
}

/* ------------------------------------------------------------------
   WooCommerce buttons
   ------------------------------------------------------------------ */
.woocommerce a.button,
.woocommerce button.button,
.woocommerce input.button,
.woocommerce #respond input#submit,
.woocommerce a.button.alt,
.woocommerce button.button.alt,
.woocommerce input.button.alt {
    background-color: #36454F !important;
    color: #FFFDD0 !important;
    border: none !important;
    border-radius: 0.75rem !important;
    padding: 0.75rem 1.5rem !important;
    font-family: 'Inter', system-ui, sans-serif !important;
    font-size: 0.875rem !important;
    font-weight: 600 !important;
    letter-spacing: 0.025em;
    transition: background-color 0.2s ease, transform 0.15s ease !important;
    cursor: pointer;
}

.woocommerce a.button:hover,
.woocommerce button.button:hover,
.woocommerce input.button:hover,
.woocommerce a.button.alt:hover,
.woocommerce button.button.alt:hover,
.woocommerce input.button.alt:hover {
    background-color: #71797E !important;
    transform: translateY(-1px);
}

/* ------------------------------------------------------------------
   WooCommerce tabs
   ------------------------------------------------------------------ */
.woocommerce div.product .woocommerce-tabs ul.tabs {
    list-style: none;
    padding: 0;
    margin: 0 0 2rem 0;
    display: flex;
    gap: 0;
    border-bottom: 2px solid rgba(113, 121, 126, 0.15);
}

.woocommerce div.product .woocommerce-tabs ul.tabs li {
    background: none;
    border: none;
    margin: 0;
    padding: 0;
}

.woocommerce div.product .woocommerce-tabs ul.tabs li a {
    display: block;
    padding: 0.75rem 1.25rem;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #71797E;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.woocommerce div.product .woocommerce-tabs ul.tabs li.active a {
    color: #36454F;
    border-bottom-color: #36454F;
    font-weight: 600;
}

.woocommerce div.product .woocommerce-tabs ul.tabs li a:hover {
    color: #36454F;
}

/* ------------------------------------------------------------------
   WooCommerce price
   ------------------------------------------------------------------ */
.woocommerce div.product p.price,
.woocommerce div.product span.price {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: #36454F;
}

/* ------------------------------------------------------------------
   WooCommerce messages / notices
   ------------------------------------------------------------------ */
.woocommerce-message,
.woocommerce-info {
    border-top-color: #71797E !important;
    background-color: rgba(255, 253, 208, 0.5) !important;
}

.woocommerce-error {
    border-top-color: #c0392b !important;
}

/* ------------------------------------------------------------------
   Checkout step indicators
   ------------------------------------------------------------------ */
.checkout-step-indicator {
    position: relative;
}

.checkout-step-indicator .step-line {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: rgba(113, 121, 126, 0.15);
    transform: translateY(-50%);
    z-index: 0;
}

.checkout-step-indicator .step-dot {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}

.checkout-step-indicator .step-dot.active {
    background-color: #36454F;
    color: #FFFDD0;
    box-shadow: 0 0 0 4px rgba(54, 69, 79, 0.15);
}

.checkout-step-indicator .step-dot.completed {
    background-color: #71797E;
    color: white;
}

.checkout-step-indicator .step-dot.pending {
    background-color: rgba(113, 121, 126, 0.15);
    color: #71797E;
}

/* ------------------------------------------------------------------
   Star ratings
   ------------------------------------------------------------------ */
.woocommerce .star-rating {
    color: #71797E;
}

/* ------------------------------------------------------------------
   Sale badge
   ------------------------------------------------------------------ */
.woocommerce span.onsale {
    background-color: #36454F !important;
    color: #FFFDD0 !important;
    border-radius: 0.5rem !important;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem !important;
    min-height: auto !important;
    line-height: 1.5 !important;
}

/* ------------------------------------------------------------------
   Select2 overrides (WooCommerce uses Select2 for dropdowns)
   ------------------------------------------------------------------ */
.select2-container--default .select2-selection--single {
    background-color: rgba(255, 253, 208, 0.4) !important;
    border: 1px solid rgba(113, 121, 126, 0.2) !important;
    border-radius: 0.75rem !important;
    height: auto !important;
    padding: 0.5rem 1rem !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    font-family: 'Inter', system-ui, sans-serif !important;
    font-size: 0.875rem !important;
    color: #36454F !important;
    line-height: 1.5 !important;
}

/* ------------------------------------------------------------------
   Responsive tweaks
   ------------------------------------------------------------------ */
@media (max-width: 768px) {
    .woocommerce div.product .woocommerce-tabs ul.tabs {
        flex-direction: column;
        gap: 0;
    }
    .woocommerce div.product .woocommerce-tabs ul.tabs li a {
        border-bottom: 1px solid rgba(113, 121, 126, 0.1);
        border-left: 3px solid transparent;
        margin-bottom: 0;
    }
    .woocommerce div.product .woocommerce-tabs ul.tabs li.active a {
        border-bottom-color: rgba(113, 121, 126, 0.1);
        border-left-color: #36454F;
    }
}

/* ------------------------------------------------------------------
   Related products — uniform card height
   ------------------------------------------------------------------ */
#related-products .product-card {
    display: flex;
    flex-direction: column;
}

#related-products .product-card > .p-5,
#related-products .product-card > div:last-child {
    display: flex;
    flex-direction: column;
    flex: 1;
}

#related-products .product-card .flex.items-center.justify-between {
    margin-top: auto;
}

/* Title clamping for uniform card heights */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
