/* ==============================================================
   BLOOMSHOP - HỆ THỐNG GIAO DIỆN & TỐI ƯU RESPONSIVE MỌI THIẾT BỊ
   Hỗ trợ: Điện thoại (< 576px), Tablet (576px - 991px), Desktop (>= 992px)
============================================================== */

:root {
    --bloom-primary: #a87768;
    --bloom-hover: #81594e;
    --bloom-dark: #604b41;
    --bloom-light: #faf7f5;
    --bloom-cream: #f5efe8;
    --bloom-accent: #c98d8d;
    --bloom-border: #ebdcd5;
}

/* 1. CSS CHUNG & SMOOTH SCROLL */
html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bloom-light);
    color: #4a3e3d;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--bloom-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}
a:hover {
    color: var(--bloom-hover);
}

/* Tối ưu thanh cuộn trên cảm ứng cho bảng dữ liệu */
.table-responsive {
    -webkit-overflow-scrolling: touch;
}

/* 2. TOP BAR */
.top-bar {
    background-color: var(--bloom-cream);
    color: #71594a;
    padding: 8px 15px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
}

/* 3. NAVBAR */
.navbar {
    padding: 12px 0;
    border-bottom: 1px solid var(--bloom-border);
    background-color: #ffffff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
}
.navbar-brand {
    font-size: 26px;
    font-weight: 800;
    color: var(--bloom-dark);
    letter-spacing: 0.5px;
}
.navbar-brand span {
    color: var(--bloom-accent);
}
.navbar-nav {
    gap: 8px;
}
.navbar-nav .nav-link {
    color: var(--bloom-dark);
    font-size: 15px;
    font-weight: 500;
    padding: 7px 12px;
    border-radius: 6px;
    transition: all 0.2s ease;
}
.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
    color: var(--bloom-primary);
    background-color: #fcf8f6;
}

/* Search bar header */
.header-search-form {
    max-width: 380px;
    width: 100%;
}

/* 4. BUTTONS & CONTROLS */
.hero-button, .btn-bloom {
    background-color: var(--bloom-primary);
    border-color: var(--bloom-primary);
    color: #ffffff;
    padding: 8px 20px;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s ease;
}
.hero-button:hover, .btn-bloom:hover {
    background-color: var(--bloom-hover);
    border-color: var(--bloom-hover);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(168, 119, 104, 0.25);
}
.btn-bloom-outline {
    border: 1px solid var(--bloom-primary);
    color: var(--bloom-primary);
    background: transparent;
    padding: 8px 18px;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s ease;
}
.btn-bloom-outline:hover {
    background: var(--bloom-primary);
    color: #ffffff;
}

/* 5. HERO SECTION */
.hero-section {
    background-color: #f9f2ec;
    padding: 55px 0;
    border-bottom: 1px solid #eee4dc;
}
.hero-content {
    padding-right: 25px;
}
.hero-subtitle {
    color: #bd8a78;
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 3px;
    margin-bottom: 12px;
}
.hero-title {
    color: var(--bloom-dark);
    font-size: clamp(26px, 4vw, 42px);
    font-weight: 800;
    line-height: 1.25;
    margin-bottom: 18px;
}
.hero-description {
    color: #777777;
    font-size: clamp(14px, 2vw, 16px);
    line-height: 1.7;
    margin-bottom: 25px;
}
.hero-image img {
    width: 100%;
    height: 380px;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(100, 70, 60, 0.12);
}

/* 6. CARD SẢN PHẨM */
.product-card {
    transition: all 0.25s ease-in-out;
    border: 1px solid var(--bloom-border) !important;
    border-radius: 10px;
    overflow: hidden;
    background: #ffffff;
}
.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(100, 70, 60, 0.12) !important;
    border-color: #d6b8ac !important;
}
.product-image {
    width: 100%;
    height: 220px;
    object-fit: cover;
    transition: transform 0.3s ease;
}
.product-card:hover .product-image {
    transform: scale(1.03);
}
.product-title-link {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 42px;
    font-size: 15px;
    line-height: 1.4;
}
.price-text {
    color: var(--bloom-primary);
    font-size: 16px;
    font-weight: 700;
}
.old-price {
    font-size: 12px;
    color: #999;
    text-decoration: line-through;
}
.badge-sale {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #e63946;
    color: #fff;
    padding: 3px 7px;
    font-size: 11px;
    font-weight: bold;
    border-radius: 4px;
    z-index: 2;
}

/* 7. TIẾN TRÌNH GIAO HÀNG (TIMELINE TRACKING) */
.tracking-stepper {
    display: flex;
    justify-content: space-between;
    position: relative;
    margin: 30px 0;
    padding: 0;
}
.tracking-stepper::before {
    content: '';
    position: absolute;
    top: 22px;
    left: 40px;
    right: 40px;
    height: 4px;
    background: #e2d9d2;
    z-index: 1;
}
.tracking-step {
    position: relative;
    z-index: 2;
    text-align: center;
    flex: 1;
}
.tracking-step .step-icon {
    width: 46px;
    height: 46px;
    line-height: 44px;
    border-radius: 50%;
    background: #ffffff;
    border: 3px solid #e2d9d2;
    color: #999;
    font-size: 18px;
    margin: 0 auto 10px;
    transition: 0.3s;
}
.tracking-step.active .step-icon {
    border-color: var(--bloom-primary);
    background: var(--bloom-primary);
    color: #ffffff;
    box-shadow: 0 0 0 4px rgba(168, 119, 104, 0.2);
}
.tracking-step.completed .step-icon {
    border-color: #28a745;
    background: #28a745;
    color: #ffffff;
}
.tracking-step .step-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--bloom-dark);
}

/* 8. HUY HIỆU KHÁCH HÀNG (TIER BADGES) */
.badge-tier {
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.badge-silver {
    background: #e9ecef;
    color: #495057;
    border: 1px solid #ced4da;
}
.badge-gold {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}
.badge-diamond {
    background: #e2f0fe;
    color: #0d6efd;
    border: 1px solid #b6d4fe;
    box-shadow: 0 0 8px rgba(13, 110, 253, 0.25);
}

/* 9. ĐÁNH GIÁ SAO */
.star-rating {
    color: #f1b44c;
    font-size: 18px;
}
.rating-input {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    gap: 8px;
}
.rating-input input {
    display: none;
}
.rating-input label {
    font-size: 26px;
    color: #ccc;
    cursor: pointer;
    transition: 0.2s;
}
.rating-input input:checked ~ label,
.rating-input label:hover,
.rating-input label:hover ~ label {
    color: #f1b44c;
}

/* 10. THỐNG KÊ DOANH THU BIỂU ĐỒ THUẦN CSS */
.chart-scroll-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
}
.chart-bar-container {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    height: 220px;
    padding-top: 25px;
    border-bottom: 2px solid #ddd;
    min-width: 520px; /* Đảm bảo cột không bị co rúm trên thiết bị nhỏ */
}
.chart-bar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
}
.chart-bar-fill {
    width: 100%;
    max-width: 45px;
    background: linear-gradient(180deg, #c98d8d 0%, var(--bloom-primary) 100%);
    border-radius: 5px 5px 0 0;
    transition: height 0.5s ease;
    position: relative;
}
.chart-bar-fill:hover {
    background: linear-gradient(180deg, #b06e6e 0%, var(--bloom-hover) 100%);
}
.chart-bar-label {
    font-size: 11px;
    margin-top: 8px;
    text-align: center;
    color: #666;
}
.chart-bar-val {
    position: absolute;
    top: -22px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    font-weight: bold;
    color: var(--bloom-dark);
    white-space: nowrap;
}

/* 11. FORM & FOOTER */
.auth-form, .form-page {
    max-width: 650px;
}
.site-footer {
    background-color: var(--bloom-cream);
    color: #71594a;
    border-top: 1px solid var(--bloom-border);
}

/* ==============================================================
   RESPONSIVE MEDIA QUERIES (TABLET & MOBILE)
============================================================== */

/* Màn hình Tablet & Dưới (<= 991px) */
@media (max-width: 991px) {
    .header-search-form {
        max-width: 100%;
        margin: 12px 0 !important;
    }
    .navbar-nav {
        padding-top: 10px;
    }
    .navbar-nav .nav-link {
        padding: 8px 12px;
    }
    .sticky-top {
        position: static !important; /* Tránh đè che màn hình trên mobile/tablet */
    }
}

/* Màn hình Điện thoại (<= 767px) */
@media (max-width: 767px) {
    .hero-section {
        padding: 35px 0;
    }
    .hero-content {
        padding-right: 0;
        margin-bottom: 25px;
        text-align: center;
    }
    .hero-image img {
        height: 250px;
    }
    .tracking-stepper::before {
        display: none;
    }
    .tracking-stepper {
        flex-direction: column;
        gap: 15px;
    }
    .tracking-step {
        display: flex;
        align-items: center;
        text-align: left;
        gap: 15px;
    }
    .tracking-step .step-icon {
        margin: 0;
        flex-shrink: 0;
    }

    /* Đổi hiển thị card sản phẩm trên mobile */
    .product-image {
        height: 165px;
    }
    .product-title-link {
        font-size: 13px;
        min-height: 36px;
    }
    .price-text {
        font-size: 14px;
    }
}

/* Màn hình Điện thoại nhỏ (<= 576px) */
@media (max-width: 576px) {
    .top-bar {
        font-size: 11px;
        padding: 6px 8px;
        justify-content: center !important;
        text-align: center;
        gap: 4px;
    }
    .top-bar span {
        width: 100%;
        text-align: center;
    }
    .navbar-brand {
        font-size: 22px;
    }
    .container {
        padding-left: 12px;
        padding-right: 12px;
    }
    .card {
        border-radius: 10px;
    }
}

