﻿/* Product Detail Page - Specific Styles Only */
/* This file only contains styles unique to the product detail page */
/* Global styles are in styles.css */

/* ============================================
   IMPORTANT: Cart styles are in styles.css
   DO NOT override cart styles here
   ============================================ */

/* Prevent horizontal scroll on product detail page */
body {
    overflow-x: hidden;
}

/* Ensure all containers respect viewport width */
.product-detail-container,
.product-detail-grid,
.product-images,
.product-info-detail,
.product-tabs,
.breadcrumb {
    max-width: 100%;
    overflow-x: hidden;
}

/* Product Detail Container */
.product-detail-container {
    max-width: 1400px;
    margin: 120px auto 50px;
    padding: 0 2rem;
}

/* Breadcrumb Navigation */
.breadcrumb {
    padding: 1rem 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumb a:hover {
    color: var(--accent);
}

.breadcrumb span {
    margin: 0 0.5rem;
}

/* Product Detail Grid Layout */
.product-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    margin-bottom: 4rem;
}

/* Product Images Section */
.product-images {
    position: sticky;
    top: 120px;
    height: fit-content;
}

.main-image {
    width: 100%;
    height: 500px;
    background: var(--background-light);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.main-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-thumbnails {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

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

.image-thumbnails::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.thumbnail {
    width: 80px;
    height: 80px;
    border: 2px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.thumbnail:hover,
.thumbnail.active {
    border-color: var(--accent);
}

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

/* Product Info Section */
.product-info-detail {
    padding-top: 1rem;
}

.product-badge-detail {
    display: inline-block;
    background: var(--accent);
    color: white;
    padding: 0.3rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.product-badge-detail.new {
    background: #10B981;
}

.product-badge-detail.sale {
    background: #EF4444;
}

.product-title {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.product-price-section {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    margin: 1.5rem 0;
    padding: 1.5rem 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.current-price {
    font-size: 2rem;
    font-weight: 600;
    color: var(--accent);
}

.original-price {
    font-size: 1.25rem;
    color: var(--text-secondary);
    text-decoration: line-through;
}

.discount-badge {
    background: var(--error);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.product-description {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 2rem;
}

/* Quantity Selector for Product Detail */
.product-detail-container .quantity-selector {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.product-detail-container .quantity-control {
    display: flex;
    align-items: center;
    border: 2px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.product-detail-container .quantity-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: white;
    cursor: pointer;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    color: var(--text-primary);
}

.product-detail-container .quantity-btn:hover {
    background: var(--background-light);
}

.product-detail-container .quantity-input {
    width: 60px;
    text-align: center;
    border: none;
    font-size: 1rem;
    font-weight: 500;
    outline: none;
}

.product-detail-container .option-label {
    font-weight: 500;
    margin-bottom: 0;
}

.product-detail-container .stock-info {
    color: var(--success);
    font-size: 0.9rem;
    flex: 1 1 100%;
}

.product-detail-container .stock-info.low-stock {
    color: var(--warning);
}

.product-detail-container .stock-info.out-of-stock {
    color: var(--error);
}

/* Product Actions */
.product-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.btn-add-to-cart {
    flex: 1;
    padding: 0.875rem 2rem;
    font-size: 1rem;
    font-weight: 600;
}

/* Product Tabs */
.product-tabs {
    margin-bottom: 4rem;
}

.tab-headers {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 2rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

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

.tab-header {
    padding: 1rem 2rem;
    background: none;
    border: none;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.tab-header:hover {
    color: var(--text-primary);
}

.tab-header.active {
    color: var(--text-primary);
}

.tab-header.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
}

.tab-content {
    display: none;
}

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

.tab-content h3 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    font-weight: 600;
}

/* Tab Content with image overflow fix */
.tab-content {
    display: none;
    overflow: hidden;
}

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

.tab-content h3 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    font-weight: 600;
}

/* Handle all content in description - prevent overflow */
.tab-content * {
    max-width: 100%;
}

.tab-content img {
    max-width: 100% !important;
    height: auto !important;
    display: block;
    margin: 1rem 0;
    border-radius: 8px;
}

.tab-content p {
    margin-bottom: 1rem;
    line-height: 1.8;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.tab-content ul,
.tab-content ol {
    margin: 1rem 0;
    padding-left: 2rem;
    line-height: 1.8;
}

.tab-content li {
    margin-bottom: 0.5rem;
}

.tab-content table {
    max-width: 100%;
    overflow-x: auto;
    display: block;
}

.tab-content iframe,
.tab-content video {
    max-width: 100%;
    height: auto;
}

/* Specifications Table */
.specs-table {
    width: 100%;
    border-collapse: collapse;
}

.specs-table tr {
    border-bottom: 1px solid var(--border);
}

.specs-table td {
    padding: 1rem;
    word-break: break-word;
}

.specs-table td:first-child {
    font-weight: 500;
    width: 35%;
    background: var(--background-light);
}

/* ============================================
   RESPONSIVE STYLES - TABLET
   ============================================ */
@media (max-width: 992px) {
    .product-detail-container {
        margin-top: 100px;
        padding: 0 1.5rem;
    }

    .product-detail-grid {
        gap: 2rem;
    }

    .main-image {
        height: 400px;
    }

    .product-title {
        font-size: 1.75rem;
    }

    .current-price {
        font-size: 1.75rem;
    }
}

/* ============================================
   RESPONSIVE STYLES - MOBILE
   ============================================ */
@media (max-width: 768px) {
    /* Ensure no horizontal overflow */
    html, body {
        overflow-x: hidden;
        max-width: 100vw;
    }

    .product-detail-container {
        margin-top: 80px;
        padding: 0 1rem;
        overflow-x: hidden;
    }

    .breadcrumb {
        font-size: 0.85rem;
        padding: 0.75rem 0;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

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

    .product-detail-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        margin-bottom: 2rem;
    }

    .product-images {
        position: relative;
        top: 0;
    }

    .main-image {
        height: 350px;
        border-radius: 8px;
    }

    .thumbnail {
        width: 70px;
        height: 70px;
    }

    .product-info-detail {
        padding-top: 0;
    }

    .product-title {
        font-size: 1.5rem;
    }

    .product-price-section {
        padding: 1rem 0;
        margin: 1rem 0;
    }

    .current-price {
        font-size: 1.5rem;
    }

    .original-price {
        font-size: 1.1rem;
    }

    .discount-badge {
        font-size: 0.8rem;
        padding: 0.2rem 0.6rem;
    }

    .product-description {
        font-size: 0.95rem;
        margin-bottom: 1.5rem;
    }

    .product-detail-container .quantity-selector {
        gap: 0.75rem;
    }

    .product-detail-container .stock-info {
        font-size: 0.85rem;
    }

    .product-actions {
        gap: 0.75rem;
        margin-bottom: 1.5rem;
    }

    .btn-add-to-cart {
        padding: 0.75rem 1.5rem;
        font-size: 0.95rem;
    }

    .product-tabs {
        margin-bottom: 2rem;
    }

    .tab-headers {
        margin-bottom: 1.5rem;
    }

    .tab-header {
        padding: 0.875rem 1.25rem;
        font-size: 0.95rem;
    }

    .tab-content h3 {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }

    .specs-table td {
        padding: 0.75rem;
        font-size: 0.9rem;
    }

    .specs-table td:first-child {
        width: 40%;
    }
}

/* ============================================
   RESPONSIVE STYLES - SMALL MOBILE
   ============================================ */
@media (max-width: 480px) {
    /* Prevent overflow on small screens */
    html, body {
        overflow-x: hidden;
        width: 100%;
    }

    .product-detail-container {
        padding: 0 0.75rem;
        margin-top: 70px;
        width: 100%;
        overflow-x: hidden;
    }

    .breadcrumb {
        font-size: 0.8rem;
        padding: 0.5rem 0;
    }

    .breadcrumb span {
        margin: 0 0.25rem;
    }

    .main-image {
        height: 280px;
        border-radius: 6px;
    }

    .thumbnail {
        width: 60px;
        height: 60px;
        border-radius: 6px;
    }

    .product-badge-detail {
        font-size: 0.75rem;
        padding: 0.25rem 0.75rem;
    }

    .product-title {
        font-size: 1.25rem;
    }

    .product-price-section {
        gap: 0.75rem;
    }

    .current-price {
        font-size: 1.25rem;
    }

    .original-price {
        font-size: 1rem;
    }

    .discount-badge {
        font-size: 0.75rem;
    }

    .product-description {
        font-size: 0.9rem;
        line-height: 1.6;
    }

    .product-detail-container .quantity-selector {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .product-detail-container .quantity-control {
        width: 100%;
        justify-content: center;
    }

    .product-detail-container .quantity-btn {
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
    }

    .product-detail-container .quantity-input {
        width: 80px;
        font-size: 1.1rem;
    }

    .product-detail-container .stock-info {
        width: 100%;
        text-align: center;
        font-size: 0.85rem;
    }

    .product-actions {
        flex-direction: column;
    }

    .btn-add-to-cart {
        width: 100%;
        padding: 1rem;
    }

    .tab-header {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    .tab-content {
        font-size: 0.9rem;
    }

    .tab-content h3 {
        font-size: 1.1rem;
    }

    .specs-table td {
        padding: 0.625rem;
        font-size: 0.85rem;
    }

    .specs-table td:first-child {
        width: 45%;
    }
}