/* ================================================
   1. THIẾT LẬP CHUNG
================================================ */

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font: 16px/1.6 system-ui,sans-serif;
    color: #392c21;
    background: #faf7ef;
}

/* ================================================
   2. THANH ĐIỀU HƯỚNG
================================================ */

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px max(5%,calc((100% - 1150px)/2));
    background: #fffdf8;
    flex-wrap: wrap;
}

.brand {
    font-weight: 800;
    letter-spacing: 1px;
    color: #31543a;
}

a {
    color: inherit;
    text-decoration: none;
}

nav {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* ================================================
   3. NÚT BẤM VÀ FORM
================================================ */

button,
input,
select,
textarea {
    font: inherit;
}

button,
.primary {
    cursor: pointer;
    border: 1px solid #d9d2c4;
    background: #fffdf8;
    padding: 9px 15px;
    border-radius: 8px;
    color: inherit;
}

.primary {
    display: inline-block;
    background: #31543a;
    color: white;
    border-color: #31543a;
    font-weight: 600;
}

button:hover,
.primary:hover {
    filter: brightness(.94);
}

/* ================================================
   4. BANNER ĐẦU TRANG
================================================ */

.hero {
    text-align: center;
    padding: 72px 20px;
    background: linear-gradient(120deg,#e9e0ca,#f5eedf);
    border-bottom: 1px solid #e1d8c7;
}

.hero small {
    letter-spacing: 3px;
    color: #31543a;
    font-weight: 700;
}

h1 {
    font-family: "Times New Roman",serif;
    font-size: clamp(32px,5vw,60px);
    line-height: 1.15;
    margin: 18px 0;
}

h2 {
    font-size: 26px;
}

/* ================================================
   5. DANH MỤC VÀ THẺ SẢN PHẨM
================================================ */

main {
    max-width: 1150px;
    margin: auto;
    padding: 35px 20px 60px;
}

.filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 25px;
}

input,
select,
textarea {
    border: 1px solid #d9d2c4;
    padding: 10px;
    border-radius: 8px;
    background: white;
    max-width: 100%;
    color: inherit;
}

.filters input {
    flex: 1;
    min-width: 180px;
}

.catalog {
    display: grid;
    grid-template-columns: repeat(auto-fit,minmax(min(100%,240px),1fr));
    gap: 22px;
}

.product {
    background: #fffdf8;
    border: 1px solid #e7dfd1;
    border-radius: 14px;
    overflow: hidden;
}

.photo {
    height: 180px;
    background: #e8dfca;
    display: grid;
    place-items: center;
    color: #78664c;
    font-size: 18px;
    text-align: center;
    padding: 12px;
}

.photo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.details {
    padding: 18px;
}

.details h3 {
    margin: 5px 0;
}

.details select,
.details button {
    width: 100%;
    margin-top: 10px;
}

.price {
    color: #31543a;
    font-weight: 700;
}

.muted {
    font-size: 13px;
    color: #71685b;
}

/* ================================================
   6. CHÂN TRANG
================================================ */

footer {
    text-align: center;
    padding: 24px;
    background: #31543a;
    color: #fff;
}

/* ================================================
   7. HỘP THOẠI GIỎ HÀNG VÀ QUẢN LÝ
================================================ */

dialog {
    width: min(94vw,650px);
    max-height: 90vh;
    border: 1px solid #ddd3bf;
    border-radius: 16px;
    padding: 25px;
    background: #fffdf8;
    color: inherit;
}

dialog::backdrop {
    background: #0008;
}

.close {
    float: right;
    font-size: 22px;
    padding: 0 12px;
}

label {
    display: block;
    margin: 10px 0;
}

label input,
label textarea {
    display: block;
    width: 100%;
}

.item {
    border-bottom: 1px solid #e7dfd1;
    padding: 12px 0;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.actions button {
    padding: 4px 10px;
}

pre {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    background: #eee9dc;
    padding: 12px;
    border-radius: 8px;
}

/* ================================================
   8. BỐ CỤC SẢN PHẨM MỞ RỘNG
================================================ */

.catalog {
    grid-template-columns: repeat(auto-fit,minmax(min(100%,320px),1fr));
}

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

.details {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.details h4 {
    margin: 12px 0 3px;
    color: #31543a;
}

.details p {
    margin: 0 0 8px;
    font-size: 14px;
    white-space: pre-line;
}

.details .price {
    margin-top: auto;
    padding-top: 12px;
}

/* ================================================
   9. SLIDER HÌNH ẢNH
================================================ */

.slider {
    position: relative;
    height: 240px;
    padding: 0;
    overflow: hidden;
}

.slider img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;

    /* Hiển thị toàn bộ hình ảnh */
    object-fit: contain;

    /* Căn giữa hình ảnh */
    object-position: center;

    /* Biểu tượng con trỏ phóng to */
    cursor: zoom-in;
}

.slider [hidden] {
    display: none !important;
}

.slide-prev,
.slide-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: #2229;
    color: white;
    border: 0;
    font-size: 25px;
    padding: 4px 12px;
}

.slide-prev {
    left: 8px;
}

.slide-next {
    right: 8px;
}

.dots {
    position: absolute;
    bottom: 12px;
    display: flex;
    gap: 7px;
    background: #2226;
    padding: 8px;
    border-radius: 20px;
}

.dot {
    width: 11px;
    height: 11px;
    padding: 0;
    border: 1px solid white;
    border-radius: 50%;
    background: #ffffff55;
}

.dot.active {
    background: white;
}

.fade {
    animation: fade-in .65s ease;
}

@keyframes fade-in {
    from {
        opacity: .25;
    }

    to {
        opacity: 1;
    }
}

@media (prefers-reduced-motion:reduce) {
    .fade {
        animation: none;
    }
}

/* ================================================
   10. NHẬN DIỆN THƯƠNG HIỆU QUANG ĐỘ
================================================ */

/* Quang Độ – nhận diện thương hiệu */

:root {
    --forest: #284635;
    --gold: #b69a61;
    --cream: #f7f0e2;
    --ink: #403427;
}

body {
    background: #faf7ef;
    color: var(--ink);
}

header {
    border-bottom: 1px solid #e7decc;
}

.brand {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    gap: 5px;
    white-space: nowrap;
}

.brand span {
    font: 700 28px "Times New Roman",serif;
    letter-spacing: 3px;
    color: var(--forest);
}

.brand small {
    font-size: 10px;
    letter-spacing: 1.6px;
    color: #806342;
}

.hero {
    background: radial-gradient(ellipse at 50% 20%,#fdf8ed 0%,#eee0c5 85%);
    padding: 70px 20px 75px;
    position: relative;
}

.hero-inner {
    max-width: 800px;
    margin: auto;
}

.hero h1 {
    font-size: clamp(58px,9vw,106px);
    color: var(--forest);
    margin: 8px 0;
    letter-spacing: .035em;
}

.hero h2 {
    font: 400 clamp(25px,4vw,39px)/1.3 "Times New Roman",serif;
    color: #614629;
    margin: 17px 0;
}

.hero p {
    max-width: 690px;
    margin: 0 auto 28px;
    color: #67543c;
    font-size: 17px;
}

.ornament {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 13px;
    color: var(--gold);
    max-width: 240px;
    margin: 14px auto;
}

.ornament:before,
.ornament:after {
    content: '';
    height: 1px;
    background: currentColor;
    flex: 1;
}

.hero-actions {
    display: flex;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
}

.hero-link {
    border: 1px solid #a88e61;
    border-radius: 8px;
    padding: 9px 15px;
    color: #63492e;
}

/* ================================================
   11. CÂU CHUYỆN THƯƠNG HIỆU
================================================ */

.about {
    max-width: 1150px;
    margin: 0 auto;
    padding: 64px 20px;
    display: grid;
    grid-template-columns: minmax(230px,1fr) 2fr;
    gap: 48px;
    align-items: center;
}

.about-mark {
    background: var(--forest);
    color: #f7ebcf;
    text-align: center;
    padding: 45px 20px;
    border: 1px solid #8d825b;
    border-radius: 4px;
    outline: 1px solid #b69a61;
    outline-offset: -12px;
}

.about-mark span {
    display: block;
    font: 400 110px/1 "Times New Roman",serif;
    color: #e9d5a3;
}

.about-mark strong {
    font-size: 13px;
    letter-spacing: 2px;
}

.about-mark p {
    font: italic 23px/1.45 "Times New Roman",serif;
}

.eyebrow {
    color: #8b6b37;
    font-weight: 700;
    letter-spacing: 1.7px;
    font-size: 12px;
}

.about h2,
.section-title h2,
.contact h2 {
    font: 400 clamp(28px,4vw,39px)/1.25 "Times New Roman",serif;
    color: var(--forest);
    margin: 10px 0 20px;
}

.about-copy p {
    margin: 0 0 14px;
}

.signature {
    font: italic 21px "Times New Roman",serif;
    color: var(--forest);
    display: block;
    margin-top: 22px;
}

/* ================================================
   12. GIÁ TRỊ THƯƠNG HIỆU
================================================ */

.values {
    display: grid;
    grid-template-columns: repeat(3,1fr);
    max-width: 1150px;
    margin: 0 auto;
    border-block: 1px solid #e3d8c3;
    padding: 23px 20px;
    text-align: center;
    gap: 20px;
}

.values strong {
    color: var(--forest);
    font: 700 20px "Times New Roman",serif;
}

.values p {
    font-size: 14px;
    margin: 7px 0;
    color: #6f6252;
}

/* ================================================
   13. DANH MỤC SẢN PHẨM – GIAO DIỆN HOÀN THIỆN
================================================ */

.section-title {
    text-align: center;
    margin: 15px 0 30px;
}

.section-title p {
    color: #72634e;
    margin: 0;
}

.catalog {
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 24px;
}

.slider {
    height: clamp(230px,30vw,350px);
    background: linear-gradient(135deg,#e9dfcb,#f5eee0);
}

.details {
    padding: 24px;
}

.details h3 {
    font: 700 27px "Times New Roman",serif;
    color: var(--forest);
    margin: 8px 0 12px;
}

.details h4 {
    font-size: 14px;
    letter-spacing: .25px;
    color: #846434;
}

.details p {
    font-size: 15px;
    line-height: 1.75;
}

.details .ingredients {
    background: #f5efe2;
    border-left: 3px solid #b69a61;
    padding: 10px 13px;
    margin-bottom: 17px;
}

.price {
    font-size: 23px;
}

/* ================================================
   14. THÔNG TIN LIÊN HỆ
================================================ */

.contact {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    align-items: center;
    max-width: 1150px;
    margin: 0 auto 55px;
    padding: 30px;
    background: #efe6d4;
    border-radius: 12px;
}

.contact-note {
    text-align: center;
    border-left: 1px solid #d5c4a5;
    color: var(--forest);
    padding: 20px;
}

.contact-note span {
    font: 700 30px "Times New Roman",serif;
    letter-spacing: 2px;
}

.contact-note p {
    font: italic 21px/1.5 "Times New Roman",serif;
}

footer p {
    margin: 6px 0;
    color: #f2e6cc;
}

footer a {
    text-decoration: underline;
    text-underline-offset: 4px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid #ac8c4d;
    outline-offset: 3px;
}

/* ================================================
   15. GIAO DIỆN ĐIỆN THOẠI
================================================ */

@media (max-width:700px) {
    header {
        padding: 16px;
        justify-content: center;
    }

    nav {
        justify-content: center;
        gap: 10px;
        font-size: 14px;
    }

    .hero {
        padding: 45px 16px;
    }

    .about {
        grid-template-columns: 1fr;
        padding: 35px 18px;
        gap: 25px;
    }

    .about-mark {
        max-width: 380px;
        width: 100%;
        margin: auto;
    }

    .values {
        grid-template-columns: 1fr;
    }

    .catalog {
        grid-template-columns: 1fr;
    }

    .contact {
        grid-template-columns: 1fr;
        margin: 0 16px 35px;
        padding: 24px;
    }

    .contact-note {
        border-left: 0;
        border-top: 1px solid #d5c4a5;
    }

    .details {
        padding: 19px;
    }
}
/* ================================================
   HIỂN THỊ HÌNH ẢNH TOÀN MÀN HÌNH
================================================ */

/* Khung hiển thị ảnh */
.image-viewer {
    position: fixed;
    inset: 0;

    width: 100%;
    height: 100%;

    max-width: none;
    max-height: none;

    margin: 0;
    padding: 20px;

    border: none;
    border-radius: 0;

    background: rgba(0, 0, 0, 0.96);
    overflow: hidden;
}

/* Căn giữa khi mở */
.image-viewer[open] {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Hình ảnh toàn màn hình */
.image-viewer img {
    display: block;

    width: auto;
    height: auto;

    max-width: 95vw;
    max-height: 85vh;

    object-fit: contain;

    cursor: default;
}

/* Nút đóng ảnh */
.viewer-close {
    position: absolute;

    top: 15px;
    right: 25px;

    width: 45px;
    height: 45px;

    padding: 0;

    font-size: 35px;
    line-height: 1;

    color: white;
    background: rgba(255, 255, 255, 0.15);

    border: none;
    border-radius: 50%;

    cursor: pointer;
    z-index: 10;
}

/* Hiệu ứng khi di chuột vào nút đóng */
.viewer-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Tên sản phẩm phía dưới ảnh */
#imageCaption {
    color: white;
    font-size: 18px;
    text-align: center;
    margin: 12px 0 0;
}

/* Ngăn cuộn trang khi đang xem ảnh */
body:has(.image-viewer[open]) {
    overflow: hidden;
}

/* Giao diện trên điện thoại */
@media (max-width: 700px) {

    .image-viewer {
        padding: 10px;
    }

    .image-viewer img {
        max-width: 95vw;
        max-height: 80vh;
    }

    .viewer-close {
        top: 10px;
        right: 10px;
    }

    #imageCaption {
        font-size: 16px;
    }
}
/* ================================================
   THIẾT KẾ THÔNG TIN LIÊN HỆ
================================================ */


/* Danh sách liên hệ */

.contact-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: 25px 0;
}


/* Từng mục liên hệ */

.contact-item {
    display: flex;
    align-items: center;
    gap: 15px;

    padding: 12px 15px;

    background: #fffaf0;
    border: 1px solid #ded2b9;
    border-radius: 10px;

    text-decoration: none;

    transition: all 0.3s ease;
}


/* Hiệu ứng khi di chuột */

.contact-item:hover {
    background: #ffffff;

    transform: translateX(5px);

    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);

    border-color: #b69a61;
}


/* Khung biểu tượng */

.contact-icon {
    width: 45px;
    height: 45px;

    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #284635;
    color: white;

    border-radius: 10px;

    font-size: 20px;
}


/* Tiêu đề liên hệ */

.contact-item strong {
    display: block;

    color: #284635;

    font-size: 15px;
    font-weight: 700;
}


/* Nội dung liên hệ */

.contact-item span {
    display: block;

    color: #67543c;

    font-size: 14px;

    overflow-wrap: anywhere;
}


/* Nội dung bên dưới slogan */

.contact-note .contact-message {
    font-family: inherit;

    font-size: 15px;
    font-style: normal;
    line-height: 1.8;

    color: #67543c;
}


/* Giao diện điện thoại */

@media (max-width: 700px) {

    .contact-item {
        padding: 10px;
        gap: 12px;
    }

    .contact-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .contact-item span {
        font-size: 13px;
    }

}
/* ================================================
   GIAO DIỆN ĐẶT HÀNG
================================================ */


/* Phương thức thanh toán */

#orderForm select {
    display: block;
    width: 100%;
    margin-top: 5px;
}


/* Nút đặt hàng */

#submitOrder {
    width: 100%;
    padding: 14px;
    margin-top: 15px;
    font-size: 16px;
    font-weight: 600;
}


/* Nút đang xử lý */

#submitOrder:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}


/* Thông báo đang gửi */

.order-loading {
    background: #fff4d6;
    color: #856404;
    padding: 15px;
    margin-top: 15px;
    border-radius: 8px;
}


/* Thông báo thành công */

.order-success {
    background: #e8f5e9;
    color: #245b30;
    border: 1px solid #a5d6a7;
    padding: 15px;
    margin-top: 15px;
    border-radius: 8px;
    font-weight: 600;
}


/* Thông báo thất bại */

.order-error {
    background: #fce8e6;
    color: #b3261e;
    border: 1px solid #e8b4b4;
    padding: 15px;
    margin-top: 15px;
    border-radius: 8px;
}


/* Phiếu đặt hàng */

#receipt {
    background: #fffdf8;
    border: 1px dashed #b69a61;
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;

    font-family: Arial, sans-serif;
    font-size: 14px;
    line-height: 1.7;

    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
/* ==================================================
   TRANG RIÊNG KHÁCH HÀNG VÀ ADMIN
================================================== */
body { min-height: 100vh; display: flex; flex-direction: column; }
header nav a { padding: 8px 11px; border-radius: 8px; }
header nav a[aria-current="page"] { background: #e9e1cd; color: #284635; font-weight: 700; }
footer { margin-top: auto; }
main { width: 100%; }
.contact { width: min(calc(100% - 32px), 1150px); margin: 35px auto 55px; }
.home-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 18px; }
.home-tile { background: #fffdf8; border: 1px solid #e1d8c7; border-radius: 12px; overflow: hidden; text-align: center; }
.home-tile img { width: 100%; height: 190px; object-fit: contain; background: #eee3cb; display: block; }
.home-tile strong { display: block; padding: 14px; color: #284635; }
.checkout, .login-panel { max-width: 690px; }
.checkout form, .login-panel form, .panel { background: #fffdf8; padding: 22px; border: 1px solid #e1d8c7; border-radius: 12px; }
.login-panel { max-width: 470px; }
.checkout select { display: block; width: 100%; }
button:disabled { opacity: .55; cursor: not-allowed; }
.metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 15px; margin: 20px 0; }
.metrics div { background: #fffdf8; border: 1px solid #e1d8c7; padding: 20px; border-radius: 10px; }
.metrics small, .metrics strong { display: block; }
.metrics strong { color: var(--forest); font-size: clamp(20px,2.4vw,32px); overflow-wrap: anywhere; }
.admin-links { display: flex; gap: 12px; flex-wrap: wrap; }
.admin-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; align-items: start; }
.order-card { margin: 15px 0; }
.order-card h3 { overflow-wrap: anywhere; }
.order-card .actions { flex-wrap: wrap; }
#orderStatus, #adminStatus, #dataStatus { color: #284635; font-weight: 600; }
#reportTable { overflow-x: auto; }
#reportTable table { width: 100%; border-collapse: collapse; }
#reportTable th, #reportTable td { text-align: left; padding: 12px 6px; border-bottom: 1px solid #e1d8c7; }
[hidden] { display: none !important; }
@media(max-width: 700px) {
    .home-grid, .metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .admin-layout { grid-template-columns: 1fr; }
    .home-tile img { height: 140px; }
    .contact { margin: 20px auto 35px; }
}
