:root {
    --primary-red: #dc143c;
    --primary-dark: #8b0000;
    --deep-red: #800000;
    --light-red: #ffe4e1;
    --hover-red: #b22222;
    --text-dark: #212529;
    --border-color: #dee2e6;
    --muted-text: #6c757d;
    --success-green: #28a745;
    --error-red: #dc3545;
    --warning-orange: #ffc107;
}

/* ==========================================================================
   PRODUCT IMAGE GALLERY
   ========================================================================== */

.product-image-container {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.small-img-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 80px;
    flex-shrink: 0;
    height: 100%; /* Match parent height */
}

.small-img-col {
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 5px;
    overflow: hidden;
    transition: border-color 0.3s ease;
    margin-bottom: 10px;
}

.small-img-col:hover,
.small-img-col.active {
    border-color: var(--primary-red);
}

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

.main-img-container {
    flex: 1;
}

.main-img-container img {
    width: 100%;
    height: auto;
    border-radius: 5px;
}

.thumbnail-scroll-container {
    height: 100%; /* Take full height of small-img-group */
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.thumbnail-scroll-container::-webkit-scrollbar {
    width: 4px;
}

.thumbnail-scroll-container::-webkit-scrollbar-track {
    background: transparent;
}

.thumbnail-scroll-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

.thumbnail-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* ==========================================================================
   PRODUCT VARIANTS
   ========================================================================== */

.product-variants {
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

.variant-group {
    margin-bottom: 15px;
}

.variant-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-dark);
}

.variant-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.variant-btn,
.secondary-btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid var(--border-color);
    background-color: #fff;
    color: var(--text-dark);
}

.variant-btn:hover,
.secondary-btn:hover {
    border-color: var(--primary-red);
    transform: translateY(-1px);
}

.variant-btn.active,
.secondary-btn.active {
    background-color: var(--primary-red);
    border-color: var(--primary-red);
    color: white;
    box-shadow: 0 2px 4px rgba(220, 20, 60, 0.3);
}

.secondary-group {
    margin-top: 1rem;
}

.selected-variants-display {
    padding: 8px 12px;
    background-color: #f8f9fa;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.selected-variants-display span {
    color: var(--primary-red);
    font-weight: bold;
}

/* ==========================================================================
   PRODUCT FORM & BUTTONS
   ========================================================================== */

.single-product input[type="number"] {
    width: 60px;
    padding: 8px 10px;
    margin-right: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.single-product .btn-primary {
    height: 40px;
    font-size: 1rem;
    background-color: var(--primary-red);
    border: none;
    padding: 10px 20px;
    color: #fff;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.single-product .btn-primary:hover {
    background-color: var(--hover-red);
    transform: scale(1.01);
}

.single-product .btn-primary:disabled {
    background-color: var(--muted-text);
    cursor: not-allowed;
    transform: none;
}

.stock-info {
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-dark);
}

.stock-info.text-danger {
    color: var(--error-red) !important;
}

.total-sold {
    font-size: 0.9rem;
    color: var(--muted-text);
    margin-bottom: 0.5rem;
}

/* ==========================================================================
   SELLER PROFILE SECTION
   ========================================================================== */

.seller-profile-section {
    margin: 1.5rem 0;
}

.seller-profile-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.3s ease;
}

.seller-profile-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.seller-logo {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
    border: 2px solid #f8f9fa;
    margin-right: 1rem;
}

.seller-logo-placeholder {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--primary-red), var(--deep-red));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    margin-right: 1rem;
    border: 2px solid #f8f9fa;
}

.store-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
}

.seller-stats-row {
    margin: 0.25rem 0 0.75rem 0;
}

.stat-item {
    display: inline-flex;
    align-items: center;
    font-size: 0.8rem;
    color: var(--muted-text);
    font-weight: 500;
    white-space: nowrap;
}

.stat-item i {
    margin-right: 0.375rem;
    color: var(--primary-red);
    font-size: 0.875rem;
}

.stat-item .fa-star {
    color: var(--warning-orange) !important;
}

.seller-actions {
    margin-top: 0.5rem;
    gap: 0.5rem;
    display: flex;
    flex-wrap: wrap;
}

.follow-btn {
    background-color: transparent;
    border: 2px solid var(--primary-red);
    color: var(--primary-red);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    min-width: 100px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.follow-btn:hover {
    background-color: var(--primary-red);
    color: white;
    transform: translateY(-1px);
}

.follow-btn[data-following="1"] {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    color: white;
}

.follow-btn[data-following="1"]:hover {
    background-color: var(--hover-red);
    border-color: var(--hover-red);
}

.seller-actions .btn-primary {
    background-color: var(--primary-red);
    border: 2px solid var(--primary-red);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.seller-actions .btn-primary:hover {
    background-color: var(--hover-red);
    border-color: var(--hover-red);
    transform: translateY(-1px);
}

#follow-spinner {
    width: 1rem;
    height: 1rem;
}

/* ==========================================================================
   PRODUCT CARDS (OTHER PRODUCTS & RELATED)
   ========================================================================== */

#other-seller-products .product,
#related-products .product {
    cursor: pointer;
    text-align: left;
    transition: transform 0.2s ease;
}

#other-seller-products .product:hover,
#related-products .product:hover {
    transform: translateY(-2px);
}

#other-seller-products .product h3,
#related-products .product h3 {
    font-size: 1rem;
    font-weight: 500;
    color: var(--primary-dark);
    margin-bottom: 0.5rem;
    line-height: 1.3;
    text-align: left;
}

#other-seller-products .product .img-fluid,
#related-products .product .img-fluid {
    margin-bottom: 0.5rem;
    border-radius: 8px;
    transition: transform 0.2s ease;
}

.price-discount-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.3rem;
    gap: 0.5rem;
}

.price-container {
    flex: 1;
    text-align: left;
}

.current-price {
    font-weight: bold;
    color: var(--text-dark);
    font-size: 1.1rem;
}

.current-price .currency {
    font-size: 0.75em;  /* 75% of parent font size */
    font-weight: normal;
    margin-right: 1px;
}

.original-price {
    text-decoration: line-through;
    color: var(--muted-text);
    font-size: 0.9rem;
    margin-left: 0.25rem;
}

.original-price .currency {
    font-size: 0.75rem;
    font-weight: normal;
    margin-right: 1px;
}

.discount-sticker {
    background-color: var(--error-red);
    color: white;
    padding: 0.2rem 0.4rem;
    border-radius: 0.3rem;
    font-size: 0.7rem;
    font-weight: bold;
}

.rating-sold-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    gap: 0.5rem;
}

.rating-info {
    flex: 1;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.rating-info i {
    font-size: 0.8rem;
}

.rating-text {
    font-size: 0.75rem;
    color: var(--muted-text);
}

.sold-info {
    flex: 1;
    text-align: center;
    font-size: 0.75rem;
    color: var(--muted-text);
}

.quality-info {
    flex: 1;
    text-align: right;
    font-size: 0.75rem;
}

.quality-info.ads {
    color: var(--warning-orange);
    font-weight: 500;
}

.button-container {
    margin-top: 0.5rem;
}

.button-container .btn {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
    width: 100%;
    background-color: var(--primary-red);
    border: none;
    color: white;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.button-container .btn:hover {
    background-color: var(--hover-red);
}

/* Horizontal scroll and equal card size for other seller and related products */
#other-seller-products .row,
#related-products .row {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 1.5rem;
    padding-bottom: 1rem;
    scroll-behavior: smooth;
}

#other-seller-products .product,
#related-products .product {
    min-width: 260px;
    max-width: 260px;
    height: 420px;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    margin-bottom: 0;
    flex: 0 0 auto;
    transition: box-shadow 0.2s;
    padding: 1rem 0.75rem;
    box-sizing: border-box;
    overflow: hidden;
}

#other-seller-products .button-container
#related-products .button-container {
    margin-top: auto;
    
}


/* ==========================================================================
   REVIEWS SECTION
   ========================================================================== */

.review-card {
    background-color: #f8f9fa;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.review-card h5,
.review-card h6 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-dark);
}

.review-card p {
    font-size: 0.85rem;
    color: var(--muted-text);
    margin-bottom: 0.5rem;
}

.stars i.fa-star {
    color: var(--warning-orange);
}

.stars i.fa-star-half-o {
    color: var(--warning-orange);
}

.stars i.fa-star-o {
    color: var(--border-color);
}

/* ==========================================================================
   ALERT MESSAGES
   ========================================================================== */

.alert {
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid;
}

.alert-success {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.alert-danger {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */

@media (max-width: 768px) {
    .product-image-container {
        flex-direction: column;
    }
    
    .small-img-group {
        flex-direction: row;
        width: 100%;
        justify-content: space-between;
        order: 2;
        margin-top: 15px;
    }
    
    .small-img-col {
        width: 23%;
        margin-bottom: 0;
    }
    
    .main-img-container {
        order: 1;
    }
    
    .small-img {
        height: 60px;
    }
    
    .seller-profile-card {
        padding: 0.75rem;
    }
    
    .seller-logo,
    .seller-logo-placeholder {
        width: 45px;
        height: 45px;
        font-size: 1rem;
    }
    
    .store-name {
        font-size: 1rem;
    }
    
    .stat-item {
        font-size: 0.75rem;
    }
    
    .seller-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .seller-actions .btn,
    .follow-btn {
        width: 100%;
        justify-content: center;
    }

    /* Prevent horizontal scroll on body/container */
    body {
        overflow-x: hidden !important; 
    }
    
    .single-product,
    .single-product .container,
    .single-product .row {
        overflow-x: hidden !important;
    }
}

@media (max-width: 576px) {
    .variant-btn,
    .secondary-btn {
        font-size: 13px;
        padding: 6px 12px;
    }
    
    .seller-actions .btn,
    .follow-btn {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
    /* Prevent horizontal scroll on body/container */
    body {
        overflow-x: hidden !important; 
    }
    
    .single-product,
    .single-product .container,
    .single-product .row {
        overflow-x: hidden !important;
    }
}

@media (max-width: 600px) {
    /* Mobile: Horizontal scrolling gallery */
    .product-image-container {
        flex-direction: column;
        position: relative;
    }

    /* Prevent horizontal scroll on body/container */
    body {
        overflow-x: hidden !important; 
    }
    
    .single-product,
    .single-product .container,
    .single-product .row {
        overflow-x: hidden !important;
    }
    
    /* Hide thumbnail strip on mobile */
    .small-img-group {
        display: none;
    }
    
    /* Main image container becomes scrollable gallery */
    .main-img-container {
        width: 100%;
        overflow-x: scroll;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* Firefox */
        position: relative;
        margin-bottom: 1rem;
        margin-top: -1.7rem;
    }
    
    .main-img-container::-webkit-scrollbar {
        display: none; /* Chrome, Safari */
    }
    
    /* Create horizontal gallery */
    .mobile-gallery-wrapper {
        display: flex;
        gap: 10px;
    }
    
    .mobile-gallery-wrapper img {
        width: 92vw;
        max-width: 380px;
        height: auto;
        object-fit: contain;
        border-radius: 8px;
        background: #fff;
        box-shadow: 0 2px 8px rgba(0,0,0,0.06);
        scroll-snap-align: center;
        flex-shrink: 0;
    }
    
    /* Dot indicators */
    .gallery-dots {
        display: flex;
        justify-content: center;
        gap: 8px;
        margin-top: 12px;
        margin-bottom: 1rem;
    }
    
    .gallery-dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background-color: #ddd;
        transition: all 0.3s ease;
        cursor: pointer;
        padding: 0;
        border: none;
    }
    
    .gallery-dot.active {
        background-color: var(--primary-red);
        width: 24px;
        border-radius: 4px;
    }

    .single-product {
        padding-top: 0 !important;
        margin-top: 0 !important;
    }
    
    .single-product .row {
        margin-top: 0 !important;
    }

    /* Rest of mobile styles */
    .single-product h1,
    .single-product h2,
    .single-product-title {
        font-size: 1.1rem;
        font-weight: 700;
        margin-bottom: 0.5rem;
        color: #222;
        line-height: 1.2;
        text-align: left;
    }

    .price-discount-container,
    .price-container {
        font-size: 1.1rem;
        font-weight: bold;
        color: #dc143c;
        margin-bottom: 0.3rem;
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }
    .current-price {
        font-size: 1.2rem;
        color: #dc143c;
        font-weight: bold;
    }
    .original-price {
        font-size: 0.9rem;
        color: #888;
        text-decoration: line-through;
        margin-left: 0.5rem;
    }
    .discount-sticker {
        font-size: 0.7rem;
        background: #ff5722;
        color: #fff;
        border-radius: 4px;
        padding: 0.1rem 0.4rem;
        margin-left: 0.5rem;
    }

    .rating-sold-container {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        margin-bottom: 0.3rem;
        font-size: 0.8rem;
    }
    .rating-info,
    .sold-info,
    .quality-info {
        font-size: 0.8rem;
        color: #888;
    }

    .product-variants,
    .variant-group,
    .selected-variants-display {
        margin-bottom: 0.5rem;
        font-size: 0.9rem;
    }
    .variant-btn,
    .secondary-btn {
        font-size: 0.85rem;
        padding: 0.3rem 0.7rem;
        border-radius: 5px;
    }
    .single-product input[type="number"] {
        width: 48px;
        padding: 6px 8px;
        font-size: 0.9rem;
    }

    .product .button-container {
        margin-top: 0.4rem;
    }

    .product .btn {
        font-size: 0.7rem;
        padding: 0.35rem 0.6rem;
    }

    .seller-profile-card {
        padding: 0.7rem;
        border-radius: 8px;
        margin-bottom: 1rem;
    }
    .seller-logo,
    .seller-logo-placeholder {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
        margin-right: 0.5rem;
    }
    .store-name {
        font-size: 0.95rem;
    }
    .stat-item {
        font-size: 0.7rem;
    }
    .seller-actions .btn,
    .follow-btn {
        font-size: 0.7rem;
        padding: 0.18rem 0.4rem;
        border-radius: 4px;
        min-width: 70px;
    }

    #other-seller-products .row,
    #related-products .row {
        gap: 0.6rem;
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        justify-content: flex-start !important;
        scroll-behavior: smooth;
    }
    #other-seller-products .product,
    #related-products .product {
        min-width: 47%;
        max-width: 47%;
        min-height: 280px;
        height: auto;
        padding: 0.7rem 0.5rem;
        display: flex;
        flex-direction: column;
    }
    #other-seller-products .product .img-fluid,
    #related-products .product .img-fluid {
        max-width: 100%;
        height: auto; 
        margin-bottom: 0.4rem;
    }
    #other-seller-products .product h3,
    #related-products .product h3 {
        font-size: 0.85rem;
        min-height: auto;
        max-height: none;
        margin-bottom: 0.3rem;
    }

    .button-container {
        margin-top: 0.4rem;
    }

    .product .btn {
        font-size: 0.7rem;
        padding: 0.35rem 0.6rem;
    }

    .price-discount-container {
        margin-bottom: 0.25rem;
    }

    .rating-sold-container {
        margin-bottom: 0.25rem;
    }

    .price-container .current-price {
        font-size: 0.95rem;
    }
    
    .original-price {
        font-size: 0.75rem;
    }

    .review-card h5,
    .review-card h6 {
        font-size: 0.7rem;
    }
    .review-card p {
        font-size: 0.65rem;
    }
    .alert {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
}