:root {
    --primary: #ff3c00;
    --text-main: #1e293b;
    --text-light: #64748b;
    --bg-gray: #f8fafc;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: #fff;
    color: var(--text-main);
}

.product-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 40px;
    align-items: start;
}

.gallery-wrapper {
    display: flex;
    gap: 15px;
    position: sticky;
    top: 100px;
    height: fit-content;
    z-index: 5;
    background: #fff;
    padding: 10px 0;
}

.thumbnails-side {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.thumb-card {
    width: 70px;
    height: 70px;
    border-radius: 10px;
    border: 2px solid #e2e8f0;
    cursor: pointer;
    overflow: hidden;
    transition: 0.3s;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 0;
}

.thumb-card.active {
    border-color: var(--primary);
    transform: scale(1.05);
}

/* Hover must not use the active border: touch browsers can retain hover after a swipe. */
@media (hover: hover) {
    .thumb-card:hover:not(.active) {
        transform: scale(1.05);
    }
}

.thumb-card img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.video-icon-thumb {
    background: #000;
    color: #fff;
}

.main-preview {
    flex-grow: 1;
    background: var(--bg-gray);
    border-radius: 24px;
    height: 550px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    border: 1px solid #f1f5f9;
}

.mobile-gallery-track {
    display: none;
}

.main-preview img,
.main-preview iframe {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.product-info-box {
    padding: 10px 0;
}

.brand-tag {
    color: var(--primary);
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
    margin-bottom: 8px;
    display: block;
}

.product-title {
    font-size: 32px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 15px;
}

.price-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.current-price {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-main);
}

.desc-card {
    background: var(--bg-gray);
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 20px;
}

.desc-card h4 {
    margin-bottom: 10px;
    font-size: 16px;
    font-weight: 600;
}

.desc-text {
    color: var(--text-light);
    line-height: 1.6;
    font-size: 15px;
    white-space: pre-line;
    overflow: hidden;
    max-height: 100px;
    transition: max-height 0.5s ease-in-out;
    position: relative;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

.desc-text.expanded {
    max-height: 2000px;
}

.read-btn {
    color: var(--primary);
    font-weight: 700;
    cursor: pointer;
    display: inline-block;
    margin-top: 10px;
    font-size: 14px;
    text-decoration: none;
}

.action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.btn-buy {
    background: var(--primary);
    color: #fff;
    padding: 14px;
    border-radius: 12px;
    text-align: center;
    font-weight: 700;
    text-decoration: none;
    transition: 0.3s;
    box-shadow: 0 10px 20px rgba(255, 60, 0, 0.2);
    font-size: 15px;
}

.btn-share {
    background: #f1f5f9;
    color: var(--text-main);
    padding: 14px;
    border-radius: 12px;
    text-align: center;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: 0.3s;
    font-size: 15px;
}

.btn-buy:hover {
    transform: translateY(-3px);
    background: #e63900;
}

.share-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.share-modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 0;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease;
    overflow: hidden;
}

@media (max-width: 480px) {
    .share-modal-content {
        margin: 20% auto;
        width: 95%;
        max-width: 100%;
        border-radius: 16px;
    }

    .share-modal-body {
        padding: 20px;
    }
}

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.share-modal-header {
    background: linear-gradient(135deg, #ff3c00 0%, #ff6b35 100%);
    color: white;
    padding: 20px;
    font-size: 20px;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.share-modal-header .close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    background: none;
    border: none;
}

.share-modal-header .close:hover {
    opacity: 0.8;
}

.share-modal-body {
    padding: 30px;
}

.share-preview {
    background: linear-gradient(135deg, #fff5f1 0%, #fff 100%);
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 25px;
    display: flex;
    flex-direction: column;
    gap: 0;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid #ffe7d9;
    overflow: hidden;
    min-height: 280px;
}

.share-preview:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(255, 60, 0, 0.15);
    border-color: #ff3c00;
    background: linear-gradient(135deg, #fff9f7 0%, #fff 100%);
}

.share-preview-img {
    width: 100%;
    height: 180px;
    border-radius: 12px;
    background: linear-gradient(135deg, #e2e8f0 0%, #f1f5f9 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 15px;
}

.share-preview-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.share-preview-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.share-preview-text h4 {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: #1e293b;
    line-height: 1.4;
    font-weight: 700;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.share-preview-text p {
    margin: 0 0 10px 0;
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
}

.share-preview-link {
    font-size: 12px;
    color: #ff3c00;
    font-weight: 600;
    word-break: break-all;
    padding: 8px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #ffe7d9;
}

.share-buttons-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 15px;
}

.share-btn {
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
    color: white;
}

.share-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.share-btn-whatsapp { background: #25D366; }
.share-btn-facebook { background: #1877F2; }
.share-btn-twitter { background: #000; }
.share-btn-linkedin { background: #0A66C2; }

.share-btn:hover { text-decoration: none; }

@media (max-width: 600px) {
    .share-buttons-grid {
        grid-template-columns: 1fr;
    }
}

.share-link-section {
    padding-top: 15px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 10px;
}

.share-link-input {
    flex: 1;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 12px;
    color: #64748b;
    background: #f8fafc;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.share-link-input:focus {
    outline: none;
    border-color: #ff3c00;
}

#copyBtn {
    padding: 12px 16px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
    color: #1e293b;
    transition: 0.3s;
}

#copyBtn:hover {
    background: #e2e8f0;
}

.related-product-card {
    background: var(--bg-gray);
    border-radius: 18px;
    padding: 15px;
    transition: 0.3s;
    border: 1px solid #f1f5f9;
}

.related-product-card:hover {
    border-color: var(--primary);
    transform: translateY(-5px);
}

@media (max-width: 991px) {
    .product-container {
        grid-template-columns: 1fr;
        margin: 8px auto 0 auto;
    }

    .gallery-wrapper {
        flex-direction: column-reverse;
        position: static;
        padding-top: 4px;
    }

    .thumbnails-side {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 10px;
        gap: 8px;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
    }

    .thumb-card {
        width: 60px;
        height: 60px;
        flex: 0 0 auto;
        scroll-snap-align: start;
    }

    .main-preview {
        height: 400px;
        overflow: hidden;
    }

    .mobile-gallery-track {
        display: flex;
        width: 100%;
        height: 100%;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        touch-action: pan-x;
        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .mobile-gallery-track::-webkit-scrollbar {
        display: none;
    }

    .mobile-gallery-slide {
        min-width: 100%;
        width: 100%;
        height: 100%;
        object-fit: contain;
        flex-shrink: 0;
        scroll-snap-align: start;
        display: block;
    }

    #mainImg {
        /* The desktop image must never reappear beside the mobile swipe track. */
        display: none !important;
    }

    .product-title {
        font-size: 24px;
    }
}

@media (max-width: 600px) {
    .delivery-guarantees-container {
        grid-template-columns: 1fr 1fr 1fr !important;
        gap: 8px !important;
        padding: 12px !important;
        margin-top: 12px !important;
    }

    .delivery-guarantees-container > div {
        padding: 8px !important;
        text-align: center;
    }

    .delivery-guarantees-container > div > div:first-child {
        font-size: 18px !important;
        margin-bottom: 3px !important;
    }

    .delivery-guarantees-container > div > div:nth-child(2) {
        font-size: 10px !important;
        color: #64748b;
        font-weight: 600;
        line-height: 1.2;
    }

    .delivery-guarantees-container > div > div:nth-child(3) {
        font-size: 12px !important;
        font-weight: 600;
        color: #1e293b;
        line-height: 1.3;
    }

    .delivery-border-mobile {
        border-left: 1px solid #e2e8f0 !important;
        border-right: 1px solid #e2e8f0 !important;
        padding-left: 8px !important;
        padding-right: 8px !important;
        border-top: none !important;
        padding-top: 8px !important;
    }

    .tags-pricing-container {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 15px !important;
    }

    .tags-pricing-container > div:last-child {
        width: 100%;
        text-align: left;
    }

    .spec-key {
        width: 40% !important;
    }

    .thumbnails-side {
        gap: 6px;
    }

    .thumb-card {
        width: 50px;
        height: 50px;
    }

    .main-preview {
        height: 360px;
    }
}

.keyword-pill {
    display: inline-block;
    background: #fff;
    border: 1px solid #e2e8f0;
    color: var(--text-light);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 13px;
    margin: 5px 5px 0 0;
}

@media (max-width: 480px) {
    .product-container { margin-top: 4px !important; }
    .gallery-wrapper { padding-top: 2px !important; }

    .product-title {
        font-size: 18px;
        line-height: 1.3;
        margin-bottom: 12px;
    }

    .price-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px !important;
        margin-bottom: 12px !important;
    }

    .price-row div:last-child {
        width: 100%;
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
    }

    .action-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        margin-top: 12px !important;
    }

    .btn-buy,
    .btn-share {
        padding: 12px 8px;
        font-size: 13px;
    }

    .desc-card {
        padding: 12px;
        margin-bottom: 12px;
    }

    .desc-card h4 {
        font-size: 14px;
        margin-bottom: 8px;
    }

    .desc-text {
        font-size: 14px;
        max-height: 80px;
        line-height: 1.5;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .thumbnails-side { gap: 5px; }
    .thumb-card { width: 45px; height: 45px; }
    .main-preview { height: 450px; }

    .product-actions {
        grid-template-columns: 1fr 1fr !important;
    }

    .product-actions .btn-share {
        grid-column: 1 / -1;
    }
}

.btn-buy:disabled {
    opacity: .5;
    cursor: not-allowed;
    transform: none;
}

.related-section-wrapper {
    max-width: 1200px;
    margin: 60px auto;
    padding: 0 20px;
}

.related-title {
    font-size: 22px;
    margin-bottom: 25px;
    font-weight: 700;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.related-card-link {
    text-decoration: none;
    color: inherit;
}

.related-product-card {
    background: #fff;
    border-radius: 18px;
    padding: 15px;
    transition: 0.3s;
    border: 1px solid #f1f5f9;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.related-product-card:hover {
    border-color: var(--primary);
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.related-img-container {
    width: 100%;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.related-img-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.related-info h4 {
    font-size: 15px;
    margin: 0 0 8px;
    font-weight: 600;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 2.8em;
}

.related-price {
    color: var(--primary);
    font-weight: 700;
    font-size: 16px;
    margin: 0;
}

@media (max-width: 768px) {
    .related-section-wrapper {
        margin: 40px auto;
        padding: 0 10px;
    }

    .related-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .related-product-card {
        padding: 10px;
        border-radius: 12px;
    }

    .related-img-container {
        height: 130px;
    }

    .related-info h4 {
        font-size: 13px;
        height: 2.6em;
    }

    .related-price {
        font-size: 14px;
    }

    .related-title {
        font-size: 18px;
        margin-left: 5px;
    }
}

.variant-btn {
    transition: all 0.3s ease;
}

.variant-btn:hover {
    border-color: #ff3c00 !important;
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(255, 60, 0, 0.2);
}

.variant-btn.active {
    background: linear-gradient(135deg, #ff3c00 0%, #ff6b35 100%) !important;
    color: white !important;
    border-color: #ff3c00 !important;
    box-shadow: 0 8px 16px rgba(255, 60, 0, 0.3);
}

.variant-btn.active div:last-child {
    background: rgba(255, 255, 255, 0.2) !important;
}

.variant-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.review-panel {
    position: fixed;
    right: -500px;
    top: 0;
    width: 450px;
    height: 100vh;
    background: white;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    transition: right 0.3s ease;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.review-panel.active {
    right: 0;
}

.review-panel-header {
    padding: 20px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
}

.review-panel-header h2 {
    margin: 0;
    font-size: 1.3rem;
    color: #1e293b;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #64748b;
    transition: 0.2s;
}

.close-btn:hover {
    color: #ef4444;
}

.reviews-list {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.review-item {
    background: #f8fafc;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 15px;
    border: 1px solid #e2e8f0;
}

.review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.review-user-name {
    font-weight: 600;
    color: #1e293b;
}

.review-rating {
    color: #f59e0b;
    font-size: 16px;
}

.review-date {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 5px;
}

.review-text {
    color: #475569;
    font-size: 14px;
    margin: 10px 0;
    line-height: 1.5;
}

.load-more-reviews {
    width: 100%;
    padding: 11px;
    border: 1px solid #ff3c00;
    border-radius: 8px;
    background: #fff;
    color: #ff3c00;
    font-weight: 700;
    cursor: pointer;
}

.review-images {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.review-images img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
}

.review-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.review-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.rating-stars {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.rating-stars input {
    position: absolute;
    opacity: 0;
}

.rating-stars label {
    font-size: 28px;
    color: #e2e8f0;
    cursor: pointer;
    transition: 0.2s;
}

.rating-stars label.is-selected,
.rating-stars label.is-hovered {
    color: #f59e0b;
}

.rating-stars input:focus-visible + label {
    outline: 2px solid #2563eb;
    outline-offset: 3px;
}

.rating-selection-text,
.review-form-hint {
    color: #64748b;
    font-size: 13px;
    margin: 6px 0 0;
}

.existing-review-images {
    margin: -5px 0 15px;
}

.existing-review-image {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 8px;
    font-size: 13px;
    color: #475569;
}

.existing-review-image img {
    width: 42px;
    height: 42px;
    object-fit: cover;
    border-radius: 6px;
}

@media (max-width: 768px) {
    .review-panel {
        width: 100%;
        right: -100%;
    }
}
