/* product-detail.css
   Original styles kept, with responsive fixes and annotated changes.
*/

/* ---------- Base / Global ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

h1,h2,h3,h4,h5,h6{
    font-family: 'poppins', sans-serif;
}

p,a,input,label,textarea,span,ul,li{
    font-family: 'poppins', sans-serif;
}

/* Centering container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Breadcrumb */
.breadcrumb {
    padding: 0;
    margin-bottom: 2rem;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    font-size: 0.9rem;
}

.breadcrumb li {
    display: inline-flex;
    align-items: center;
}

.breadcrumb li:not(:last-child)::after {
    content: "/";
    margin: 0 0.5rem;
    color: #666;
}

.breadcrumb a {
    color: #666;
    text-decoration: none;
}

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

.breadcrumb li:last-child {
    color: #333;
    font-weight: 500;
}

/* ---------- Product Section ---------- */
.product-section {
    display: flex;
    gap: 40px;
    margin-bottom: 40px;
    flex-wrap: wrap;
    align-items: flex-start;
}

/* CHANGE 2:
   Ensure the image column and info column have explicit flex-basis so they don't overlap.
   Previously both were flex:1 with min-width which could allow overlap in some layouts.
*/
.product-images {
    flex: 1 1 48%; /* CHANGED: give explicit basis so each column takes ~48% */
    min-width: 280px;
    box-sizing: border-box;
}

.product-info {
    flex: 1 1 48%; /* CHANGED: same basis for product info */
    min-width: 280px;
    box-sizing: border-box;
}

/* Image Gallery */
.main-image {
    margin-bottom: 20px;
}

/* CHANGE 1:
   Provide a consistent gap between main image and thumbnails.
   Also ensure the main image can scale responsively.
*/
.main-slider {
    margin-bottom: 16px; /* CHANGED: gap between main image and thumbnails */
    text-align: center;
}

/* Main image responsive sizing */
.main-slider img {
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    max-height: 480px;
    object-fit: contain;
    background: #fff;
    display: block;
    margin: 0 auto;
}

/* Thumbnail area */
.thumbnail-slider {
    display: flex;
    gap: 12px; /* existing small gap - kept */
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 12px; /* CHANGED: make thumbnail a bit closer to main on small screens but with gap above */
}

/* CHANGE 1 (continued):
   Increase spacing between main image and thumbnails on larger viewports.
*/
@media (min-width: 1024px) {
    .thumbnail-slider { gap: 18px; margin-top: 18px; }
}

.thumbnail {
    width: auto;
}

.thumbnail-slider img {
    width: 60px;          /* kept smaller and consistent */
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: 0.3s;
    display: block;
}

.thumbnail-slider img:hover {
    border-color: #888;
}

.thumbnail-slider img.active {
    border-color: #005587;
}

/* ---------- Product Info ---------- */
.product-number-sku {
    font-size: 1.5rem;
}

.product-name-sku {
    font-size: 1.2rem;
    margin-bottom: 40px;
}

.product-meta {
    margin-bottom: 20px;
}

.meta-row {
    display: flex;
    margin-bottom: 10px;
    align-items: center;
}

.meta-row img {
    width: 8%;
    height: auto;
}

.meta-label {
    width: 120px;
    color: #666;
}

.certificates {
    display: flex;
    gap: 10px;
    margin: 20px 0;
    margin-bottom: 60px
}

.certificates img {
    width: 55%;
    height: auto;
}

/* Buttons */
.send-inquiry {
    display: block;
    border: none;
    padding: 15px 40px;
    background-color: #233b55;
    font-size: 1rem;
    color: white;
    text-decoration: none;
    transition: background-color 0.3s;
    cursor: pointer;
}

.send-inquiry:hover {
    background-color: #005587;
}

/* ---------- Tabs Section ---------- */
.tab-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Tab header */
.tab {
    overflow: hidden;
    background-color: #f1f1f1;
    display: flex;
    flex-wrap: wrap;
}

/* Style the buttons inside the tab */
.tab button {
    background-color: inherit;
    border: none;
    outline: none;
    cursor: pointer;
    padding: 14px 16px;
    transition: 0.3s;
    font-size: 17px;
    color: #333;
}

/* Change background color of buttons on hover */
.tab button:hover {
    background-color: #ddd;
}

/* Create an active/current tablink class */
.tab button.active {
    background-color: #ccc;
}

/* Tab content */
.tabcontent {
    display: none;
    padding: 6px 12px;
    border-top: none;
}

/* ---------- Feature / Description Area ---------- */
.feature-des-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    gap: 2rem;
    background-color: #fff;
    flex-wrap: wrap;
}

.feature-product-images {
    flex: 1;
    background-color: #f8fafc;
    padding: 2rem;
    border-radius: 8px;
}

.feature-product-images img {
    width: 100%;
    height: auto;
    object-fit: contain;
}

.feature-product-details {
    flex: 1;
    padding: 1rem 0;
}

/* ---------- Features list ---------- */
.feature-product-category {
    color: #64748b;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.feature-product-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: #1e293b;
    margin-bottom: 2rem;
}

.feature-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.feature-item {
    margin-bottom: 1rem;
}

.feature-title {
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.5rem;
}

.feature-description {
    color: #64748b;
    line-height: 1.5;
}

/* ---------- Functions / Specs / Downloads ---------- */
.functions-container {
    background: #f7f7f7;
    overflow: hidden;
    padding: 20px 30px 40px 30px;
    margin-top: 40px;
    margin-bottom: 60px;
}

.functions-container h2 {
    font-size: 24px;
    font-weight: 700;
    color: #000;
    width: 100%;
}

/* CHANGE 5:
   Use CSS grid for function-grid then collapse to single column on small screens.
   Remove float-based layout for mobile to prevent overflow.
*/
.function-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px 40px;
    padding: 10px 0;
    max-width: 800px;
    box-sizing: border-box;
}

.function-grid li {
    list-style: none;
    margin-bottom: 8px;
    font-size: 16px;
    border-bottom: 1px solid #ccc;
    padding: 10px 0;
    font-weight: 600;
    width: 100%;       /* CHANGED: remove width percentages that caused overflow */
    float: none;       /* CHANGED: remove floats for robust grid behavior */
}

/* no-border modifier preserved */
.function-grid li.no-border {
    border-bottom: none !important;
}

/* Small-phone fallback: one column */
@media (max-width: 600px) {
    .function-grid {
        grid-template-columns: 1fr; /* CHANGED: single column on small screens */
    }
}

/* ---------- Specifications table ---------- */
.spec-table {
    width: 100%;
    border-collapse: collapse;
}
.spec-table td {
    padding: 10px 15px;
    border-bottom: 1px solid #ddd;
}
.spec-table td:first-child {
    font-weight: 600;
    color: #333;
}

/* ---------- Related / Product grid ---------- */
.related-products {
    margin-top: 40px;
    flex-grow: 1;
}

.related-title {
    text-align: center;
    margin-bottom: 30px;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    text-decoration: none;
    cursor: pointer;
}

/* Product Grid Container */
.product-grid-container {
    flex-grow: 1;
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
    text-decoration: none;
    cursor: pointer;
}

.product-card-item {
    border: 1px solid #eee;
    padding: 1rem;
    text-align: left;
}

.product-image {
    width: 100%;
    background-color: none;
    margin-bottom: 1rem;
}

.product-image img {
    width: 100%;
    text-align: center;
    justify-content: center;
}

.product-category {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.product-number {
    font-size: 1.1rem;
    color: #233b55;
}

.product-title {
    font-size: 0.8rem;
    color: #333;
    margin-bottom: 0.5rem;
}

/* ---------- Slider / Thumbnail adjustments near bottom ---------- */
.slider {
    width: 100%;
}

.main-slider {
    text-align: center;
    margin-bottom: 20px;
}

.main-slider img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    max-height: 480px;
    object-fit: contain;
    background: #fff;
}

.thumbnail-slider {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

.thumbnail-slider img {
    width: 60px;          /* kept smaller and consistent */
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: 0.3s;
}

.thumbnail-slider img:hover {
    border-color: #888;
}

.thumbnail-slider img.active {
    border-color: #005587;
}

/* Function grid alternate (legacy/commented) removed in favor of grid above */

/* ---------- Responsive: smaller screens ---------- */
@media (max-width: 768px) {

    /* CHANGE 2 (mobile): ensure product columns stack but keep spacing (avoid overlap) */
    .product-section {
        flex-direction: column;
        gap: 20px;
    }

    .product-images,
    .product-info {
        flex: 1 1 100%;
        min-width: auto;
    }

    /* CHANGE 1 (mobile): increase gap between main image and thumbnail a bit */
    .main-slider { margin-bottom: 12px; }
    .thumbnail-slider { margin-top: 12px; gap: 10px; }

    /* CHANGE 3:
       Make tab buttons stack vertically on mobile for easier tapping.
       We override float:left from original to display:block and full width.
    */
    .tab {
        display: block; /* stack the tab buttons vertically */
    }
    .tab button {
        display: block;
        width: 100%;
        text-align: left;
        padding: 12px 16px;
        border-bottom: 1px solid #e0e0e0;
    }
    .tab button.active { border-left: 4px solid #233b55; }

    /* CHANGE 4:
       Description tab: override inline flex to stack image and text on mobile.
       The inline style 'display:flex' in HTML is higher priority; we change the flex-direction
       (which still works) and override widths of the child divs to be 100% so they stack nicely.
    */
    .functions-container > div {
        /* inline style sets display:flex; we set flex-direction to column for stacking */
        flex-direction: column !important; /* CHANGED */
        gap: 16px !important;
    }
    .functions-container > div > div:first-child {
        /* left column (image) was inline-styled to flex:0 0 340px; override on mobile */
        flex: 0 0 auto !important;
        max-width: 100% !important;
        width: 100% !important;
    }
    .functions-container > div > div:last-child {
        flex: 1 1 auto !important;
        width: 100% !important;
    }

    /* CHANGE 5 (mobile): measuring functions overflow fix */
    .function-grid {
        grid-template-columns: 1fr !important; /* single column on mobile */
    }
    .function-grid li {
        width: 100% !important;
        float: none !important;
    }

    /* Make thumbnails and featured images responsive */
    .thumbnail-slider img {
        width: 56px;
        height: 56px;
    }

    .featured-post { height: 320px; } /* if used inside tabs or featured area */
    .featured-post img { object-fit: cover; }

    /* reduce spacing in feature-desc container */
    .feature-des-container {
        padding: 1rem;
        gap: 16px;
        flex-direction: column;
    }

    .feature-product-images {
        padding: 1rem;
    }
}

/* ---------- Very small screens ---------- */
@media (max-width: 420px) {
    .thumbnail-slider img { width: 48px; height: 48px; }
    .product-number-sku { font-size: 1.2rem; }
    .product-name-sku { font-size: 1rem; margin-bottom: 20px; }
    .functions-container { padding: 16px; }
    .tab button { padding: 10px 12px; font-size: 15px; }
}