/* ========================================
   AMERICAN MEAT - CUSTOM ORDERS PAGE
   Version: 3.0 - Firebase Integration with Categories
======================================== */

/* ========================================
   MAIN CONTAINER & SCREEN MANAGEMENT
======================================== */
#main-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: calc(100vh - 120px);
    overflow-y: auto;
    padding: 0;
}

.screen {
    display: none;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s ease-in-out;
}

.screen.active {
    display: flex;
    flex-direction: column;
    opacity: 1;
    transform: translateY(0);
    background: var(--card-background);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin: 20px;
    width: calc(100% - 40px);
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

#customization.active {
    overflow: visible;
}

/* ========================================
   HEADER CONTAINERS & TYPOGRAPHY
======================================== */
.header-container {
    text-align: center;
    padding: 20px 0 40px;
    position: relative;
}

.header-container h1,
.header-container h2 {
    font-size: 2.2rem;
    font-weight: 600;
    margin: 0 0 10px 0;
    color: var(--text-color);
}

.category-subtitle,
#product-selection-subtitle {
    font-size: 1.1rem;
    color: #666;
    margin: 0;
    opacity: 0.8;
}

.customization-title {
    font-size: 1.8rem;
    margin: 0;
}

#customization .header-container {
    padding-top: 60px; /* Account for positioned buttons */
}

#product-selection .header-container {
    padding-top: 60px; /* Account for positioned back button */
}

/* ========================================
   BACK BUTTONS & NAVIGATION
======================================== */
.back-btn {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10;
    padding: 10px 16px;
    font-size: 0.9rem;
    min-width: 140px;
}

#view-cart-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
    padding: 10px 16px;
    font-size: 0.9rem;
    min-width: 120px;
}

.back-btn i,
#view-cart-btn i {
    margin-right: 8px;
}

/* ========================================
   CATEGORY SELECTION SCREEN
======================================== */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 280px));
    gap: 25px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    justify-content: center;
}

.category-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
    position: relative;
}

.category-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: var(--primary-color);
}

.category-card-image {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.category-card-image img {
    width: 80%;
    height: 80%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.category-card:hover .category-card-image img {
    transform: scale(1.1);
}

.category-card-content {
    padding: 20px;
    text-align: center;
}

.category-card h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin: 0 0 10px 0;
    color: var(--text-color);
}

.category-card p {
    font-size: 0.95rem;
    color: #666;
    margin: 0 0 15px 0;
    line-height: 1.5;
}

.category-card .product-count {
    font-size: 0.85rem;
    color: var(--primary-color);
    font-weight: 600;
    padding: 6px 12px;
    background: rgba(44, 110, 127, 0.1);
    border-radius: 20px;
    display: inline-block;
}

/* Category Grid Responsive Breakpoints */
/* Large tablets and small desktops */
@media (max-width: 1024px) {
    .category-grid {
        grid-template-columns: repeat(auto-fit, minmax(240px, 240px));
        gap: 20px;
        padding: 0 15px;
    }

    .category-card-image {
        height: 150px;
    }

    .category-card-content {
        padding: 18px;
    }

    .category-card h3 {
        font-size: 1.2rem;
    }

    .category-card p {
        font-size: 0.9rem;
    }
}

/* Tablets */
@media (max-width: 768px) {
    .category-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 220px));
        gap: 18px;
        padding: 0 10px;
    }

    .category-card-image {
        height: 135px;
    }

    .category-card-content {
        padding: 15px;
    }

    .category-card h3 {
        font-size: 1.1rem;
    }

    .category-card p {
        font-size: 0.85rem;
    }

    .category-card .product-count {
        font-size: 0.8rem;
        padding: 5px 10px;
    }
}

/* Large phones */
@media (max-width: 600px) {
    .category-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 180px));
        gap: 15px;
        padding: 0 10px;
    }

    .category-card-image {
        height: 110px;
    }

    .category-card-content {
        padding: 12px;
    }

    .category-card h3 {
        font-size: 1rem;
    }

    .category-card p {
        font-size: 0.8rem;
        margin-bottom: 10px;
    }

    .category-card .product-count {
        font-size: 0.75rem;
        padding: 4px 8px;
    }
}

/* Small phones */
@media (max-width: 480px) {
    .category-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 140px));
        gap: 12px;
        padding: 0 8px;
    }

    .category-card-image {
        height: 90px;
    }

    .category-card-content {
        padding: 10px;
    }

    .category-card h3 {
        font-size: 0.9rem;
        margin-bottom: 6px;
    }

    .category-card p {
        font-size: 0.75rem;
        margin-bottom: 8px;
    }

    .category-card .product-count {
        font-size: 0.7rem;
        padding: 3px 6px;
    }
}

/* Very small screens */
@media (max-width: 360px) {
    .category-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 120px));
        gap: 10px;
        padding: 0 6px;
    }

    .category-card-image {
        height: 75px;
    }

    .category-card-content {
        padding: 8px;
    }

    .category-card h3 {
        font-size: 0.85rem;
        margin-bottom: 5px;
    }

    .category-card p {
        font-size: 0.7rem;
        margin-bottom: 6px;
    }

    .category-card .product-count {
        font-size: 0.65rem;
        padding: 2px 5px;
    }
}

/* ========================================
   NO PRODUCTS AVAILABLE
======================================== */
.no-products-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 20px;
    max-width: 600px;
    margin: 0 auto;
}

.no-products-icon {
    font-size: 5rem;
    color: var(--primary-color);
    margin-bottom: 20px;
    opacity: 0.7;
}

.no-products-container h2 {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0 0 15px 0;
}

.no-products-container p {
    font-size: 1.1rem;
    color: #666;
    margin: 0 0 10px 0;
    line-height: 1.6;
}

.no-products-container p:last-child {
    font-weight: 500;
    color: var(--primary-color);
}

/* Responsive adjustments for no products container */
@media (max-width: 768px) {
    .no-products-container {
        padding: 40px 20px;
    }

    .no-products-icon {
        font-size: 4rem;
    }

    .no-products-container h2 {
        font-size: 1.6rem;
    }

    .no-products-container p {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .no-products-container {
        padding: 30px 15px;
    }

    .no-products-icon {
        font-size: 3rem;
    }

    .no-products-container h2 {
        font-size: 1.4rem;
    }

    .no-products-container p {
        font-size: 0.9rem;
    }
}

/* ========================================
   PRODUCT SELECTION SCREEN
======================================== */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 280px));
    gap: 25px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    justify-content: center;
}

.product-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
    position: relative;
    width: 100%; /* Ensure cards fill their grid cells */
    min-height: 220px; /* Consistent card height */
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    border-color: var(--primary-color);
}

/* Limit-blocked product card — still fully clickable, just visually muted */
.product-card.limit-blocked {
    opacity: 0.75;
}

.product-card.limit-blocked h3::after {
    content: ' — Check Back Soon';
    font-size: 0.75em;
    font-weight: 400;
    color: #888;
}

/* Disabled Add to Cart button when order limits are active */
#add-to-cart-btn:disabled,
#add-to-cart-btn-images:disabled {
    background: #adb5bd;
    cursor: not-allowed;
    opacity: 0.8;
}

.product-card-image {
    width: 100%;
    height: 140px; /* Fixed height for consistency */
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.product-card img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.product-card:hover img {
    transform: scale(1.05);
}

.product-card h3 {
    padding: 15px;
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
    text-align: center;
    line-height: 1.3;
    height: 60px; /* Fixed height for title consistency */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Product Grid Responsive Breakpoints */
/* Large tablets and small desktops */
@media (max-width: 1024px) {
    .product-grid {
        grid-template-columns: repeat(auto-fit, minmax(240px, 240px));
        gap: 20px;
        padding: 0 15px;
    }

    .product-card {
        min-height: 270px;
    }

    .product-card-image {
        height: 165px;
    }

    .product-card h3 {
        font-size: 1.05rem;
        height: 60px;
        padding: 14px;
    }
}

/* Tablets */
@media (max-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 220px));
        gap: 18px;
        padding: 0 10px;
    }

    .product-card {
        min-height: 250px;
    }

    .product-card-image {
        height: 150px;
    }

    .product-card h3 {
        font-size: 1rem;
        height: 58px;
        padding: 12px;
    }
}

/* Large phones */
@media (max-width: 600px) {
    .product-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 180px));
        gap: 15px;
        padding: 0 10px;
    }

    .product-card {
        min-height: 210px;
    }

    .product-card-image {
        height: 125px;
    }

    .product-card h3 {
        font-size: 0.95rem;
        height: 52px;
        padding: 10px;
    }
}

/* Small phones */
@media (max-width: 480px) {
    .product-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 140px));
        gap: 12px;
        padding: 0 8px;
    }

    .product-card {
        min-height: 170px;
    }

    .product-card-image {
        height: 100px;
    }

    .product-card h3 {
        font-size: 0.85rem;
        height: 45px;
        padding: 8px;
    }
}

/* Very small screens */
@media (max-width: 360px) {
    .product-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 120px));
        gap: 10px;
        padding: 0 6px;
    }

    .product-card {
        min-height: 150px;
    }

    .product-card-image {
        height: 85px;
    }

    .product-card h3 {
        font-size: 0.8rem;
        height: 42px;
        padding: 6px;
    }
}

/* ========================================
   CUSTOMIZATION SCREEN
======================================== */
.customization-container {
    display: flex;
    flex-direction: row;
    gap: 30px;
    width: 100%;
    max-width: 1300px;
    margin: 0 auto;
}

.preview-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 50%;
    align-self: flex-start;
}

.options-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 50%;
    position: relative;
}

/* ========================================
   PREVIEW SECTION
======================================== */
.preview {
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#preview-images {
    position: relative;
    width: 100%;
    max-width: 320px;
    height: 320px;
    margin: 20px auto;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    background: white;
    overflow: hidden;
}

#preview-layers {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transition: opacity 180ms ease;
}

.preview-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.view-buttons {
    display: flex;
    gap: 12px;
    margin: 20px 0;
    justify-content: center;
    width: 100%;
}

.view-btn {
    padding: 10px 20px;
    border: 2px solid var(--primary-color);
    background: white;
    color: var(--primary-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    min-width: 120px;
}

.view-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.view-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(44, 110, 127, 0.3);
}

.view-btn i {
    margin-right: 6px;
}

.preview-config-text {
    font-size: 0.85rem;
    color: #666;
    text-align: center;
    white-space: pre-line;
    margin: 15px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    min-height: 60px;
    line-height: 1.4;
    display: none; /* Hidden by default, can be shown for debugging */
}

.add-to-cart-btn {
    width: 100%;
    max-width: 280px;
    padding: 15px 25px;
    font-size: 1.05rem;
    font-weight: 600;
    margin: 20px auto 0;
    background: var(--success-color);
    border: none;
    transition: all 0.3s ease;
    display: block;
}

.add-to-cart-btn:hover {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.3);
}

.add-to-cart-btn i {
    margin-right: 8px;
}

/* ========================================
   OPTIONS SECTION
======================================== */
.options-content,
.color-grid-content {
    width: 100%;
    height: 100%;
    padding: 10px;
}

.options {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.options h3 {
    font-size: 1.3rem;
    margin: 0 0 20px 0;
    color: var(--text-color);
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 2px solid #e9ecef;
}

.option-group {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 15px 0;
    min-height: 50px;
    width: 100%;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
    position: relative;
}

.option-group label {
    flex: 1;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    color: var(--text-color);
    padding: 12px 20px;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.option-group label:hover {
    background: linear-gradient(135deg, #bbdefb 0%, #90caf9 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.option-group label.active {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--hover-color) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(44, 110, 127, 0.3);
}

.option-group label.single-choice {
    background: linear-gradient(135deg, #90caf9 0%, #64b5f6 100%);
    border-color: #64b5f6;
    color: white;
    cursor: default;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.option-group label.single-choice:hover {
    background: linear-gradient(135deg, #90caf9 0%, #64b5f6 100%);
    transform: none;
    color: white;
}

.selection-box {
    width: 32px;
    height: 32px;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.3s ease;
    position: relative;
}

.selection-box.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(44, 110, 127, 0.2);
}

.selection-box[data-value="none"] {
    background: linear-gradient(45deg, transparent 46%, #ff4444 46%, #ff4444 54%, transparent 54%),
                linear-gradient(-45deg, transparent 46%, #ff4444 46%, #ff4444 54%, transparent 54%);
    border-color: #ff4444;
}

.selection-box.single-choice {
    cursor: default;
    border-color: #999;
    box-shadow: 0 0 0 3px #f5f5f5;
}

.selection-box.dropdown-single-choice {
    width: auto;
    min-width: 80px;
    padding: 6px 12px;
    text-align: center;
    font-size: 0.9rem;
    color: #333;
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
    border-radius: 6px;
}

.selection-box.single-choice[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 115%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: normal;
    max-width: 200px;
    text-align: center;
    z-index: 10000;
    opacity: 1;
    pointer-events: none;
}

.selection-box.single-choice[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    bottom: 105%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
    z-index: 10000;
}

.option-group select {
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
    min-width: 140px;
}

.option-group select:focus {
    border-color: var(--primary-color);
    outline: none;
}

.option-group.disabled {
    opacity: 0.6;
    pointer-events: none;
}

.conflict-indicator {
    position: absolute;
    right: -25px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--error-color);
    font-weight: bold;
    font-size: 1.2rem;
    background: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(244, 67, 54, 0.3);
}

/* ========================================
   COLOR GRID SECTION
======================================== */
.color-grid-content {
    display: flex;
    flex-direction: column;
    animation: slideInFromRight 0.3s ease-out;
    overflow: visible;
}

.color-grid-content.closing {
    animation: slideOutToRight 0.3s ease-out;
}

.color-grid-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
}

.color-grid-header h3 {
    margin: 0;
    font-size: 1.4rem;
    color: var(--text-color);
}

#color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(45px, 1fr));
    gap: 12px;
    flex: 1;
    padding: 40px 20px 10px 20px;
    max-height: 400px;
    overflow-y: auto;
}

.swatch {
    width: 45px;
    height: 45px;
    max-width: 45px;
    max-height: 45px;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.swatch:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.swatch.selected {
    border-color: #333;
    border-width: 3px;
    transform: scale(1.05);
    box-shadow: 0 0 0 3px rgba(51, 51, 51, 0.3);
}

.swatch[data-value="none"] {
    background: 
        linear-gradient(45deg, transparent 46%, #ff4444 46%, #ff4444 54%, transparent 54%),
        linear-gradient(-45deg, transparent 46%, #ff4444 46%, #ff4444 54%, transparent 54%),
        white;
    border-color: #ff4444;
}

.color-grid-separator {
    grid-column: 1 / -1;
    text-align: center;
    padding: 15px 10px;
    margin: 10px 0;
    border-top: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
    background: #f8f9fa;
    border-radius: 6px;
}

.separator-title {
    font-weight: 600;
    color: #666;
    font-size: 1rem;
    margin-bottom: 4px;
}

.separator-description {
    font-weight: 400;
    color: #888;
    font-size: 0.85rem;
    font-style: italic;
}

.color-grid-footer {
    margin-top: 20px;
    display: flex;
    justify-content: center;
}

/* ========================================
   TOOLTIPS
======================================== */
.swatch {
    position: relative;
}

.custom-tooltip {
    position: fixed;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    text-align: center;
    z-index: 10000;
    pointer-events: none;
    animation: tooltipFadeIn 0.2s ease-out;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   DETAILED PREVIEW MODAL
======================================== */
.detailed-modal {
  z-index: 2000;
}

.detailed-modal .modal-content {
  max-width: 900px;
  width: 95%;
}

.detailed-modal .modal-body {
  padding: 25px;
}

.modal-views {
  display: flex;
  gap: 25px;
  margin: 20px 0;
}

.view-container {
  flex: 1;
  text-align: center;
}

.view-container h4 {
  margin: 0 0 15px 0;
  font-size: 1.2rem;
  color: var(--text-color);
  font-weight: 600;
}

.modal-preview {
  position: relative;
  width: 100%;
  height: 300px;
  border: 2px solid #ddd;
  border-radius: 10px;
  overflow: hidden;
  background: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.modal-preview-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.preview-error {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #999;
  font-size: 0.9rem;
  text-align: center;
}

/* Mobile responsive for detailed modal */
@media (max-width: 768px) {
  .modal-views {
    flex-direction: column;
    gap: 20px;
  }
  
  .view-container {
    width: 100%;
  }
  
  .modal-preview {
    height: 250px;
  }
  
  .view-container h4 {
    font-size: 1.1rem;
  }
  
  .detailed-modal .modal-content {
    width: 98%;
    margin: 10px;
  }
}

@media (max-width: 480px) {
  .modal-views {
    gap: 15px;
  }
  
  .modal-preview {
    height: 200px;
  }
  
  .view-container h4 {
    font-size: 1rem;
    margin-bottom: 10px;
  }
  
  .detailed-modal .modal-body {
    padding: 15px;
  }
}
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 16px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

.modal-header {
    background: var(--success-color);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
}

.modal-header i {
    margin-right: 10px;
    font-size: 1.2rem;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 25px;
    overflow-y: auto;
    overflow-x: visible;
    max-height: calc(90vh - 200px);
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 15px;
}

/* ========================================
   CART SUCCESS MODAL SPECIFIC
======================================== */
.item-summary {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e9ecef;
}

.item-image {
    flex-shrink: 0;
}

#success-preview-images {
    position: relative;
    width: 100px;
    height: 100px;
    border: 2px solid #ddd;
    border-radius: 10px;
    overflow: hidden;
    background: white;
    cursor: pointer;
    transition: transform 0.2s ease;
}

#success-preview-images:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.modal-preview-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.item-details {
    flex: 1;
}

.item-details h4 {
    margin: 0 0 12px 0;
    color: var(--text-color);
    font-size: 1.3rem;
    font-weight: 600;
}

#success-item-config {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.5;
    margin-bottom: 15px;
}

.item-price {
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--primary-color);
}

.quantity-controls {
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 15px;
    justify-content: center;
}

.quantity-controls label {
    font-weight: 600;
    color: var(--text-color);
    font-size: 1rem;
}

.quantity-input-group {
    display: flex;
    align-items: center;
    border: 2px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: white;
}

.quantity-btn {
    background: #f8f9fa;
    border: none;
    padding: 10px 14px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: background-color 0.3s ease;
    color: var(--primary-color);
    font-weight: bold;
}

.quantity-btn:hover {
    background: #e9ecef;
}

#item-quantity {
    border: none;
    text-align: center;
    width: 70px;
    padding: 10px 8px;
    font-size: 1.1rem;
    font-weight: 600;
    outline: none;
    background: white;
}

.cart-summary {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 20px;
    border-radius: 10px;
    text-align: center;
}

.cart-total {
    font-size: 1.3rem;
    color: var(--text-color);
    font-weight: 600;
}

.cart-item-count {
    font-size: 0.95rem;
    color: #666;
    margin-top: 8px;
}

.cart-success-actions {
    gap: 15px;
}

.cart-success-actions .btn {
    flex: 1;
    padding: 14px 20px;
    font-size: 1rem;
    font-weight: 600;
}

/* ========================================
   LOADING STATES
======================================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-content {
    text-align: center;
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.loading-content p {
    margin: 20px 0 0 0;
    font-size: 1.1rem;
    color: #666;
}

/* ========================================
   ANIMATIONS
======================================== */
@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutToRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

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

/* ========================================
   RESPONSIVE DESIGN
======================================== */
@media (max-width: 1024px) {
    #main-container {
        padding: 0;
    }

    .screen.active {
        margin: 10px;
        padding: 15px;
        width: calc(100% - 20px);
    }

    #customization.active {
        overflow: visible;
    }

    .customization-container {
        flex-direction: column;
        gap: 20px;
    }

    .preview-column,
    .options-column {
        max-width: 100%;
        width: 100%;
    }

    #preview-images {
        max-width: 280px;
        height: 280px;
    }

    .back-btn,
    #view-cart-btn {
        position: absolute;
        top: 15px;
        padding: 8px 12px;
        font-size: 0.85rem;
        min-width: 120px;
    }

    .back-btn {
        left: 15px;
    }

    #view-cart-btn {
        right: 15px;
    }

    #customization .header-container {
        padding-top: 50px;
    }

    #product-selection .header-container {
        padding-top: 50px;
    }

    .header-container h1,
    .header-container h2 {
        font-size: 1.8rem;
    }

    .customization-title {
        font-size: 1.5rem;
    }

    .option-group {
        flex-direction: column;
        gap: 10px;
        max-width: 320px;
        align-items: center;
    }

    .option-group label {
        width: 100%;
        max-width: 280px;
    }

    .selection-box {
        order: 2;
    }

    .color-grid-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    #color-grid {
        grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
        gap: 10px;
    }

    .swatch {
        width: 40px;
        height: 40px;
        max-width: 40px;
        max-height: 40px;
    }

    .view-buttons {
        gap: 10px;
    }

    .view-btn {
        padding: 8px 16px;
        font-size: 0.85rem;
        min-width: 110px;
    }

    .add-to-cart-btn {
        max-width: 100%;
        font-size: 1rem;
        padding: 12px 20px;
    }
}

@media (max-width: 600px) {
    .screen.active {
        margin: 5px;
        padding: 10px;
        border-radius: 8px;
    }

    .header-container {
        padding: 15px 0 25px;
    }

    .header-container h1,
    .header-container h2 {
        font-size: 1.5rem;
    }

    .category-subtitle,
    #product-selection-subtitle {
        font-size: 1rem;
    }

    .category-card-image,
    .product-card-image {
        height: 140px;
    }

    .category-card-content,
    .product-card h3 {
        padding: 12px;
    }

    #preview-images {
        max-width: 240px;
        height: 240px;
    }

    .back-btn,
    #view-cart-btn {
        top: 10px;
        padding: 6px 10px;
        font-size: 0.8rem;
        min-width: 100px;
    }

    .back-btn {
        left: 10px;
    }

    #view-cart-btn {
        right: 10px;
    }

    #customization .header-container {
        padding-top: 45px;
    }

    #product-selection .header-container {
        padding-top: 45px;
    }

    .modal-content {
        margin: 10px;
        max-width: calc(100% - 20px);
    }

    .modal-body {
        padding: 20px;
    }

    .item-summary {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }

    #success-preview-images {
        width: 80px;
        height: 80px;
        margin: 0 auto;
    }

    .cart-success-actions {
        flex-direction: column;
    }

    .cart-success-actions .btn {
        width: 100%;
        margin-bottom: 10px;
    }

    .quantity-controls {
        flex-wrap: wrap;
        justify-content: center;
    }

    .modal-body {
        max-height: calc(90vh - 220px);
        padding: 15px;
    }

    .modal-footer {
        padding: 15px;
    }

    .modal-content {
        max-height: 95vh;
    }

    #color-grid {
        grid-template-columns: repeat(auto-fill, minmax(35px, 1fr));
    }

    .swatch {
        width: 35px;
        height: 35px;
        max-width: 35px;
        max-height: 35px;
    }
}

@media (max-width: 480px) {
    .modal-body {
        max-height: calc(90vh - 240px);
        padding: 12px;
    }

    .modal-footer {
        padding: 12px;
    }

    .cart-success-actions .btn {
        padding: 12px 16px;
        font-size: 0.95rem;
    }
}

/* ========================================
   ERROR & NOTE STATES
======================================== */
.note {
    margin: 10px 0;
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 0.9rem;
    text-align: center;
}

.note.error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ef5350;
    line-height: 1.6;
}

#color-grid-message {
    margin-top: 15px;
    padding: 15px;
    border-radius: 8px;
    font-size: 0.95rem;
    max-width: 90%;
    margin-left: auto;
    margin-right: auto;
    position: relative;
}

#color-grid-message .message-text {
    display: inline-block;
    padding-right: 35px;
    line-height: 1.6;
}

#color-grid-message .help-icon {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 1.3rem;
    color: #c62828;
    cursor: pointer;
    transition: all 0.3s ease;
}

#color-grid-message .help-icon:hover {
    transform: scale(1.2);
    color: #b71c1c;
}

#color-grid-message .help-icon.active {
    transform: scale(1.1);
    color: #1976d2;
}

#color-grid-message .help-text {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #ef5350;
    line-height: 1.6;
    animation: slideDown 0.3s ease;
}

#color-grid-message .help-text strong {
    display: block;
    margin-bottom: 8px;
    font-size: 1.05rem;
    color: #b71c1c;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 200px;
    }
}

.note.warning {
    background: #fff8e1;
    color: #f57c00;
    border: 1px solid #ffb74d;
}

.note.info {
    background: #e3f2fd;
    color: #1976d2;
    border: 1px solid #64b5f6;
}

/* ========================================
   SINGLE CHOICE MESSAGE
======================================== */
.single-choice-message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.single-choice-message.show {
    opacity: 1;
}

.single-choice-message-content {
    background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 400px;
}

.single-choice-message-content i {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.single-choice-message-content p {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.4;
}

/* ========================================
   ACCESSIBILITY IMPROVEMENTS
======================================== */
button:focus,
select:focus,
input:focus,
.swatch:focus,
.product-card:focus,
.category-card:focus {
    outline: 3px solid rgba(44, 110, 127, 0.5);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========================================
   HIGH CONTRAST MODE SUPPORT
======================================== */
@media (prefers-contrast: high) {
    .swatch {
        border-width: 3px;
    }

    .option-group label {
        border: 2px solid currentColor;
    }

    .category-card,
    .product-card {
        border: 2px solid currentColor;
    }
}

/* ========================================
   PRODUCT DESCRIPTION CONTAINER
======================================== */
.product-description-container {
    width: 100%;
    max-width: 100%;
    margin: 30px auto 0;
    padding: 25px;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    text-align: center;
}

.product-description-container h3 {
    font-size: 1.4rem;
    margin: 0 0 20px 0;
    color: var(--text-color);
    font-weight: 600;
}

.product-description-content {
    font-size: 1rem;
    line-height: 1.6;
    color: #555;
    text-align: left;
    max-width: 900px;
    margin: 0 auto;
}

.product-description-content p {
    margin: 0 0 10px 0;
}

.product-description-content p:last-child {
    margin-bottom: 0;
}

/* Product Description Replacement (for products without options) */
.product-description-replacement {
    width: 100%;
    padding: 30px 20px;
    background: linear-gradient(135deg, #f9f9f9 0%, #ffffff 100%);
    border-radius: 12px;
    border: 2px solid #e0e0e0;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.product-description-replacement h3 {
    font-size: 1.5rem;
    margin: 0 0 25px 0;
    color: var(--primary-color);
    font-weight: 600;
}

.product-description-replacement .product-description-content {
    font-size: 1.05rem;
    line-height: 1.8;
    color: #444;
    text-align: left;
    max-width: 100%;
    margin: 0;
}

.product-description-replacement .product-description-content p {
    margin: 0 0 15px 0;
}

.product-description-replacement .product-description-content p:last-child {
    margin-bottom: 0;
}

/* ========================================
   IMAGE PREVIEW CONTAINER
======================================== */
.image-preview-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
}

.image-hero-container {
    width: 100%;
    aspect-ratio: 1;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.image-hero-container:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(44, 110, 127, 0.15);
}

.image-hero {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.2s ease;
}

.image-hero-container:hover .image-hero {
    transform: scale(1.05);
}

.image-thumbnails-container {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.image-thumbnail {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0.6;
}

.image-thumbnail:hover {
    opacity: 1;
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.image-thumbnail.active {
    opacity: 1;
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(44, 110, 127, 0.2);
}

/* ========================================
   PREVIEW MODE SWITCH BUTTON
======================================== */
.preview-mode-switch {
    margin-top: 15px;
    width: 100%;
    padding: 12px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.preview-mode-switch i {
    transition: transform 0.3s ease;
}

.preview-mode-switch:hover i {
    transform: rotate(180deg);
}

/* ========================================
   IMAGE MODAL
======================================== */
.image-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.9);
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-modal.show {
    opacity: 1;
}

.image-modal .modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: transparent;
    box-shadow: none;
}

.image-modal-content {
    display: flex;
    align-items: center;
    gap: 20px;
}

.image-modal-body {
    max-width: 80vw;
    max-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
}

.image-nav-btn {
    position: relative;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--text-color);
    transition: all 0.2s ease;
    z-index: 10;
}

.image-nav-btn:hover {
    background: white;
    transform: scale(1.1);
}

.image-nav-btn:active {
    transform: scale(0.95);
}

.image-modal .modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--text-color);
    transition: all 0.2s ease;
    z-index: 10;
}

.image-modal .modal-close:hover {
    background: white;
    transform: scale(1.1) rotate(90deg);
}

.image-modal-indicator {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--text-color);
}

/* ========================================
   RESPONSIVE ADJUSTMENTS FOR NEW FEATURES
======================================== */
@media (max-width: 768px) {
    .product-description-container {
        padding: 15px;
        margin-top: 20px;
    }

    .product-description-container h3 {
        font-size: 1.1rem;
    }

    .product-description-content {
        font-size: 0.9rem;
    }

    .product-description-replacement {
        padding: 20px 15px;
        min-height: 150px;
    }

    .product-description-replacement h3 {
        font-size: 1.2rem;
        margin-bottom: 18px;
    }

    .product-description-replacement .product-description-content {
        font-size: 0.95rem;
        line-height: 1.6;
    }

    .image-thumbnail {
        width: 60px;
        height: 60px;
    }

    .preview-mode-switch {
        font-size: 0.85rem;
        padding: 10px;
    }

    .image-nav-btn {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .image-modal .modal-close {
        width: 35px;
        height: 35px;
        font-size: 1.2rem;
    }

    .image-modal-indicator {
        font-size: 0.8rem;
        padding: 6px 12px;
    }
}

@media (max-width: 480px) {
    .image-thumbnails-container {
        gap: 8px;
    }

    .image-thumbnail {
        width: 50px;
        height: 50px;
    }

    .image-nav-btn {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }

    .modal-image {
        max-height: 70vh;
    }

    .product-description-replacement {
        padding: 15px 10px;
        min-height: 120px;
    }

    .product-description-replacement h3 {
        font-size: 1.1rem;
        margin-bottom: 15px;
    }

    .product-description-replacement .product-description-content {
        font-size: 0.9rem;
        line-height: 1.5;
    }
}

/* ========================================
   TOAST NOTIFICATIONS (expandable toast extras)
   Base toast styles are in shared/styles/notifications.css
======================================== */
.toast-why-link {
    background: none;
    border: none;
    color: #666;
    font-size: 12px;
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
    text-align: left;
    transition: color 0.2s;
}

.toast-why-link:hover {
    color: #333;
}

.toast-why-link.active {
    color: #2196f3;
}

.toast-explanation {
    margin-top: 4px;
    padding: 12px;
    background: #f5f5f5;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.6;
    color: #555;
}

.toast-explanation strong {
    color: #333;
}

/* ========================================
   MOBILE SPLIT-SCREEN COLOR PICKER
   Active when body.mobile-split-active on ≤1024px
   (single-column layout)
======================================== */
@media (max-width: 1024px) {
    /*
     * shared.css sets `body > * { position: relative; z-index: 1 }` which makes
     * #main-container a stacking context at z-index: 1 in the root — lower than
     * the sticky header's z-index: 400. The fixed panels inside #main-container
     * can't escape that stacking order, so they appear behind the header/footer.
     * Raising #main-container above the header while split is active fixes this.
     *
     * Additionally, .screen.active carries `transform: translateY(0)` which,
     * even as an identity transform, creates a nested stacking context and makes
     * position:fixed children position relative to that element instead of the
     * viewport. That is removed via JS inline style in showColorGrid() because
     * the element's own `transition: all` would intercept a pure CSS override.
     */
    body.mobile-split-active #main-container,
    body.mobile-split-closing #main-container {
        z-index: 1500;
    }

    /* CSS fallback — belt-and-suspenders alongside the JS inline style */
    body.mobile-split-active #customization.active,
    body.mobile-split-closing #customization.active {
        transform: none;
    }

    /* Top panel: preview column fixed to top half */
    body.mobile-split-active .preview-column,
    body.mobile-split-closing .preview-column {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        height: 50vh;
        height: 50dvh;
        z-index: 1100;
        background: var(--card-background, white);
        overflow: hidden;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 10px 16px 0;
        border-bottom: 2px solid #e9ecef;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
        align-self: auto;
    }

    body.mobile-split-active .preview-column {
        animation: splitTopSlideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    }

    body.mobile-split-closing .preview-column {
        animation: splitTopSlideOut 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    }

    /* Bottom panel: color grid in its own fixed panel */
    body.mobile-split-active #mobile-grid-panel,
    body.mobile-split-closing #mobile-grid-panel {
        position: fixed;
        top: 50vh;
        top: 50dvh;
        bottom: 0;
        left: 0;
        width: 100%;
        z-index: 1100;
        background: var(--card-background, white);
        overflow-y: auto;
        overflow-x: hidden;
        border-top: 2px solid #e9ecef;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    }

    body.mobile-split-active #mobile-grid-panel {
        animation: splitBottomSlideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    }

    body.mobile-split-closing #mobile-grid-panel {
        animation: splitBottomSlideOut 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    }

    /* Push options column down to fill the space vacated by the fixed preview panel */
    body.mobile-split-active .options-column,
    body.mobile-split-closing .options-column {
        margin-top: 50vh;
        margin-top: 50dvh;
    }

    /* Let mobile-grid-panel handle all scrolling; disable inner scroll on color grid */
    body.mobile-split-active #mobile-grid-panel #color-grid {
        max-height: none;
        overflow-y: visible;
        padding-top: 10px;
    }

    body.mobile-split-active #mobile-grid-panel .color-grid-content {
        overflow: visible;
    }

    /* Hide non-essential buttons in the split preview panel */
    body.mobile-split-active .preview-column .add-to-cart-btn,
    body.mobile-split-active .preview-column #add-to-cart-btn,
    body.mobile-split-active .preview-column #add-to-cart-btn-images,
    body.mobile-split-active .preview-column #preview-mode-switch-btn {
        display: none !important;
    }

    /* Scale SVG preview to fit comfortably in the top half */
    body.mobile-split-active #preview-images {
        max-width: 185px;
        height: 185px;
        margin: 4px auto;
    }

    /* Compact the color grid header in split mode */
    body.mobile-split-active .color-grid-header {
        margin-bottom: 10px;
        padding-bottom: 10px;
    }

    /* View buttons tighter in split mode */
    body.mobile-split-active .view-buttons {
        margin: 8px 0 4px;
    }
}

@keyframes splitTopSlideIn {
    from { transform: translateY(-100%); opacity: 0.6; }
    to   { transform: translateY(0);     opacity: 1;   }
}

@keyframes splitTopSlideOut {
    from { transform: translateY(0);     opacity: 1;   }
    to   { transform: translateY(-100%); opacity: 0.6; }
}

@keyframes splitBottomSlideIn {
    from { transform: translateY(100%);  opacity: 0.6; }
    to   { transform: translateY(0);     opacity: 1;   }
}

@keyframes splitBottomSlideOut {
    from { transform: translateY(0);     opacity: 1;   }
    to   { transform: translateY(100%);  opacity: 0.6; }
}