/* Mobile-First Product Detail Page Styles */

/* Base Mobile Styles (320px and up) */
.single-product-page {
    padding: 15px 0;
    background: #f9f9f9;
    min-height: 100vh;
}

.product-detail-container {
    background: #fff;
    padding: 15px;
    border-radius: 10px;
    margin: 0 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.breadcrumb {
    margin-bottom: 15px;
    color: #666;
    font-size: 13px;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.breadcrumb::-webkit-scrollbar {
    display: none;
}

.breadcrumb a {
    color: #2a5298;
    text-decoration: none;
    transition: color 0.3s;
}

.breadcrumb a:hover {
    color: #FFD814;
}

/* Mobile Product Layout - Stacked */
.product-detail-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 30px;
}

/* Product Images - Mobile First */
.product-images {
    order: 1;
    width: 100%;
}

.main-image {
    position: relative;
    margin-bottom: 15px;
    border-radius: 10px;
    overflow: hidden;
    background: linear-gradient(135deg, #fff5f5 0%, #fffdf0 100%);
}

.product-main-image {
    width: 100%;
    height: auto;
    max-height: 350px;
    object-fit: cover;
    border-radius: 10px;
    transition: transform 0.3s ease;
}

/* Touch-friendly thumbnails */
.product-thumbnails {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 5px 0 10px 0;
    scrollbar-width: thin;
    scroll-snap-type: x mandatory;
}

.product-thumbnails::-webkit-scrollbar {
    height: 4px;
}

.product-thumbnails::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.product-thumbnails::-webkit-scrollbar-thumb {
    background: #2a5298;
    border-radius: 2px;
}

.thumbnail-image {
    min-width: 70px;
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    scroll-snap-align: start;
    flex-shrink: 0;
}

.thumbnail-image:hover,
.thumbnail-image.active {
    border-color: #e53e3e;
    transform: scale(1.05);
}

/* Product Details - Mobile First */
.product-details {
    order: 2;
    padding: 0;
}

.product-title {
    font-size: 22px;
    margin-bottom: 15px;
    color: #333;
    line-height: 1.3;
    font-weight: 700;
}

/* Mobile-Optimized Price Section */
.product-price-section {
    margin-bottom: 20px;
    padding: 15px;
    background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
    border-radius: 10px;
    border: 2px solid #e53e3e;
    position: relative;
    overflow: hidden;
}

.product-price-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: #e53e3e;
}

.product-price-section .price {
    font-size: 26px;
    color: #e53e3e;
    font-weight: 800;
    display: block;
    margin: 0;
}

.product-price-section .regular-price {
    font-size: 18px;
    color: #999;
    text-decoration: line-through;
    margin-right: 10px;
    display: inline-block;
}

.product-price-section .sale-price {
    font-size: 26px;
    color: #e53e3e;
    font-weight: 800;
    display: inline-block;
}

/* Short Description */
.product-short-description {
    margin-bottom: 20px;
    font-size: 15px;
    line-height: 1.6;
    color: #666;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #2a5298;
}

/* Product Meta - Mobile Optimized */
.product-meta {
    margin-bottom: 20px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 8px;
}

.meta-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    flex-wrap: wrap;
    gap: 5px;
}

.meta-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.meta-item .label {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    min-width: 80px;
}

.meta-item .value {
    font-size: 14px;
    color: #666;
    text-align: right;
    flex: 1;
}

.in-stock {
    color: #4CAF50 !important;
    font-weight: 600;
}

.out-of-stock {
    color: #f44336 !important;
    font-weight: 600;
}

/* Mobile-First Add to Cart Section - Sticky */
.add-to-cart-section {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    padding: 15px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    z-index: 1000;
    border-top: 1px solid #eee;
    transform: translateY(0);
    transition: transform 0.3s ease;
}

.quantity-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    gap: 15px;
}

.quantity-wrapper label {
    font-weight: 600;
    color: #333;
    font-size: 16px;
}

.quantity-selector {
    display: flex;
    align-items: center;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
}

.quantity-btn {
    background: #f8f9fa;
    border: none;
    width: 44px;
    height: 44px;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.quantity-btn:active {
    background: #dee2e6;
    transform: scale(0.95);
}

.quantity-input {
    border: none;
    width: 60px;
    height: 44px;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    background: #fff;
    color: #333;
    outline: none;
}

/* Mobile-Optimized Add to Cart Button - Blue Rounded Style */
.add-to-cart-btn {
    width: 100%;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
    text-transform: none;
    letter-spacing: 0.3px;
    box-shadow: 0 4px 12px rgba(30, 60, 114, 0.25);
    min-height: 42px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.add-to-cart-btn:hover {
    background: linear-gradient(135deg, #2a5298 0%, #1e3c72 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(42, 82, 152, 0.4);
}

.add-to-cart-btn:active {
    transform: translateY(0);
    background: linear-gradient(135deg, #1a2847 0%, #173a6b 100%);
}

/* Safety Note */
.safety-note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 15px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    color: #856404;
    font-size: 14px;
    margin-bottom: 20px;
    margin-top: 20px;
}

.safety-note i {
    color: #f39c12;
    margin-top: 2px;
    font-size: 16px;
}

/* Mobile-First Tab System */
.product-tabs {
    margin: 20px 0 100px; /* Space for sticky cart */
}

.tab-navigation {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
    background: #fff;
    border-radius: 10px;
    overflow-x: auto;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.tab-navigation::-webkit-scrollbar {
    display: none;
}

.tab-link {
    padding: 15px 20px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    color: #666;
    min-width: 120px;
    text-align: center;
    flex-shrink: 0;
}

.tab-link.active {
    border-bottom-color: #e53e3e;
    color: #e53e3e;
    background: #fef2f2;
}

.tab-pane {
    display: none;
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.tab-pane.active {
    display: block;
}

.additional-info {
    width: 100%;
    border-collapse: collapse;
}

.additional-info td {
    padding: 12px 8px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}

.additional-info td:first-child {
    font-weight: 600;
    color: #333;
    width: 40%;
}

/* Related Products - Mobile */
.related-products {
    margin-top: 30px;
    margin-bottom: 100px; /* Space for sticky cart */
}

.related-products h2 {
    margin-bottom: 20px;
    font-size: 20px;
    color: #333;
    padding: 0 10px;
    font-weight: 700;
}

.products-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 0 15px;
}

.product-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 15px rgba(0,0,0,0.08);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 350px;
    margin: 0 auto;
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.product-image-link {
    display: block;
    position: relative;
}

.product-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px 8px 0 0;
}

.product-info {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.product-info .product-title {
    margin: 0 0 12px 0;
    font-size: 16px;
    line-height: 1.4;
    font-weight: 600;
    color: #333;
}

.product-info .product-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s;
}

.product-info .product-title a:hover {
    color: #e53e3e;
}

.product-info .product-price {
    font-size: 18px;
    font-weight: bold;
    color: #e53e3e;
    margin: 8px 0 0 0;
}

/* Smaller add-to-cart buttons for Related Products */
.related-products .woocommerce .button,
.related-products .add_to_cart_button,
.related-products .single_add_to_cart_button,
.related-products .product-card .button {
    padding: 8px 16px !important;
    font-size: 12px !important;
    min-height: 32px !important;
    margin: 8px 0 0 0 !important;
    border-radius: 20px !important;
    font-weight: 500 !important;
}

.related-products .woocommerce .button:hover,
.related-products .add_to_cart_button:hover,
.related-products .single_add_to_cart_button:hover,
.related-products .product-card .button:hover {
    transform: translateY(-1px) !important;
}

/* Mobile-First: Force single column for all mobile devices */
@media (max-width: 768px) {
    /* Related Products - Single column on all mobile devices */
    .related-products .products-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
        padding: 0 15px !important;
    }
    
    .related-products .product-card {
        max-width: 400px !important;
        margin: 0 auto !important;
    }
    
    .related-products .product-image {
        height: 200px !important;
    }
    
    .related-products .product-info {
        padding: 16px !important;
    }
    
    .related-products .product-info .product-title {
        font-size: 16px !important;
        margin-bottom: 12px !important;
    }
    
    .related-products .product-info .product-price {
        font-size: 18px !important;
    }
    
    /* Override any WooCommerce default grid layouts */
    .related-products .woocommerce ul.products,
    .related-products ul.products {
        grid-template-columns: 1fr !important;
        display: grid !important;
    }
    
    .related-products .woocommerce ul.products li.product,
    .related-products ul.products li.product {
        width: 100% !important;
        float: none !important;
        margin: 0 auto !important;
        max-width: 400px !important;
    }
}

/* Small Mobile Devices (max-width: 480px) */
@media (max-width: 480px) {
    .product-detail-container {
        margin: 0 5px;
        padding: 12px;
        border-radius: 8px;
    }
    
    .product-title {
        font-size: 18px;
        margin-bottom: 12px;
    }
    
    .product-price-section .price,
    .product-price-section .sale-price {
        font-size: 22px;
    }
    
    .product-short-description {
        font-size: 14px;
        padding: 12px;
    }
    
    .add-to-cart-btn {
        font-size: 13px;
        padding: 10px 16px;
        min-height: 38px;
    }
    
    /* Even smaller buttons for related products on mobile */
    .related-products .woocommerce .button,
    .related-products .add_to_cart_button,
    .related-products .single_add_to_cart_button,
    .related-products .product-card .button {
        padding: 6px 12px !important;
        font-size: 11px !important;
        min-height: 28px !important;
        margin: 6px 0 0 0 !important;
        border-radius: 16px !important;
        font-weight: 500 !important;
    }
    
    /* Smaller styling for very small screens */
    .related-products .products-grid {
        padding: 0 10px !important;
        gap: 16px !important;
    }
    
    .related-products .product-card {
        max-width: 320px !important;
    }
    
    .related-products .product-image {
        height: 160px !important;
    }
    
    .breadcrumb {
        font-size: 12px;
        margin-bottom: 12px;
    }
    
    .quantity-selector {
        border-radius: 8px;
    }
    
    .quantity-btn {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    
    .quantity-input {
        width: 50px;
        height: 40px;
        font-size: 15px;
    }
}

/* Tablet Portrait (min-width: 481px and max-width: 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    .product-detail-container {
        margin: 0 15px;
        padding: 20px;
    }
    
    .product-title {
        font-size: 24px;
    }
    
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
        padding: 0 20px;
    }
    
    .product-image {
        height: 180px;
    }
    
    .product-card {
        max-width: none;
    }
    
    .add-to-cart-section {
        padding: 20px;
    }
    
    .add-to-cart-btn {
        font-size: 14px;
        padding: 12px 20px;
        min-height: 40px;
    }
    
    /* Medium-sized buttons for related products on tablet */
    .related-products .woocommerce .button,
    .related-products .add_to_cart_button,
    .related-products .single_add_to_cart_button,
    .related-products .product-card .button {
        padding: 7px 14px !important;
        font-size: 12px !important;
        min-height: 30px !important;
        margin: 7px 0 0 0 !important;
        border-radius: 18px !important;
        font-weight: 500 !important;
    }
}

/* Tablet Landscape and Small Desktop (min-width: 769px) */
@media (min-width: 769px) {
    .single-product-page {
        padding: 40px 0;
    }
    
    .product-detail-container {
        padding: 40px;
        margin: 0 auto;
        max-width: 1200px;
    }
    
    .product-detail-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 50px;
        margin-bottom: 50px;
    }
    
    .product-images,
    .product-details {
        order: 0;
    }
    
    .product-title {
        font-size: 32px;
        margin-bottom: 25px;
    }
    
    .product-main-image {
        max-height: 500px;
    }
    
    .thumbnail-image {
        min-width: 80px;
        width: 80px;
        height: 80px;
    }
    
    /* Desktop Add to Cart - Not Sticky */
    .add-to-cart-section {
        position: static;
        background: transparent;
        padding: 0;
        box-shadow: none;
        border-top: none;
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 20px;
        margin-bottom: 25px;
    }
    
    .quantity-wrapper {
        margin-bottom: 0;
        flex-shrink: 0;
    }
    
    .add-to-cart-btn {
        width: auto;
        padding: 12px 24px;
        flex-shrink: 0;
        font-size: 14px;
        min-height: 40px;
    }
    
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 30px;
        padding: 0;
        max-width: 1000px;
        margin: 0 auto;
    }
    
    .product-image {
        height: 220px;
    }
    
    .product-card {
        max-width: none;
        margin: 0;
    }
    
    .product-info {
        padding: 20px;
    }
    
    .related-products {
        margin-bottom: 50px;
    }
    
    .tab-navigation {
        overflow-x: visible;
    }
    
    .tab-link {
        min-width: auto;
        padding: 15px 30px;
        font-size: 16px;
    }
}

/* Large Desktop (min-width: 1200px) */
@media (min-width: 1200px) {
    .product-detail-container {
        max-width: 1200px;
        margin: 0 auto;
    }
    
    .product-title {
        font-size: 36px;
    }
    
    .product-main-image {
        max-height: 600px;
    }
}

/* Landscape Mobile Optimizations */
@media (max-width: 768px) and (orientation: landscape) {
    .product-main-image {
        max-height: 250px;
    }
    
    .add-to-cart-section {
        position: static;
        background: transparent;
        box-shadow: none;
        border-top: none;
        margin-bottom: 20px;
    }
    
    .related-products {
        margin-bottom: 30px;
    }
}

/* Loading States */
.add-to-cart-btn[disabled] {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none !important;
}

.add-to-cart-btn .fa-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Accessibility Improvements */
@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) {
    .product-price-section {
        border-width: 3px;
    }
    
    .thumbnail-image.active {
        border-width: 4px;
    }
    
    .add-to-cart-btn {
        border: 2px solid #fff;
    }
}

/* Focus states for keyboard navigation */
.quantity-btn:focus,
.add-to-cart-btn:focus,
.tab-link:focus,
.thumbnail-image:focus {
    outline: 3px solid #FFD814;
    outline-offset: 2px;
}
