/* Layout chung cho trang chi tiết */
.detail-page {
    padding: 40px 0;
}

.detail-wrapper {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

/* Card bao bọc toàn bộ sản phẩm */
.product-detail-card {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Khung chứa thông tin chính (Ảnh + Tóm tắt) */
.product-main-info {
    display: flex;
    gap: 35px;
    align-items: flex-start;
}

/* Khung chứa ảnh sản phẩm */
.product-image-box {
    flex: 0 0 340px;
    max-width: 100%;
    border-radius: 8px;
    border: 1px solid #eee;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.gallery-viewport {
    position: relative;
    overflow: hidden;
    background: #f8fbf8;
}

.gallery-track {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
}

.gallery-track::-webkit-scrollbar { display: none; }

.gallery-slide {
    flex: 0 0 100%;
    width: 100%;
    height: 340px;
    display: block;
    object-fit: contain;
    scroll-snap-align: center;
    background: #fff;
}

.gallery-control {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: rgba(27, 94, 32, .82);
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.gallery-prev { left: 10px; }
.gallery-next { right: 10px; }

.gallery-thumbnails {
    display: flex;
    gap: 8px;
    padding: 10px;
    overflow-x: auto;
    background: #fff;
}

.gallery-thumbnail {
    flex: 0 0 58px;
    height: 58px;
    padding: 2px;
    border: 2px solid transparent;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
}

.gallery-thumbnail.is-active { border-color: #2e7d32; }
.gallery-thumbnail img { width: 100%; height: 100%; object-fit: cover; }
.gallery-dots { display: flex; justify-content: center; gap: 6px; padding: 0 0 8px; }
.gallery-dot { width: 7px; height: 7px; border-radius: 50%; background: #c8d8ca; }
.gallery-dot.is-active { background: #2e7d32; }

/* Tóm tắt thông tin bên phải ảnh */
.product-summary {
    flex: 1;
}

.product-title {
    margin: 0 0 10px 0;
    font-size: 24px;
    color: #2e7d32;
    line-height: 1.35;
}
.breadcrumb { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 22px; color: #708278; font-size: 13px; }
.breadcrumb a { color: #1f7a4d; font-weight: 700; text-decoration: none; }
.product-summary .badge-cat { margin-bottom: 10px; }
.detail-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.detail-actions .btn { padding: 11px 16px; }
.detail-actions .btn-zalo { background: #0288d1; color: #fff; }
.photo-guide { margin-top: 12px; padding: 11px 13px; border-left: 3px solid #0288d1; background: #eef8ff; color: #31566b; font-size: 13px; line-height: 1.55; }
.safety-section { background: #fffaf0; border: 1px solid #f2dfb4; padding: 18px; border-radius: 10px; }
.product-documents-section {
    padding: 20px;
    border: 1px solid #d5e6d7;
    border-radius: 12px;
    background: #f7fbf7;
}
.documents-intro, .documents-empty, .product-document-description {
    color: #56665b;
    line-height: 1.6;
}
.documents-intro { margin: -3px 0 16px; }
.documents-empty {
    margin: 0;
    padding: 14px 16px;
    border: 1px dashed #b8cdbb;
    border-radius: 8px;
    background: #fff;
}
.product-document-list { display: grid; gap: 14px; }
.product-document-card {
    padding: 16px;
    border: 1px solid #e0e9e1;
    border-radius: 10px;
    background: #fff;
}
.product-document-card h4 { margin: 0 0 10px; color: #244d2b; font-size: 16px; }
.product-document-meta {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 6px 12px;
    margin: 0 0 10px;
    font-size: 14px;
}
.product-document-meta dt { color: #637269; font-weight: 700; }
.product-document-meta dd { margin: 0; color: #334238; }
.product-document-description { margin: 0 0 12px; font-size: 14px; }
.product-document-files { display: flex; flex-wrap: wrap; gap: 12px; }
.product-document-file {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: min(100%, 220px);
    padding: 10px;
    border: 1px solid #dce8de;
    border-radius: 8px;
    background: #fbfdfb;
    color: #24613a;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}
.product-document-file:hover { border-color: #70a679; background: #f2f9f3; }
.product-document-file img {
    width: 100%;
    height: 180px;
    border-radius: 5px;
    background: #f2f4f2;
    object-fit: contain;
}
.document-file-download { flex-direction: row; align-items: center; }
.document-file-type {
    display: grid;
    flex: 0 0 48px;
    height: 48px;
    place-items: center;
    border-radius: 6px;
    background: #e8f2e9;
    color: #1b5e20;
    font-size: 12px;
}
.documents-error { margin: 0; color: #9f3a32; font-size: 13px; }
.related-products, .related-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.related-product, .related-links a { display: flex; flex-direction: column; gap: 5px; padding: 15px; border: 1px solid #dce9df; border-radius: 10px; background: #f8fcf9; color: #173126; text-decoration: none; }
.related-product small, .related-links span { color: #617269; font-size: 13px; }
.related-links span { color: #1f7a4d; font-weight: 700; }

.product-subtitle {
    font-size: 15px;
    color: #555;
    margin-bottom: 15px;
    font-style: italic;
}

.product-meta p {
    margin: 8px 0;
    font-size: 15px;
    line-height: 1.5;
    color: #333;
}

/* Khung thông tin chi tiết bên dưới (Thành phần, Công dụng, Bảng) */
.product-sections {
    border-top: 1px solid #eee;
    padding-top: 25px;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.detail-section h3 {
    color: #1b5e20;
    font-size: 18px;
    border-bottom: 2px solid #a5d6a7;
    padding-bottom: 6px;
    margin-bottom: 12px;
}

.detail-section ul {
    padding-left: 20px;
    margin: 0;
}

.detail-section ul li {
    margin-bottom: 8px;
    line-height: 1.5;
    color: #444;
}

/* Bảng liều lượng & hướng dẫn */
.dosage-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.dosage-table th, 
.dosage-table td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
    font-size: 14px;
    line-height: 1.4;
}

.dosage-table th {
    background: #f1f8e9;
    color: #2e7d32;
    font-weight: bold;
}

/* Màn hình chờ & Lỗi */
.loading-text, .error-message {
    text-align: center;
    font-size: 16px;
    color: #666;
    padding: 20px;
}

.error-box {
    text-align: center;
    padding: 40px 0;
}

.btn-retry {
    display: inline-block;
    margin-top: 15px;
    padding: 10px 20px;
    background-color: #2e7d32;
    color: #fff;
    text-decoration: none;
    border-radius: 5px;
}

/* Responsive cho mobile */
@media (max-width: 768px) {
    .product-main-info {
        flex-direction: column;
    }

    .product-image-box {
        flex: none;
        width: 100%;
    }
    .gallery-slide { height: min(78vw, 360px); }

    .dosage-table {
        display: block;
        overflow-x: auto;
    }
    .detail-wrapper { padding: 18px; }
    .related-products, .related-links { grid-template-columns: 1fr; }
    .detail-actions .btn { flex: 1; text-align: center; }
}