/* ============================================================
   SCRUMPTIOUS BY HA — Custom Styles
   Tailwind CSS via CDN handles the utility classes.
   This file adds custom components, animations, and overrides.
   ============================================================ */

/* ---- CSS Custom Properties (Brand Tokens) ---- */
:root {
    --color-primary-50: #FDF8F7;
    --color-primary-100: #F9EDEB;
    --color-primary-200: #F5E6E3;
    --color-primary-300: #E8C4C0;
    --color-primary-400: #D4A09A;
    --color-primary-500: #C9A09B;
    --color-primary-600: #B76E79;
    --color-primary-700: #9E5A64;
    --color-primary-800: #7A4550;
    --color-primary-900: #5C333D;

    --color-accent: #B76E79;
    --color-accent-hover: #A35D67;
    --color-accent-light: #E8C4C0;

    --bg-page: #FDF8F7;
    --bg-card: #FFFFFF;
    --bg-surface: #F5E6E3;

    --font-display: 'Playfair Display', Georgia, serif;
    --font-script: 'Great Vibes', cursive;
    --font-body: 'DM Sans', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

/* ---- Alpine.js FOUC prevention ---- */
[x-cloak] { display: none !important; }

/* ---- Base Styles ---- */
html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-page);
    color: #2D2D2D;
    line-height: 1.6;
}

/* ---- Typography ---- */
.font-display { font-family: var(--font-display); }
.font-script { font-family: var(--font-script); }
.font-body { font-family: var(--font-body); }

h1, h2, h3 { font-family: var(--font-display); }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 2rem;
    border-radius: 9999px;
    font-weight: 500;
    font-size: 0.9375rem;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
    text-decoration: none;
    line-height: 1.4;
}

.btn-primary {
    background-color: var(--color-accent);
    color: white;
    border-color: var(--color-accent);
}
.btn-primary:hover {
    background-color: var(--color-accent-hover);
    border-color: var(--color-accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(183, 110, 121, 0.3);
}

.btn-outline {
    background-color: transparent;
    color: var(--color-accent);
    border-color: var(--color-accent);
}
.btn-outline:hover {
    background-color: var(--color-accent);
    color: white;
    transform: translateY(-1px);
}

.btn-white {
    background-color: white;
    color: var(--color-accent);
    border-color: white;
}
.btn-white:hover {
    background-color: var(--color-primary-50);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.btn-sm {
    padding: 0.5rem 1.25rem;
    font-size: 0.8125rem;
}
.btn-lg {
    padding: 1rem 2.5rem;
    font-size: 1.0625rem;
}

.btn:disabled, .btn.loading {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* ---- Cards ---- */
.card {
    background: var(--bg-card);
    border-radius: 0.75rem;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.08);
}

/* ---- Product Card ---- */
.product-card {
    position: relative;
}
.product-card .product-image {
    aspect-ratio: 4/3;
    overflow: hidden;
}
.product-card .product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}
.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-card .wishlist-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 10;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 9999px;
    background: rgba(255,255,255,0.9);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}
.product-card .wishlist-btn:hover {
    background: white;
    transform: scale(1.1);
}
.product-card .wishlist-btn.active svg {
    fill: #C75C5C;
    color: #C75C5C;
}

.product-card .quick-view {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(45, 45, 45, 0.85);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    color: white;
    text-align: center;
    padding: 0.75rem;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
}
.product-card:hover .quick-view {
    transform: translateY(0);
}

/* Badge styles */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}
.badge-sale { background: #C75C5C; color: white; }
.badge-new { background: var(--color-accent); color: white; }
.badge-sold-out { background: #525252; color: white; }
.badge-low-stock { background: #D4A853; color: white; }
.badge-gf { background: #7CAA8E; color: white; }
.badge-vegan { background: #6B9BD2; color: white; }

/* ---- Animations ---- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}
@keyframes slideInLeft {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}
@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
@keyframes cartBounce {
    0% { transform: scale(1); }
    25% { transform: scale(1.3); }
    50% { transform: scale(0.9); }
    100% { transform: scale(1); }
}
@keyframes heartFill {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}
@keyframes toastSlideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes toastSlideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

.animate-fade-in { animation: fadeIn 0.5s ease forwards; }
.animate-fade-in-up { animation: fadeInUp 0.6s ease forwards; }
.animate-slide-in-right { animation: slideInRight 0.4s ease forwards; }
.animate-slide-up { animation: slideUp 0.4s ease forwards; }
.animate-bounce { animation: bounce 2s ease-in-out infinite; }
.animate-cart-bounce { animation: cartBounce 0.4s ease; }
.animate-heart-fill { animation: heartFill 0.3s ease; }

/* ---- Skeleton Loader ---- */
.skeleton {
    background: linear-gradient(90deg, #F5E6E3 25%, #FDF8F7 50%, #F5E6E3 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 0.5rem;
}

/* ---- Toast Notifications ---- */
.toast-container {
    position: fixed;
    top: 5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 24rem;
}
.toast {
    padding: 1rem 1.25rem;
    border-radius: 0.75rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    animation: toastSlideIn 0.4s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    line-height: 1.4;
}
.toast.closing {
    animation: toastSlideOut 0.3s ease forwards;
}
.toast-success { background: #F0FDF4; border-left: 4px solid #7CAA8E; color: #14532d; }
.toast-error { background: #FEF2F2; border-left: 4px solid #C75C5C; color: #7f1d1d; }
.toast-info { background: #EFF6FF; border-left: 4px solid #6B9BD2; color: #1e3a5f; }
.toast-warning { background: #FFFBEB; border-left: 4px solid #D4A853; color: #78350f; }

/* ---- Mobile Navigation Drawer ---- */
.nav-drawer {
    position: fixed;
    inset: 0;
    z-index: 9998;
    pointer-events: none;
}
.nav-drawer.open { pointer-events: auto; }
.nav-drawer .backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.4);
    opacity: 0;
    transition: opacity 0.3s ease;
}
.nav-drawer.open .backdrop { opacity: 1; }
.nav-drawer .drawer-content {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: min(85vw, 380px);
    background: white;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    box-shadow: -4px 0 20px rgba(0,0,0,0.1);
}
.nav-drawer.open .drawer-content {
    transform: translateX(0);
}

/* ---- Cart Drawer ---- */
.cart-drawer {
    position: fixed;
    inset: 0;
    z-index: 9997;
    pointer-events: none;
}
.cart-drawer.open { pointer-events: auto; }
.cart-drawer .backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.4);
    opacity: 0;
    transition: opacity 0.3s ease;
}
.cart-drawer.open .backdrop { opacity: 1; }
.cart-drawer .drawer-content {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: min(90vw, 420px);
    background: white;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 20px rgba(0,0,0,0.1);
}
.cart-drawer.open .drawer-content {
    transform: translateX(0);
}

/* ---- Scroll behaviour ---- */
.header-sticky {
    position: sticky;
    top: 0;
    z-index: 100;
    transition: box-shadow 0.3s ease, background-color 0.3s ease, padding 0.3s ease;
}
.header-sticky.scrolled {
    box-shadow: 0 2px 20px rgba(0,0,0,0.08);
    background-color: rgba(255,255,255,0.97) !important;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

/* Header logo — enlarged at top, shrinks on scroll */
.header-logo {
    height: 4.875rem;  /* 78px — base at top (mobile) */
}
@media (min-width: 768px) {
    .header-logo {
        height: 5.85rem;  /* ~94px — base at top (desktop) */
    }
}
.header-sticky.scrolled .header-logo {
    height: 3.25rem;  /* 52px — compact on scroll (mobile) */
}
@media (min-width: 768px) {
    .header-sticky.scrolled .header-logo {
        height: 3.9rem;  /* ~62px — compact on scroll (desktop) */
    }
}

/* ---- Hero Section ---- */
.hero-section {
    position: relative;
    min-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
/* Prevent FOUC: hero content starts hidden until animation runs */
.hero-section .animate-fade-in-up {
    opacity: 0;
    transform: translateY(20px);
}
@media (max-width: 639px) {
    .hero-section { min-height: 70vh; }
}
.hero-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}
.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(93, 51, 61, 0.65) 0%,
        rgba(183, 110, 121, 0.5) 50%,
        rgba(201, 160, 155, 0.4) 100%
    );
}

/* ---- Section Dividers ---- */
.divider-wave { display: block; width: 100%; line-height: 0; }
.divider-wave svg { display: block; width: 100%; height: auto; }

/* ---- Forms ---- */
.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid #E5E5E5;
    border-radius: 0.75rem;
    font-family: var(--font-body);
    font-size: 0.9375rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background: white;
    color: #2D2D2D;
}
.form-input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(183, 110, 121, 0.15);
}
.form-input::placeholder { color: #A3A3A3; }
.form-input.error { border-color: #C75C5C; }

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #404040;
    margin-bottom: 0.375rem;
}

.form-error {
    font-size: 0.8125rem;
    color: #C75C5C;
    margin-top: 0.25rem;
}

/* ---- WhatsApp Float ---- */
.whatsapp-float {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 90;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 9999px;
    background: #25D366;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.35);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-decoration: none;
}
.whatsapp-float:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.45);
}
.whatsapp-float svg { width: 1.75rem; height: 1.75rem; }

/* ---- Cookie Banner ---- */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9990;
    background: white;
    box-shadow: 0 -2px 20px rgba(0,0,0,0.1);
    transform: translateY(100%);
    transition: transform 0.4s ease;
    padding: 1.25rem 1.5rem;
}
.cookie-banner.show {
    transform: translateY(0);
}

/* ---- Lightbox ---- */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0,0,0,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}
.lightbox-overlay img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 0.5rem;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-page); }
::-webkit-scrollbar-thumb { background: var(--color-primary-300); border-radius: 9999px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-accent); }

/* ---- Print Styles ---- */
@media print {
    .no-print,
    header, footer, .announcement-bar,
    .whatsapp-float, .cookie-banner,
    .cart-drawer, .nav-drawer,
    .toast-container { display: none !important; }
    body { background: white !important; }
    .print-break { page-break-before: always; }
}

/* ---- Focus Styles (Accessibility) ---- */
*:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}
button:focus-visible, a:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* ---- Responsive helpers ---- */
@media (max-width: 639px) {
    .container { padding-left: 1rem; padding-right: 1rem; }
    .btn { padding: 0.625rem 1.5rem; font-size: 0.875rem; }
    .btn-lg { padding: 0.75rem 2rem; font-size: 1rem; }
}

/* ---- HTMX Loading Indicator ---- */
.htmx-indicator {
    display: none;
}
.htmx-request .htmx-indicator {
    display: inline-flex;
}
.htmx-request.htmx-indicator {
    display: inline-flex;
}

/* Spinner */
.spinner {
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
.spinner-dark {
    border-color: rgba(0,0,0,0.1);
    border-top-color: var(--color-accent);
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Hide scrollbar utility */
.scrollbar-hidden {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.scrollbar-hidden::-webkit-scrollbar {
    display: none;
}

/* Line clamp utility */
.line-clamp-1 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    line-clamp: 1;
}
.line-clamp-2 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}

/* Prose styles (basic) */
.prose p { margin-bottom: 1em; }
.prose ul, .prose ol { margin-bottom: 1em; padding-left: 1.5em; }
.prose li { margin-bottom: 0.25em; }
.prose h2, .prose h3 { margin-top: 1.5em; margin-bottom: 0.5em; font-weight: 600; }
.prose a { color: var(--color-accent); text-decoration: underline; }
.prose strong { font-weight: 600; }
