/* ────────────────────────────────────────────────
   Share Menu
──────────────────────────────────────────────── */
.share-menu {
    backdrop-filter: blur(6px);
}

/* ────────────────────────────────────────────────
   Card Base
──────────────────────────────────────────────── */
.flip-card {
    position: relative;
    perspective: 1000px;
}

.card-img {
    width: 100%;
    height: auto;
    object-fit: cover;
    display: block;
}

/* ────────────────────────────────────────────────
   Flip Structure
──────────────────────────────────────────────── */
.flip-inner {
    position: relative;
    width: 100%;
    transition: transform 0.6s ease;
    transform-style: preserve-3d;
}

.flip-card.flipped .flip-inner {
    transform: rotateY(180deg);
}

/* ────────────────────────────────────────────────
   Front & Back Faces
──────────────────────────────────────────────── */
.flip-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;

    border-radius: inherit;

    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    /* Safari */

    transform-style: preserve-3d;

    /* 🔥 Safari GPU stabilization */
    transform: translateZ(0);
}

.flip-front {
    position: relative;
    width: 100%;
    z-index: 2;

    border-radius: inherit;

    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;

    transform-style: preserve-3d;
    transform: translateZ(0);
}

.flip-back {
    transform: rotateY(180deg);
    background-color: white;
    padding: 1.5rem;
    box-sizing: border-box;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ────────────────────────────────────────────────
   Scrollable Links Section
──────────────────────────────────────────────── */
.links-scroll-container {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    /* critical for flex scrolling */

    margin-top: 1rem;
    margin-bottom: 1rem;
    padding-right: 0.25rem;

    scrollbar-width: thin;
    scrollbar-color: #c1c1c1 #f1f1f1;
}



/* ──────────────────────────────────────────────── */
/* HALF-SIZE CARDS - Always have entire back scrollable */
/* ──────────────────────────────────────────────── */
.flip-back.half {
    overflow-y: auto;
    /* Make entire back scrollable */
}

.flip-back.half .links-scroll-container {
    overflow-y: visible;
    /* Remove individual scrolling */
    flex: none;
    /* Remove flex growth */
    min-height: auto;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    padding-right: 0;
}

/* Custom scrollbar styling */
.links-scroll-container::-webkit-scrollbar {
    width: 4px;
}

.links-scroll-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.links-scroll-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

.links-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}


/* ──────────────────────────────────────────────── */
/* SMALL SCREEN ADJUSTMENTS (768px and below) */
/* ──────────────────────────────────────────────── */
@media (max-width: 768px) {

    /* Make entire back of card scrollable on small screens for ALL cards */
    .flip-back {
        overflow-y: auto;
        /* Changed from hidden to auto */
    }

    /* Remove scrolling from links container since entire card back scrolls */
    .flip-back .links-scroll-container {
        overflow-y: visible;
        flex: none;
        /* Remove flex growth since container handles overflow */
        min-height: auto;
        margin-top: 0.5rem;
        margin-bottom: 0.5rem;
        padding-right: 0;
    }

    /* Adjust padding on mobile for better touch targets */
    .flip-back {
        padding: 1.25rem;
    }

    /* Title size adjustment for mobile */
    .flip-back h2 {
        font-size: 1.75rem;
        line-height: 1.3;
    }
}

/* Alternative: For even smaller screens (640px and below) */
@media (max-width: 640px) {
    .flip-back {
        padding: 1rem;
    }

    .flip-back h2 {
        font-size: 1.5rem;
    }
}

.checkbox-indeterminate {
    background-color: #3b82f6 !important;
    border-color: #3b82f6 !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10h8'/%3e%3c/svg%3e");
}

/* Zoom Modal */
.zoom-modal {
    display: flex;
    opacity: 0;
    pointer-events: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    cursor: default;
}

.zoom-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.zoom-image-container {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    padding: 0 20px;
    /* 1 inch on each side */
    box-sizing: border-box;
}

.zoom-image-wrapper {
    position: relative;
    transform-origin: center center;
    will-change: transform;
    max-width: 100%;
    max-height: 100%;
}

.zoom-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    /* Ensure entire image is visible */
    display: block;
    user-select: none;
    -webkit-user-drag: none;
}

.zoom-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 1001;
}

.zoom-btn {
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
}

.zoom-btn:hover {
    background-color: rgba(255, 255, 255, 0.4);
}

.zoom-indicator {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    pointer-events: none;
    z-index: 1001;
}

.zoom-frame {
    position: absolute;
    top: 0;
    left: 20px;
    right: 20px;
    bottom: 0;
    pointer-events: none;
    z-index: 999;
}

/* Cursor classes */
.cursor-grab {
    cursor: grab;
}

.cursor-grabbing {
    cursor: grabbing;
}

/* Amazon-style Slim Header Behavior */
#fullSearchFilters {
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

#slimHeader {
    transition: transform 0.3s ease-out;
}

#slimHeader input {
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
}

/* Optional: subtle shadow when slim header is visible */
#slimHeader.translate-y-0 {
    box-shadow: 0 4px 14px -4px rgba(0, 0, 0, 0.15);
}

#categoryDropdownSlim {
    right: 0 !important;
    /* better alignment on mobile */
}

@media (max-width: 640px) {
    #slimHeader .flex {
        flex-wrap: wrap;
        gap: 8px;
    }

    #slimHeader .max-w-3xl {
        max-width: 100%;
    }
}
