/* ========================================
   AMERICAN MEAT - READY TO SHIP PAGE
   Version: 1.0
======================================== */

/* ========================================
   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 auto;
    width: calc(100% - 40px);
    max-width: 1400px;
    box-sizing: border-box;
}

/* ========================================
   HEADER CONTAINERS
======================================== */
.header-container {
    text-align: center;
    padding: 60px 20px 40px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

#category-selection .header-container {
    padding-top: 20px;
}

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

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

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

/* ========================================
   BACK BUTTONS & NAVIGATION
======================================== */
.back-btn {
    align-self: flex-start;
    margin-bottom: 10px;
    padding: 10px 16px;
    font-size: 0.9rem;
    min-width: 140px;
    white-space: nowrap;
}

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

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

/* ========================================
   CATEGORY SELECTION SCREEN
======================================== */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, 280px);
    gap: 25px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
    box-sizing: border-box;
    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:not(.out-of-stock):hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: var(--primary-color);
}

.category-card.out-of-stock {
    opacity: 0.6;
    cursor: not-allowed;
    background: #f5f5f5;
}

.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.out-of-stock .category-card-image {
    background: linear-gradient(135deg, #e9ecef 0%, #d3d3d3 100%);
}

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

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

.out-of-stock-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 1.5rem;
    font-weight: 600;
    text-transform: uppercase;
}

.category-image-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.category-image-loading .spinner {
    width: 30px;
    height: 30px;
    border-width: 3px;
}

.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-card.out-of-stock .product-count {
    color: #999;
    background: rgba(0, 0, 0, 0.1);
}

/* ========================================
   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;
    }
}

/* ========================================
   ACCESSORIES GRID
======================================== */
.accessories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
    gap: 20px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
    box-sizing: border-box;
}

.accessory-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;
}

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

.accessory-card-image {
    width: 100%;
    height: 180px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

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

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

.accessory-card-info {
    padding: 15px;
}

.accessory-card h3 {
    margin: 0 0 8px 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
}

.accessory-card .price {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary-color);
}

/* ========================================
   PRODUCTS GALLERY (Ready-made items)
======================================== */
.products-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr));
    gap: 20px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
    box-sizing: border-box;
}

.gallery-item {
    background-color: var(--card-background);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.gallery-item:not(.limit-unavailable):hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}


.rts-limit-status {
    display: inline-block;
    margin-top: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #888;
    background: rgba(0, 0, 0, 0.07);
    padding: 3px 10px;
    border-radius: 20px;
}

.rts-limit-status.waitlist-open {
    color: #7a4e00;
    background: rgba(180, 110, 0, 0.12);
}

.gallery-image-container {
    position: relative;
    height: 250px;
    overflow: hidden;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-item-info {
    padding: 15px;
}

.gallery-item h3 {
    margin: 0 0 8px 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
}

.gallery-item .price {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.gallery-item .inventory-badge {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(76, 175, 80, 0.1);
    color: #4CAF50;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Gallery Image Dots */
.gallery-image-dots {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 5px;
    z-index: 5;
    padding: 5px 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
}

.gallery-dot {
    height: 8px;
    width: 8px;
    background-color: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
}

.gallery-dot:hover {
    background-color: rgba(255, 255, 255, 0.9);
}

.gallery-dot.active {
    background-color: var(--primary-color);
    box-shadow: 0 0 5px rgba(44, 110, 127, 0.5);
}

/* Touch-friendly image containers */
.gallery-image-container,
.hero-image-container {
    touch-action: pan-y pinch-zoom;
    user-select: none;
    -webkit-user-select: none;
}

/* ========================================
   PRODUCT DETAIL SCREEN
======================================== */
.product-detail-container {
    display: flex;
    gap: 40px;
    max-width: 1200px;
    margin: 0 auto;
}

.product-images-column {
    flex: 1;
    max-width: 50%;
}

.product-info-column {
    flex: 1;
    max-width: 50%;
}

/* Hero Image */
.hero-image-container {
    width: 100%;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    overflow: hidden;
    background: white;
    margin-bottom: 20px;
    position: relative;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.hero-image-container:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.hero-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    max-height: 500px;
}

/* Thumbnail Grid */
.thumbnail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
}

.thumbnail {
    border: 2px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    aspect-ratio: 1;
}

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

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

.thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Product Info */
.product-description {
    margin-bottom: 25px;
    line-height: 1.6;
    color: #555;
}

.product-description h3 {
    font-size: 1.3rem;
    margin: 0 0 15px 0;
    color: var(--text-color);
}

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

.product-description ul {
    margin: 10px 0;
    padding-left: 20px;
}

.product-description li {
    margin: 5px 0;
}

.product-price {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 25px;
}

/* Color Selector (for suction plugs) */
#color-selector-container {
    margin-bottom: 25px;
}

#color-selector-container h3 {
    font-size: 1.2rem;
    margin: 0 0 15px 0;
    color: var(--text-color);
}

.color-selector {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(45px, 1fr));
    gap: 10px;
    max-width: 400px;
}

.color-swatch {
    width: 45px;
    height: 45px;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.color-swatch:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

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

.color-swatch[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: nowrap;
    z-index: 1000;
}

/* Inventory Status */
.inventory-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    padding: 12px;
    background: rgba(76, 175, 80, 0.1);
    border-radius: 8px;
    color: #4CAF50;
    font-weight: 600;
}

.inventory-status i {
    font-size: 1.2rem;
}

/* Add to Cart Button */
.add-to-cart-btn {
    width: 100%;
    padding: 16px 24px;
    font-size: 1.1rem;
    font-weight: 600;
    background: var(--success-color);
    border: none;
    transition: all 0.3s ease;
}

.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;
}

/* ========================================
   MODALS
======================================== */
.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;
}

/* Cart Success Modal */
.cart-success-header {
    background: var(--success-color);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.cart-success-header i {
    margin-right: 10px;
}

.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);
}

.cart-success-body {
    padding: 25px;
}

.item-summary {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e9ecef;
}

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

.item-image img {
    width: 100px;
    height: 100px;
    object-fit: contain;
    border: 2px solid #ddd;
    border-radius: 8px;
}

.item-details {
    flex: 1;
}

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

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

.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;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.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: #f5f5f5;
    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;
}

.quantity-btn:active {
    background: #dee2e6;
}

#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 {
    padding: 20px 25px;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 15px;
}

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

/* Image Preview Modal */
.image-preview-content {
    max-width: 900px;
    width: 90%;
}

.image-preview-content .modal-close {
    position: absolute;
    top: 10px;
    right: 20px;
    color: #555;
    z-index: 10;
}

.image-preview-content .modal-close:hover {
    color: var(--primary-color);
    background: rgba(0, 0, 0, 0.1);
}

.modal-image-container {
    padding: 30px;
    text-align: center;
}

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

.image-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 15px;
    padding: 10px;
}

.image-dots .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #ccc;
    cursor: pointer;
    transition: all 0.3s ease;
}

.image-dots .dot:hover {
    background-color: #888;
    transform: scale(1.2);
}

.image-dots .dot.active {
    background-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(44, 110, 127, 0.3);
}

/* ========================================
   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 modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ========================================
   RESPONSIVE DESIGN
======================================== */
@media (max-width: 1024px) {
    .product-detail-container {
        flex-direction: column;
        gap: 30px;
    }

    .product-images-column,
    .product-info-column {
        max-width: 100%;
    }

    .category-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

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

    .header-container {
        padding: 10px 10px 30px;
        gap: 8px;
    }

    #category-selection .header-container {
        padding-top: 10px;
    }

    .header-container h1,
    .header-container h2 {
        font-size: 1.5rem;
        word-wrap: break-word;
        max-width: 100%;
    }

    .category-subtitle {
        font-size: 0.95rem;
    }

    .back-btn,
    #view-cart-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
        min-width: auto;
    }

    .back-btn {
        margin-bottom: 10px;
    }

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

    .back-btn span,
    #view-cart-btn span {
        display: none;
    }

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

    .category-grid,
    .accessories-grid,
    .products-gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
        gap: 15px;
    }

    .thumbnail-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }

    .product-price {
        font-size: 1.6rem;
    }

    .product-info-column {
        padding: 0;
    }

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

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

    .item-image img {
        margin: 0 auto;
    }

    .gallery-item-info,
    .accessory-card-info,
    .category-card-content {
        padding: 12px;
    }

    .gallery-item h3,
    .accessory-card h3,
    .category-card h3 {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .screen.active {
        margin: 5px auto;
        padding: 10px;
        width: calc(100% - 10px);
    }

    .header-container {
        padding: 10px 5px 25px;
        gap: 6px;
    }

    #category-selection .header-container {
        padding-top: 10px;
    }

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

    .category-subtitle {
        font-size: 0.85rem;
    }

    .back-btn,
    #view-cart-btn {
        padding: 6px 10px;
        font-size: 0.75rem;
    }

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

    .category-grid,
    .accessories-grid,
    .products-gallery-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .thumbnail-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        gap: 8px;
    }

    .product-price {
        font-size: 1.4rem;
    }

    .add-to-cart-btn {
        padding: 14px 20px;
        font-size: 1rem;
    }

    .gallery-item-info,
    .accessory-card-info,
    .category-card-content {
        padding: 10px;
    }

    .product-info-column {
        padding: 0;
    }

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

    .cart-success-body {
        padding: 20px 15px;
    }

    .item-image img {
        width: 80px;
        height: 80px;
    }
}