/* Custom scrollbar and aesthetics */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #020617;
}

::-webkit-scrollbar-thumb {
    background: #1e293b;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #334155;
}

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

/* =============================================
   RESPONSIVE & CROSS-BROWSER FIXES
   Applies to all screen sizes and browsers
   ============================================= */

/* Better font rendering across browsers */
body {
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Prevent long words / URLs from breaking layouts on small screens */
p, li, h1, h2, h3, h4, span, label {
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Navbar backdrop-filter cross-browser */
nav {
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

/* Prevent horizontal scroll on all screens */
html, body {
    max-width: 100%;
    overflow-x: hidden;
}

/* Respect user motion preferences */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ---- TINY PHONE (<375px) tweaks ---- */
@media (max-width: 374px) {
    h1 {
        font-size: clamp(1.75rem, 8vw, 2.25rem) !important;
    }
    .filter-btn {
        font-size: 0.65rem !important;
        padding: 0.375rem 0.625rem !important;
    }
    header.relative.overflow-hidden {
        padding-top: 2.5rem !important;
        padding-bottom: 3.5rem !important;
    }
}

/* ---- MOBILE — product icon and card sizing ---- */
@media (max-width: 639px) {
    #product-icon-container {
        font-size: 4rem !important;
    }
    .product-card .relative.h-64 {
        height: 10rem !important;
    }
    .border-2.border-dashed.rounded-2xl {
        padding: 1.5rem !important;
    }
}

/* ---- FORM ELEMENTS — consistent cross-browser ---- */
input, textarea, select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    font-size: max(1rem, 16px);
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%2394a3b8' stroke-width='2' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem !important;
    cursor: pointer;
}

/* ---- FOCUS VISIBLE — keyboard accessibility ---- */
:focus-visible {
    outline: 2px solid #f97316;
    outline-offset: 2px;
    border-radius: 4px;
}

/* ---- PRINT STYLES ---- */
@media print {
    nav, footer, #mobile-menu, #cart-btn, #mobile-menu-button {
        display: none !important;
    }
    body {
        background: white !important;
        color: black !important;
    }
}

/* ---- FIREFOX — scrollbar styling ---- */
* {
    scrollbar-width: thin;
    scrollbar-color: #1e293b #020617;
}