:root {
    /* Tông màu chủ đạo nhận diện Thẩm mỹ Thu Cúc (Nền sáng / Xanh y tế & Cam) */
    --tc-green: #007A3D;
    --tc-green-dark: #005a2c;
    --tc-green-light: #059669;
    --tc-green-bg: #f0fdf4;
    --tc-green-border: #bbf7d0;
    --tc-green-glow: rgba(0, 122, 61, 0.15);

    --tc-orange: #f97316;
    --tc-orange-light: #ffedd5;
    --tc-orange-border: #fed7aa;

    /* Theme Nền Trắng Sáng Thanh Lịch */
    --bg-color: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --text-dim: #94a3b8;

    --border-color: #e2e8f0;
    --border-subtle: #f1f5f9;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-card: 0 4px 16px -2px rgba(0, 0, 0, 0.05), 0 0 0 1px rgba(0, 0, 0, 0.04);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-full: 9999px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    background-image:
        radial-gradient(circle at 10% 10%, rgba(0, 122, 61, 0.04) 0%, transparent 40%),
        radial-gradient(circle at 90% 40%, rgba(249, 115, 22, 0.03) 0%, transparent 35%),
        radial-gradient(circle at 50% 90%, rgba(0, 122, 61, 0.03) 0%, transparent 45%);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 16px 60px;
}

/* HEADER */
.header {
    text-align: center;
    margin-bottom: 20px;
    position: relative;
}

.header-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: var(--tc-green-bg);
    border: 1px solid var(--tc-green-border);
    border-radius: var(--radius-full);
    color: var(--tc-green);
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.header h1 {
    font-size: 1.75rem;
    font-weight: 800;
    margin: 0 0 4px;
    color: #0f172a;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    line-height: 1.3;
}

.header h1 span {
    color: var(--tc-green);
}

.header p {
    color: var(--text-muted);
    font-size: 0.92rem;
    font-weight: 400;
    margin: 0;
    letter-spacing: 0.5px;
}

/* CONTROLS & FILTER BAR */
.controls-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 14px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-card);
}

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

.search-box {
    position: relative;
    flex: 1;
}

.search-box svg.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    fill: none;
    stroke: var(--text-muted);
    transition: stroke 0.2s;
}

.search-input {
    width: 100%;
    padding: 8px 36px 8px 36px;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    color: var(--text-main);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: all 0.2s ease;
}

.search-input:focus {
    border-color: var(--tc-green);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(0, 122, 61, 0.1);
}

.search-input:focus+svg.search-icon {
    stroke: var(--tc-green);
}

.clear-search-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: #e2e8f0;
    border: none;
    color: var(--text-secondary);
    border-radius: 50%;
    width: 18px;
    height: 18px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    line-height: 1;
    transition: all 0.2s;
}

.clear-search-btn:hover {
    background: #cbd5e1;
    color: #0f172a;
}

/* CATEGORY FILTER CHIPS */
.category-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.category-tabs::-webkit-scrollbar {
    height: 3px;
}

.category-tabs::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.cat-chip {
    padding: 5px 12px;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: inherit;
}

.cat-chip:hover {
    background: var(--tc-green-bg);
    border-color: var(--tc-green-border);
    color: var(--tc-green);
}

.cat-chip.active {
    background: var(--tc-green);
    border-color: var(--tc-green);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0, 122, 61, 0.25);
}

.cat-chip .count-badge {
    font-size: 0.68rem;
    padding: 1px 5px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.06);
    color: inherit;
}

.cat-chip.active .count-badge {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

/* LOADING & SPINNER */
#loading {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.spinner {
    border: 3px solid #e2e8f0;
    border-left-color: var(--tc-green);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    animation: spin 0.9s cubic-bezier(0.5, 0.1, 0.5, 0.9) infinite;
    margin: 0 auto 12px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* CATEGORY SECTION */
.category-section {
    margin-bottom: 28px;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.category-header-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.category-title {
    font-size: 1.18rem;
    font-weight: 700;
    color: var(--tc-green-dark);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    gap: 7px;
}

.category-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 16px;
    background: linear-gradient(180deg, var(--tc-orange) 0%, var(--tc-green) 100%);
    border-radius: 2px;
}

.category-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--tc-green-border) 0%, #e2e8f0 100%);
}

/* SUBCATEGORY CARD */
.subcategory-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    margin-bottom: 16px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.subcategory-header {
    background: linear-gradient(90deg, #f0fdf4 0%, #ffffff 100%);
    border-bottom: 1px solid var(--border-color);
    padding: 8px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.subcategory-header h3 {
    margin: 0;
    font-size: 0.94rem;
    font-weight: 600;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 6px;
}

.subcategory-header h3::before {
    content: '✦';
    color: var(--tc-green);
    font-size: 0.75rem;
}

.subcategory-count {
    font-size: 0.72rem;
    color: var(--tc-green-dark);
    background: var(--tc-green-bg);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    border: 1px solid var(--tc-green-border);
    font-weight: 500;
}

/* ==========================================================
   1. DESKTOP TABLE VIEW (THU GỌN PADDING & TỶ LỆ CHUẨN)
   ========================================================== */
.table-desktop {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
}

th {
    background: #f8fafc;
    color: var(--tc-green-dark);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.3px;
    padding: 8px 10px;
    text-align: left;
    border-bottom: 2px solid var(--tc-green-border);
    white-space: nowrap;
}

/* CÂN CHỈNH TỶ LỆ CỘT */
th:nth-child(1) {
    width: 5%;
    text-align: center;
}

th:nth-child(2) {
    width: 13%;
}

th:nth-child(3) {
    width: 44%;
}

th:nth-child(4) {
    width: 20%;
}

th:nth-child(5) {
    width: 18%;
    text-align: right;
}

td {
    padding: 6px 10px;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.88rem;
    vertical-align: middle;
    word-wrap: break-word;
    color: var(--text-secondary);
}

.item-row {
    background-color: #ffffff;
}

.item-row.block-start td {
    border-top: 1px solid var(--tc-green-border);
}

.item-row:last-child td {
    border-bottom: none;
}

.stt-col {
    text-align: center;
    border-right: 1px solid #f1f5f9;
}

.stt-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 500;
}

.code-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    background: var(--tc-green-bg);
    border: 1px solid var(--tc-green-border);
    border-radius: var(--radius-sm);
    color: var(--tc-green);
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    cursor: default;
    user-select: text;
}

.service-name {
    font-weight: 600;
    color: #0f172a;
    font-size: 0.89rem;
    line-height: 1.35;
    background: #fafafa;
    border-right: 1px solid #f1f5f9;
    border-left: 1px solid #f1f5f9;
}

.service-name-content {
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.service-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--tc-green);
    margin-top: 6px;
    flex-shrink: 0;
}

.detail-tag {
    display: inline-block;
    padding: 2px 6px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    color: #334155;
    line-height: 1.3;
    font-size: 0.84rem;
}

.price-col {
    text-align: right;
    vertical-align: middle;
    border-left: 1px solid #f1f5f9;
}

/* GIÁ TIỀN & ĐƠN VỊ CÙNG 1 HÀNG NGANG (ROW) */
.price-tag {
    display: inline-flex;
    flex-direction: row;
    align-items: baseline;
    justify-content: flex-end;
    gap: 4px;
    padding: 3px 8px;
    background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
    border: 1px solid var(--tc-green-border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
}

.price-value {
    font-weight: 700;
    color: var(--tc-green);
    font-size: 0.94rem;
    line-height: 1;
}

.price-unit {
    font-size: 0.74rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: none;
}

.price-contact {
    color: #c2410c;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 3px 8px;
    background: var(--tc-orange-light);
    border: 1px solid var(--tc-orange-border);
    border-radius: var(--radius-sm);
    display: inline-block;
    white-space: nowrap;
}

/* ==========================================================
   2. MOBILE CARD VIEW (TỐI ƯU CHO ĐIỆN THOẠI)
   ========================================================== */
.mobile-service-list {
    display: none;
    padding: 8px;
}

.mobile-service-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.mobile-service-card:last-child {
    margin-bottom: 0;
}

.mobile-card-title-bar {
    background: #fafbfc;
    border-bottom: 1px solid var(--border-color);
    padding: 7px 10px;
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.mobile-card-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.3;
    flex: 1;
}

.mobile-variation-list {
    padding: 2px 10px;
}

.mobile-var-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px dashed #f1f5f9;
    gap: 6px;
}

.mobile-var-item:last-child {
    border-bottom: none;
}

.mobile-var-info {
    display: flex;
    align-items: center;
    gap: 5px;
    flex: 1;
    min-width: 0;
    flex-wrap: wrap;
}

.mobile-var-detail {
    font-size: 0.83rem;
    color: #334155;
    font-weight: 500;
}

.mobile-var-price {
    flex-shrink: 0;
    text-align: right;
}

/* RESPONSIVE SWITCHER */
@media (max-width: 767px) {
    .container {
        padding: 14px 8px 45px;
    }

    .header {
        margin-bottom: 14px;
    }

    .header h1 {
        font-size: 1.35rem;
    }

    .header p {
        font-size: 0.82rem;
    }

    .controls-wrapper {
        padding: 10px;
        margin-bottom: 14px;
    }

    .table-desktop {
        display: none !important;
    }

    .mobile-service-list {
        display: block !important;
    }

    .category-title {
        font-size: 1.05rem;
    }

    .subcategory-header {
        padding: 7px 10px;
    }
}

@media (min-width: 768px) {
    .table-desktop {
        display: block;
    }

    .mobile-service-list {
        display: none !important;
    }
}

/* EMPTY SEARCH STATE */
.empty-state {
    text-align: center;
    padding: 35px 14px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px dashed var(--border-color);
    margin: 20px 0;
}

.empty-state svg {
    width: 36px;
    height: 36px;
    stroke: var(--text-dim);
    margin-bottom: 8px;
}

.empty-state h3 {
    color: #0f172a;
    margin: 0 0 4px;
    font-size: 1.05rem;
}

.empty-state p {
    color: var(--text-muted);
    margin: 0 0 10px;
    font-size: 0.85rem;
}

.reset-search-btn {
    background: var(--tc-green);
    border: 1px solid var(--tc-green);
    color: #ffffff;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 0.84rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.reset-search-btn:hover {
    background: var(--tc-green-dark);
}

/* BACK TO TOP BUTTON */
.back-to-top {
    position: fixed;
    bottom: 20px;
    right: 16px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid var(--tc-green-border);
    color: var(--tc-green);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.2s ease;
    z-index: 900;
}

.back-to-top.show {
    opacity: 1;
    transform: scale(1);
}

.back-to-top:hover {
    background: var(--tc-green-bg);
    border-color: var(--tc-green);
}