/* Mobile-First Shopping Experience for Sunnyhill Suds */

/* Mobile Product Grid - Optimized for touch */
@media (max-width: 768px) {
    /* Category Filter - Horizontal Scroll */
    .category-filter {
        display: flex;
        overflow-x: auto;
        gap: 0.4rem;
        padding: 0.5rem 0;
        margin: 0 -20px 0.5rem;
        padding-left: 20px;
        padding-right: 20px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    
    .category-filter::-webkit-scrollbar {
        display: none;
    }
    
    .filter-btn {
        flex-shrink: 0;
        padding: 0.4rem 0.9rem;
        font-size: 0.8rem;
        white-space: nowrap;
        border: 1.5px solid var(--primary-color);
        background: white;
        color: var(--primary-color);
        border-radius: 20px;
        font-weight: 500;
        transition: all 0.3s ease;
    }
    
    .filter-btn.active {
        background: var(--primary-color);
        color: white;
    }
    
    /* Product Grid - Single Column for Mobile */
    .products-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 0;
    }
    
    /* Product Cards - Horizontal Layout for Mobile */
    .product-card {
        display: flex;
        flex-direction: row;
        background: white;
        border-radius: 12px;
        overflow: hidden;
        box-shadow: 0 2px 8px rgba(0,0,0,0.08);
        cursor: pointer;
        transition: all 0.3s ease;
        min-height: 140px;
    }
    
    .product-card:active {
        transform: scale(0.98);
        box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    }
    
    .product-card .product-image {
        width: 140px;
        height: 140px;
        object-fit: cover;
        flex-shrink: 0;
    }
    
    .product-card .product-info {
        padding: 1rem;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        flex: 1;
    }
    
    .product-card .product-info h3 {
        font-size: 1.1rem;
        margin-bottom: 0.3rem;
        line-height: 1.3;
        color: var(--text-dark);
    }
    
    .product-card .product-price {
        font-size: 1.2rem;
        font-weight: 700;
        color: var(--primary-color);
        margin: 0.3rem 0;
    }
    
    .product-card .product-description {
        display: none;
    }
    
    .product-card .btn {
        display: none;
    }
    
    /* Hide sold out button on mobile product cards */
    .product-card .btn-sold-out {
        display: none !important;
    }
    
    /* Sold out overlay for mobile */
    .product-image-wrapper {
        position: relative;
    }
    
    .sold-out-overlay {
        font-size: 0.9rem;
        padding: 12px 24px;
        letter-spacing: 1px;
        min-width: 140px;
        min-height: 60px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Mobile Product Modal - Full Screen */
    #productModal {
        z-index: 9999;
    }
    
    #productModal.active {
        display: flex !important;
        align-items: flex-end;
    }
    
    #productModal .modal-content {
        max-width: 100%;
        max-height: 95vh;
        margin: 0;
        border-radius: 20px 20px 0 0;
        animation: slideUp 0.3s ease;
        overflow-y: auto;
    }
    
    @keyframes slideUp {
        from {
            transform: translateY(100%);
        }
        to {
            transform: translateY(0);
        }
    }
    
    #productModal .modal-content.product-modal {
        padding: 1rem 1.5rem 1.5rem;
        margin-top: 60px;
    }
    
    #productModal .modal-content .close {
        position: sticky;
        top: 1rem;
        right: 0;
        background: white;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.5rem;
        z-index: 10;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        margin-left: auto;
        margin-bottom: 1rem;
    }
    
    /* Product Detail - Mobile Optimized */
    .product-detail {
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .product-detail-image {
        width: 100%;
        height: auto;
        border-radius: 12px;
        max-height: 300px;
        object-fit: cover;
    }
    
    .product-detail h2 {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }
    
    .product-detail .product-price {
        font-size: 1.8rem;
        font-weight: 700;
        color: var(--primary-color);
        margin-bottom: 1rem;
    }
    
    /* Product Options - Mobile Friendly */
    .product-options {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }
    
    .option-group {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .option-group label {
        font-weight: 600;
        font-size: 0.95rem;
        color: var(--text-dark);
    }
    
    .option-group select,
    .option-group input[type="number"] {
        padding: 0.9rem;
        font-size: 1rem;
        border: 2px solid #e0e0e0;
        border-radius: 10px;
        background: white;
        -webkit-appearance: none;
        appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 1rem center;
        padding-right: 2.5rem;
    }
    
    .option-group input[type="number"] {
        background-image: none;
        padding-right: 0.9rem;
    }
    
    /* Modifier Checkboxes - Larger Touch Targets */
    .modifier-checkboxes label {
        display: flex !important;
        align-items: center;
        padding: 0.9rem;
        background: #f8f9fa;
        border-radius: 10px;
        margin: 0.5rem 0 !important;
        cursor: pointer;
        transition: all 0.2s ease;
    }
    
    .modifier-checkboxes label:active {
        background: #e9ecef;
    }
    
    .modifier-checkboxes input[type="checkbox"] {
        width: 24px;
        height: 24px;
        margin-right: 0.8rem;
        cursor: pointer;
    }
    
    /* Add to Cart Button - Sticky on Mobile */
    .add-to-cart-btn {
        position: sticky;
        bottom: 0;
        width: 100%;
        padding: 1rem;
        font-size: 1.1rem;
        font-weight: 600;
        border-radius: 12px;
        margin-top: 1.5rem;
        background: var(--secondary-color);
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        z-index: 10;
    }
    
    /* Hide sold out button on mobile in product details modal */
    .add-to-cart-btn.btn-sold-out {
        display: none !important;
    }
    
    /* Cart Modal - Uses default styling from style.css (same across all pages) */
    
    /* Cart Notification - Simple Top Toast */
    .cart-notification {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        transform: translateY(-100%);
        background: var(--primary-color);
        color: white;
        padding: 1rem 1.5rem;
        z-index: 10000;
        transition: transform 0.3s ease;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    }
    
    .cart-notification.show {
        transform: translateY(0);
    }
    
    .cart-notification-content {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.8rem;
    }
    
    .cart-notification-icon {
        font-size: 1.5rem;
    }
    
    .cart-notification-text {
        flex: 1;
        text-align: left;
    }
    
    .cart-notification-text strong {
        display: block;
        font-size: 0.95rem;
        margin-bottom: 0.1rem;
        font-weight: 600;
    }
    
    .cart-notification-text p {
        font-size: 0.85rem;
        margin: 0;
        opacity: 0.9;
    }
    
    .cart-notification-close {
        background: none;
        border: none;
        font-size: 1.3rem;
        color: white;
        cursor: pointer;
        padding: 0.3rem;
        opacity: 0.8;
    }
    
    .cart-notification-view-btn {
        display: none;
    }
    
    /* Page Header - Compact on Mobile */
    .page-header {
        padding: 1rem 20px 0.8rem;
    }
    
    .page-header h1 {
        font-size: 1.6rem;
        margin-bottom: 0.3rem;
    }
    
    .page-header p {
        font-size: 0.75rem;
        margin-bottom: 0;
        line-height: 1.4;
    }
    
    /* Hide shop section padding that creates blank space */
    .shop-section {
        padding-top: 0 !important;
    }
    
    .shop-section .container {
        padding-top: 0 !important;
    }
    
    /* Category Description - Move to header area on mobile */
    #categoryDescription {
        display: none !important;
    }
    
    /* Loading State */
    .loading {
        padding: 3rem 1rem;
        text-align: center;
        font-size: 1rem;
    }
    
    /* Quick Add to Cart - For Simple Products */
    .product-card-quick-add {
        display: none;
        position: absolute;
        bottom: 1rem;
        right: 1rem;
        background: var(--primary-color);
        color: white;
        border: none;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        font-size: 1.2rem;
        cursor: pointer;
        box-shadow: 0 2px 8px rgba(0,0,0,0.2);
        transition: all 0.2s ease;
    }
    
    .product-card:hover .product-card-quick-add {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Smooth Scrolling for product modal */
    #productModal .modal-content {
        scroll-behavior: smooth;
    }
    
    /* Touch Feedback */
    .filter-btn:active,
    .btn:active,
    button:active {
        opacity: 0.8;
    }
    
    /* Prevent text selection on buttons */
    .filter-btn,
    .btn,
    button,
    .product-card {
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }
    
    /* Custom Dialogs - Top Toast Style on Mobile */
    .custom-dialog-overlay {
        background: transparent !important;
        align-items: flex-start !important;
    }
    
    .custom-dialog {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        border-radius: 0 0 16px 16px !important;
        transform: translateY(-100%) !important;
        transition: transform 0.3s ease !important;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
    }
    
    .custom-dialog-overlay.show .custom-dialog {
        transform: translateY(0) !important;
    }
    
    .custom-dialog-header {
        padding: 1rem 1.5rem !important;
        border-radius: 0 !important;
    }
    
    .custom-dialog-header h3 {
        font-size: 1rem !important;
    }
    
    .custom-dialog-body {
        padding: 1rem 1.5rem !important;
    }
    
    .custom-dialog-body p {
        font-size: 0.9rem !important;
        line-height: 1.5 !important;
    }
    
    .custom-dialog-footer {
        padding: 1rem 1.5rem !important;
        gap: 0.75rem !important;
        border-radius: 0 0 16px 16px !important;
    }
    
    .custom-dialog-btn {
        padding: 0.7rem 1.2rem !important;
        font-size: 0.9rem !important;
        flex: 1 !important;
    }
}

/* Tablet Adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .product-card {
        flex-direction: column;
    }
    
    .product-card .product-image {
        width: 100%;
        height: 250px;
    }
}
