/**
 * lh-base.css — Nền tảng design system Longhousee cho trang web nhúng (webview/appview).
 *
 * Đồng bộ với:
 *   - Web  : frontend Tailwind (Quicksand + Lexend, bg slate, brand #EE4D2D)
 *   - App  : mobile/src/shared/styles/tokens.ts (colors/spacing/radius/shadow)
 * Xem docs/design-guidelines.md (mục "Trang web nhúng trong app") của repo longhousee.com.
 *
 * File này: token, reset, typography, layout khung trang, app bar, tiêu đề mục,
 * hộp ghi chú (info box) và một nhóm utility tối thiểu (thay cho Bootstrap 4).
 */

/* ── Design tokens ─────────────────────────────────────────────────────── */
:root {
    /* Brand */
    --lh-primary: #ee4d2d;
    --lh-primary-dark: #d44425;
    --lh-primary-light: #ff6b4d;
    --lh-primary-surface: #fff2f0;

    /* Text */
    --lh-text: #1e293b;
    --lh-text-secondary: #475569;
    --lh-text-muted: #94a3b8;

    /* Surface */
    --lh-bg: #ffffff;
    --lh-bg-secondary: #f8fafc;
    --lh-bg-muted: #f1f5f9;

    /* Border */
    --lh-border: #e2e8f0;
    --lh-border-dark: #cbd5e1;

    /* Semantic */
    --lh-success: #16a34a;
    --lh-success-surface: #f0fdf4;
    --lh-success-border: #bbf7d0;
    --lh-warning: #b45309;
    --lh-warning-surface: #fffbeb;
    --lh-warning-border: #fde68a;
    --lh-error: #dc2626;
    --lh-error-surface: #fef2f2;
    --lh-error-border: #fecaca;
    --lh-info: #2563eb;
    --lh-info-surface: #eff6ff;
    --lh-info-border: #bfdbfe;

    /* Gradient nhấn cam → vàng: app bar, CTA chính, icon mục, ghi chú trạng thái.
       Chữ đặt trên nền này dùng --lh-accent-text (nâu đậm) cho đủ tương phản. */
    --lh-accent-from: #fb923c;
    --lh-accent-to: #fbbf24;
    --lh-accent-text: #7c2d12;
    --lh-gradient-accent: linear-gradient(135deg, var(--lh-accent-from) 0%, var(--lh-accent-to) 100%);

    /* Sàn & mạng xã hội */
    --lh-shopee: #ee4d2d;
    --lh-lazada: #0f146d;
    --lh-facebook: #1877f2;
    --lh-zalo: #0068ff;

    /* Radius (khớp borderRadius trong tokens.ts) */
    --lh-radius-sm: 6px;
    --lh-radius-md: 8px;
    --lh-radius-lg: 12px;
    --lh-radius-xl: 16px;
    --lh-radius-pill: 999px;

    /* Shadow — flat design, rất nhẹ */
    --lh-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --lh-shadow-md: 0 2px 8px rgba(15, 23, 42, 0.08);

    /* Spacing 4dp/8dp */
    --lh-space-xs: 4px;
    --lh-space-sm: 8px;
    --lh-space-md: 12px;
    --lh-space-lg: 16px;
    --lh-space-xl: 24px;

    /* Font */
    --lh-font-body: "Quicksand", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --lh-font-heading: "Lexend", var(--lh-font-body);
}

/* ── Reset ─────────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--lh-bg-secondary);
    color: var(--lh-text);
    font-family: var(--lh-font-body);
    font-size: 15px;
    font-weight: 500;
    line-height: 1.5;
}

/* Mở trong WebView của app (?lh_view=app): app bar bị ẩn nên nới đệm trên cho
   nội dung không dính sát AppHeader của app. KHÔNG dùng overscroll-behavior:
   contain ở đây — nó chặn luôn cử chỉ kéo-xuống-tải-lại của WebView. */
body.is-appview .page {
    padding-top: var(--lh-space-lg);
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--lh-font-heading);
    color: var(--lh-text);
    margin: 0;
}

p {
    margin: 0 0 var(--lh-space-sm);
}

p:last-child {
    margin-bottom: 0;
}

a {
    color: var(--lh-primary);
    text-decoration: none;
}

img {
    max-width: 100%;
}

ul,
ol {
    margin: 0;
    padding-left: 1.25rem;
}

/* ── Khung trang ───────────────────────────────────────────────────────── */
.page {
    max-width: 640px;
    margin: 0 auto;
    padding: var(--lh-space-md) var(--lh-space-md)
        calc(var(--lh-space-xl) + env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-direction: column;
    gap: var(--lh-space-md);
}

/* ── App bar (thanh tiêu đề dính trên cùng) ────────────────────────────── */
.app-bar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--lh-gradient-accent);
    padding-top: env(safe-area-inset-top, 0px);
    box-shadow: var(--lh-shadow-md);
}

.app-bar__inner {
    max-width: 640px;
    margin: 0 auto;
    min-height: 52px;
    padding: var(--lh-space-sm) var(--lh-space-md);
    display: flex;
    align-items: center;
    gap: var(--lh-space-sm);
}

.app-bar__logo {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: var(--lh-radius-pill);
    background: rgba(255, 255, 255, 0.55);
    color: var(--lh-accent-text);
    font-size: 17px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-bar__titles {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.app-bar__title {
    font-family: var(--lh-font-heading);
    font-size: 16px;
    font-weight: 700;
    color: var(--lh-accent-text);
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-bar__subtitle {
    font-size: 11px;
    font-weight: 600;
    color: var(--lh-accent-text);
    opacity: 0.8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Tiêu đề mục (icon tròn gradient + nhãn) — giống web frontend ──────── */
.section-head {
    display: flex;
    align-items: center;
    gap: var(--lh-space-sm);
}

.section-head__icon {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: var(--lh-radius-pill);
    background: var(--lh-gradient-accent);
    color: var(--lh-accent-text);
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-head__text {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.section-head__eyebrow {
    font-size: 11px;
    font-weight: 700;
    color: var(--lh-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.section-head__title {
    font-family: var(--lh-font-heading);
    font-size: 13.5px;
    font-weight: 700;
    color: var(--lh-text-secondary);
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Bộ lọc nằm cùng hàng tiêu đề — co lại để tiêu đề không bị xuống dòng */
.section-head__action {
    margin-left: auto;
    flex: 0 0 auto;
}

/* ── Info box (ghi chú / cảnh báo / hướng dẫn) ─────────────────────────── */
.info-box {
    border: 1px solid var(--lh-border);
    background: var(--lh-bg);
    border-radius: var(--lh-radius-lg);
    padding: var(--lh-space-md);
    font-size: 13px;
    color: var(--lh-text-secondary);
}

.info-box__title {
    display: flex;
    align-items: center;
    gap: var(--lh-space-sm);
    font-family: var(--lh-font-heading);
    font-size: 14px;
    font-weight: 700;
    color: var(--lh-text);
    margin-bottom: var(--lh-space-sm);
}

.info-box ul,
.info-box ol {
    margin: 0;
    padding-left: 1.15rem;
}

.info-box li + li {
    margin-top: var(--lh-space-xs);
}

.info-box--warning {
    background: var(--lh-warning-surface);
    border-color: var(--lh-warning-border);
    color: var(--lh-warning);
}

.info-box--warning .info-box__title {
    color: var(--lh-warning);
}

.info-box--info {
    background: var(--lh-info-surface);
    border-color: var(--lh-info-border);
    color: var(--lh-info);
}

.info-box--info .info-box__title {
    color: var(--lh-info);
}

/* Khối lưu ý lồng bên trong info-box (vd "Lưu ý quan trọng" trong "Hướng dẫn") */
.note-block {
    margin-top: var(--lh-space-md);
    padding: var(--lh-space-md);
    background: var(--lh-warning-surface);
    border: 1px solid var(--lh-warning-border);
    border-radius: var(--lh-radius-md);
    color: var(--lh-warning);
}

.note-block__title {
    display: flex;
    align-items: center;
    gap: var(--lh-space-sm);
    font-family: var(--lh-font-heading);
    font-size: 13px;
    font-weight: 700;
    margin-bottom: var(--lh-space-sm);
}

.note-block ul {
    margin: 0;
    padding-left: 1.15rem;
}

.note-block li + li {
    margin-top: var(--lh-space-xs);
}

/* Nội dung admin nhập tay (HTML tự do) — ép ảnh/bảng không tràn khung */
.rich-text img {
    max-width: 100%;
    height: auto;
    border-radius: var(--lh-radius-md);
}

.rich-text table {
    max-width: 100%;
    display: block;
    overflow-x: auto;
}

.guide-image {
    display: block;
    width: 100%;
    margin-top: var(--lh-space-sm);
    border-radius: var(--lh-radius-md);
    border: 1px solid var(--lh-border);
}

/* ── Utility tối thiểu (thay các class Bootstrap còn dùng trong JS) ────── */
.d-none {
    display: none !important;
}

.d-block {
    display: block !important;
}

.d-flex {
    display: flex !important;
}

.align-items-center {
    align-items: center;
}

.justify-content-between {
    justify-content: space-between;
}

.justify-content-center {
    justify-content: center;
}

.flex-wrap {
    flex-wrap: wrap;
}

.gap-2 {
    gap: var(--lh-space-sm);
}

.w-100 {
    width: 100%;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--lh-text-muted);
}

.text-secondary {
    color: var(--lh-text-secondary);
}

.text-primary {
    color: var(--lh-primary);
}

.text-success {
    color: var(--lh-success);
}

.text-danger {
    color: var(--lh-error);
}

.text-warning {
    color: var(--lh-warning);
}

.mr-1 {
    margin-right: var(--lh-space-xs);
}

.mr-2 {
    margin-right: var(--lh-space-sm);
}

.mb-0 {
    margin-bottom: 0 !important;
}

.mb-2 {
    margin-bottom: var(--lh-space-sm);
}

.mb-3 {
    margin-bottom: var(--lh-space-md);
}

.mt-2 {
    margin-top: var(--lh-space-sm);
}

.mt-3 {
    margin-top: var(--lh-space-md);
}

.p-0 {
    padding: 0 !important;
}

.p-2 {
    padding: var(--lh-space-sm) !important;
}

.py-3 {
    padding-top: var(--lh-space-md);
    padding-bottom: var(--lh-space-md);
}
