* {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

/* Fallback for all browsers */
*:focus {
    outline: none;
}

/* Modern approach - overrides :focus in supporting browsers */
*:focus-visible {
    outline: 3px solid black;
    outline-offset: 2px;
    border-radius: 10%;
}

/* loader styles */
.loader-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: #ffffff;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s ease;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #000; /* Boixy Black */
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error Styles */
.error-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255, 255, 255, 0.95);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.error-content h2 { font-size: 4rem; margin: 0; color: #d32f2f; }
.error-content p { font-size: 1.2rem; margin: 10px 0 20px; }
.retry-btn {
    padding: 10px 20px;
    background: #000;
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 1rem;
}

/* Enhanced focus for interactive elements */
button:focus,
button:focus-visible,
a:focus,
a:focus-visible,
input:focus,
input:focus-visible,
select:focus,
select:focus-visible,
textarea:focus,
textarea:focus-visible {
    outline: 3px solid black;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.2);
    border-radius: 10%;
}

button,
.add-to-cart-btn,
.checkout-btn,
.size-btn,
.color-btn {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Allow text selection for disabled state reading */
button:disabled {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

body {
    background-color: #E5E7EB;
    color: #111111;
    overflow-x: hidden;
    margin: 0; /* Remove default margin */
}

/* flexbox top navigation bar start */

.icon {
    width: 1.3rem;
    height: 1.3rem;
}

.flex {
    display: flex;
    gap: var(--gap, 1rem);
}

.logo {
    margin: 2rem;
    z-index: 1000; /* Ensure logo is above other elements */
}

.primary-header {
    display: flex;
    align-items: center; /* horizontally centers items */
    justify-content: space-between;
   /* position: relative;  */
    position: sticky;
    top: 0;
    z-index: 1000;
}

.mobile-nav-toggle {
    display: none;
}

.primary-navigation {
    list-style: none;
    padding: 0;
    margin: 0;
    background: white;
}

@media (max-width: 35em) {
    .primary-header {
        background: white;
        padding: 0.1rem 0;
    }

    .logo {
        margin: 2rem;
        z-index: 1000;
    }

    @supports not (backdrop-filter: blur(1rem)) {
        .primary-header {
            background: white;
        }
    }

    .primary-navigation {
        position: fixed; 
        z-index: 1000;
        inset: 0 0 0 30%;
        flex-direction: column;
        padding: min(30vh, 10rem) 2em;
        background: rgba(255, 255, 255, 0.98); 
        backdrop-filter: none;
        transform: translateX(100%);
        will-change: transform;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: -5px 0 15px rgba(0,0,0,0.1); /* visual separation */
    }

    .primary-navigation[data-visible="true"] {
        transform: translateX(0%);
    }

    /* Mobile nav item sizing and spacing */
    .primary-navigation a {
        font-size: 1.6rem;
        padding-block: 0.9rem;
        display: block; 
        line-height: 1.4;
        letter-spacing: 0.03em;
    }

    .primary-navigation a > [aria-hidden="true"] {
        margin-inline-end: 1rem; /* more space between icon and text */
    }

    .mobile-nav-toggle {
        display: block;
        position: absolute;
        z-index: 9999;
        background-color: transparent;
        background-image: url('../Assets/menu.png');
        background-repeat: no-repeat;
        background-size: contain;
        width: 1.7rem;
        height: 1.7rem;
        top: 2rem;
        right: 1rem;
        cursor: pointer;
        border: none;
    }

    .mobile-nav-toggle[aria-expanded="true"] {
        background-image: url('../Assets/close.png');
    }

    .nav-backdrop {
        position: fixed;
        inset: 0;
        z-index: 999;
        opacity: 0;
        pointer-events: none;
        transition: opacity 300ms ease-in;
    }

    .nav-backdrop[data-visible="true"] {
        opacity: 1;
        pointer-events: auto;
    }
}

@media (min-width: 35em) and (max-width: 55em) {
    .primary-navigation a > span[aria-hidden] {
        display: none;
    }
}

@media (min-width: 35em) {
    .primary-navigation {
        padding-block: 2.8rem;
        --gap: clamp(1.5rem, 5vw, 3rem);
        padding-inline: clamp(3rem, 8vw, 10rem);
        display: flex;
        position: absolute;
        right: 0;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 1000;
        justify-content: flex-end;
    }
    .logo {
        margin: 2rem;
        z-index: 1001; /* Ensure logo is above other elements*/
    }

    /* Ensure nav items stay on right side */
    .primary-header nav {
        display: flex;
        justify-content: flex-end;
    }
}

.primary-navigation a {
    color: black;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.2rem;
    transition: transform 0.3s ease, color 0.3s ease;
}

.primary-navigation a:hover {
    transform: scale(1.1);
    color: darkgray;
}

.primary-navigation a > [aria-hidden="true"] {
    font-weight: 700;
    margin-inline-end: 0.75rem;
}
/* flexbox top navigation bar end */

/* --- Cart Badge Styling --- */
.cart-badge {
    position: absolute;
    background-color: #ff0000;
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
    height: 1.2rem;
    min-width: 1.2rem;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    opacity: 0; /* Hidden by default if 0 */
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Show badge when it has content */
.cart-badge:not(:empty) {
    opacity: 1;
}

/* Mobile Positioning */
.mobile-cart-link {
    position: relative; /* Needed for absolute positioning */
}

.mobile-cart-link .cart-badge {
    top: -5px;
    right: -5px;
}

/* Desktop/Tablet Positioning */
.desktop-cart-link {
    position: relative;
    display: flex;
    align-items: center;
}

.desktop-cart-link .cart-badge {
    top: -8px;
    right: -10px;
    /* On tablet (text only), this ensures it sits nicely next to the word "Cart" */
}

/* --- The "POP" Animation --- */
@keyframes pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.5); }
    100% { transform: scale(1); }
}

.cart-badge.bump {
    animation: pop 0.3s ease-out;
}

/* Color Button Styles */
.color-options {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.color-btn {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border: 3px solid #ddd;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    outline: none;
    flex-shrink: 0;
    padding: 0;
}

.color-btn:hover {
    transform: scale(1.12);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.color-btn.active {
    border-color: #000;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
    animation: colorPulse 0.4s ease-out;
}

.color-btn:active {
    transform: scale(0.96);
}

@keyframes colorPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.25);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(0, 0, 0, 0);
    }
    100% {
        box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
    }
}

@media (max-width: 480px) {
    .color-btn {
        width: 44px;
        height: 44px;
    }
    
    .color-options {
        gap: 0.75rem;
    }
}