﻿/* Bảng màu lấy từ logo TND LAW */
:root {
    --navy-deep: #0c1b2c;
    --navy: #11263d;
    --navy-2: #17304b;
    --navy-3: #1e4466;
    --gold: #d9ac5f;
    --gold-light: #f6dc94;
    --bronze: #c47f2c;
    --gold-grad: linear-gradient(135deg, #f6dc94 0%, #e2b968 45%, #c47f2c 100%);
    --gold-soft: #f7eedb;
    --bg: #f4f5f7;
    --card: #ffffff;
    --text: #1d2433;
    --muted: #6b7385;
    --line: #e3e6ec;
    --ok: #1f7a4d;
    --ok-bg: #e3f4ea;
    --warn: #9a5b00;
    --warn-bg: #fdf0d9;
    --fail: #b42318;
    --fail-bg: #fde7e5;
    --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
/* Chặn mọi tràn ngang trên điện thoại (clip không tạo scroll container nên header sticky vẫn chạy) */
body { overflow-x: clip; }
img { max-width: 100%; }
body {
    font-family: "Be Vietnam Pro", "Segoe UI", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.6;
}
a { color: var(--navy-2); text-decoration: none; }
a:hover { color: var(--bronze); }
h1, h2, h3 { font-family: "Lora", Georgia, serif; line-height: 1.3; margin: 0 0 .5em; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.08rem; }
.container { max-width: 1160px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.small { font-size: .85em; }
.nowrap { white-space: nowrap; }
code { background: var(--gold-soft); padding: 1px 6px; border-radius: 4px; }

/* Topbar */
.topbar { background: var(--navy-deep); color: #fff; position: sticky; top: 0; z-index: 10; box-shadow: 0 2px 12px rgba(0,0,0,.25); border-bottom: 1px solid rgba(217,172,95,.25); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; min-height: 70px; flex-wrap: wrap; gap: 6px 16px; padding-top: 8px; padding-bottom: 8px; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; }
.brand:hover { color: #fff; }
.brand-logo { height: 48px; width: auto; display: block; }
.wordmark {
    font-family: "Montserrat", "Be Vietnam Pro", sans-serif; font-weight: 800; letter-spacing: 1.5px;
    background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand strong { display: block; font-size: 1.3rem; line-height: 1.2; }
.brand small { display: block; font-size: .64rem; color: #d8c79d; text-transform: uppercase; letter-spacing: 1.6px; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { color: #d9dfec; padding: 8px 12px; border-radius: 8px; font-weight: 500; font-size: .93rem; }
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav a.active { background: rgba(217,172,95,.16); color: var(--gold-light); }
.nav a.nav-status { border: 1px solid rgba(217,172,95,.45); }
.nav-toggle, .nav-toggle-label { display: none; }

/* Hero */
.hero { background: radial-gradient(ellipse at 15% 0%, var(--navy-3) 0%, var(--navy-2) 35%, var(--navy) 65%, var(--navy-deep) 100%); color: #fff; padding: 56px 0 64px; }
.hero h1 { color: #fff; }
.hero h1 em { font-style: normal; background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-inner { display: grid; grid-template-columns: 1.5fr 1fr; gap: 40px; align-items: center; }
.eyebrow { color: var(--gold-light); text-transform: uppercase; font-size: .78rem; letter-spacing: 2px; font-weight: 600; }
.hero h1 { font-size: 2.4rem; margin: 10px 0 14px; }
.hero p { color: #c9d1e3; max-width: 560px; }
.hero-search { display: flex; margin-top: 22px; background: #fff; border-radius: 10px; padding: 5px; max-width: 580px; }
.hero-search input { flex: 1; width: 100%; border: 0; padding: 12px 14px; font: inherit; outline: none; min-width: 0; }
.hero-search button { flex: none; }
/* Cột grid mặc định không co nhỏ hơn nội dung -> cho phép co để không tràn */
.hero-inner > *, .grid-2 > *, .features > *, .cards > * { min-width: 0; }
h1, h2, h3 { overflow-wrap: break-word; }
.hero-search button, .searchbar button, .btn {
    background: var(--gold-grad); color: var(--navy-deep); border: 0; border-radius: 8px; padding: 10px 20px;
    font: inherit; font-weight: 700; cursor: pointer; display: inline-block; box-shadow: 0 2px 8px rgba(196,127,44,.25);
}
.hero-search button:hover, .searchbar button:hover, .btn:hover { filter: brightness(1.07); color: var(--navy-deep); }
.stats { display: grid; gap: 12px; }
.stat { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); border-radius: var(--radius); padding: 14px 20px; color: #c9d1e3; }
.stat { border-left: 3px solid var(--gold); }
.stat span { display: block; font-family: "Montserrat", sans-serif; font-size: 1.9rem; font-weight: 800; line-height: 1.2; background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Page */
.page { padding: 36px 20px 56px; }
.narrow { max-width: 880px; }
.page-title { font-size: 1.9rem; color: var(--navy); }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.back { display: inline-block; margin-bottom: 10px; font-size: .9rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 18px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; }
.card-head a { font-size: .88rem; }
.empty { text-align: center; color: var(--muted); padding: 40px; }

.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin: -70px 0 28px; }
.feature { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; color: var(--text); box-shadow: 0 8px 24px rgba(19,35,63,.08); transition: transform .15s, box-shadow .15s; }
.feature:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(19,35,63,.14); color: var(--text); }
.feature-icon { font-size: 26px; width: 48px; height: 48px; border-radius: 12px; background: var(--gold-soft); display: grid; place-items: center; margin-bottom: 12px; }
.feature p { color: var(--muted); margin: 0; font-size: .92rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list a { font-weight: 500; }
.meta, .meta-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; font-size: .82rem; color: var(--muted); margin-top: 4px; }
.meta-row { margin: 0 0 12px; font-size: .9rem; }
.tag { background: #eef1f7; color: var(--navy-2); padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.status { padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.status.ok { background: var(--ok-bg); color: var(--ok); }
.status.warn { background: var(--warn-bg); color: var(--warn); }

/* Search & filters */
.searchbar { display: flex; gap: 10px; margin: 8px 0 14px; flex-wrap: wrap; }
.searchbar input, .searchbar select { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; }
.searchbar input { flex: 1; min-width: 220px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 20px; }
.chip { padding: 6px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--text); font-size: .88rem; }
.chip.active { background: var(--navy); color: var(--gold-light); border-color: var(--navy); }

/* Table */
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; background: #f8f9fb; font-size: .8rem; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: #fbfaf6; }

.info-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.info-grid label { display: block; font-size: .75rem; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.prose { white-space: pre-line; }

/* Forms (biểu mẫu) */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 18px; }
.form-card { display: flex; flex-direction: column; margin: 0; }
.form-card p { flex: 1; font-size: .9rem; }
.form-code { font-size: .75rem; color: var(--bronze); font-weight: 700; letter-spacing: 1px; }
.form-actions { display: flex; justify-content: space-between; align-items: center; }
.btn-sm { font-size: .85rem; font-weight: 600; padding: 5px 12px; border-radius: 6px; border: 1px solid var(--gold); color: var(--navy); }
.btn-sm:hover { background: var(--gold-grad); color: var(--navy-deep); }
.paper { background: #fff; border: 1px solid var(--line); box-shadow: 0 6px 20px rgba(0,0,0,.06); padding: 48px 56px; white-space: pre-wrap; font-family: "Times New Roman", serif; font-size: 16px; line-height: 1.7; }

/* Q&A */
.qa h3 { margin-top: 8px; }
.question { white-space: pre-line; }
.answer { background: var(--gold-soft); border-left: 4px solid var(--gold); padding: 12px 16px; border-radius: 0 8px 8px 0; white-space: pre-line; }
.alert { background: var(--ok-bg); color: var(--ok); padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-weight: 500; }
.form .field { margin-bottom: 14px; }
.form label { display: block; font-weight: 600; margin-bottom: 4px; font-size: .9rem; }
.form input, .form select, .form textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; }
.form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid rgba(217,172,95,.45); border-color: var(--gold); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-error { color: var(--fail); font-size: .85rem; }
.input-validation-error { border-color: var(--fail) !important; }
.plain { padding-left: 18px; }

/* Status */
.checks { display: grid; gap: 12px; margin-top: 20px; }
.check { display: flex; gap: 14px; padding: 18px; border-radius: var(--radius); border: 1px solid var(--line); background: #fff; }
.check > span { width: 32px; height: 32px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 700; }
.check.ok > span { background: var(--ok-bg); color: var(--ok); }
.check.fail > span { background: var(--fail-bg); color: var(--fail); }
.check.fail { border-color: #f5c2bd; }
.code { background: #f4f5f7; padding: 10px; border-radius: 8px; font-size: .8rem; white-space: pre-wrap; margin: 8px 0 0; }

/* Footer */
.footer { background: var(--navy-deep); color: #c9d1e3; padding: 24px 0; font-size: .88rem; border-top: 1px solid rgba(217,172,95,.25); }
.footer .muted { color: #8f9ab3; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; }
.footer-brand { display: flex; align-items: center; gap: 12px; }
.footer-brand img { height: 40px; }

/* Login */
.login-body {
    min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
    background: radial-gradient(ellipse at 20% 0%, var(--navy-3) 0%, var(--navy-2) 30%, var(--navy) 60%, var(--navy-deep) 100%);
}
.login-wrap { width: 100%; max-width: 380px; display: flex; flex-direction: column; align-items: center; gap: 26px; }
.login-logo { width: 230px; max-width: 70%; height: auto; filter: drop-shadow(0 6px 18px rgba(0,0,0,.45)); }
.login-box {
    width: 100%; border-radius: 16px; padding: 28px 26px; color: #e6eaf2;
    background: rgba(255,255,255,.05); border: 1px solid rgba(217,172,95,.3);
    box-shadow: 0 20px 50px rgba(0,0,0,.35); backdrop-filter: blur(6px);
}
.login-box h1 { font-size: 1.3rem; color: var(--gold-light); margin-bottom: 4px; }
.login-box .muted { font-size: .9rem; margin-top: 0; color: #aab4c8; }
.login-box .form label { color: #d8c79d; }
.login-box .form input { background: rgba(255,255,255,.95); border-color: transparent; }
.login-btn { width: 100%; padding: 12px; font-size: 1rem; }
.login-error { background: var(--fail-bg); color: var(--fail); padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: .9rem; font-weight: 500; }

@media (max-width: 900px) {
    .hero-inner, .grid-2 { grid-template-columns: minmax(0, 1fr); gap: 24px; }
    .features { grid-template-columns: minmax(0, 1fr); margin-top: -40px; }
    .info-grid { grid-template-columns: 1fr 1fr; }
    .hero { padding: 36px 0 60px; }
    .hero h1 { font-size: clamp(1.45rem, 6.5vw, 1.9rem); }
    .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
    .stat { padding: 10px 12px; font-size: .78rem; line-height: 1.3; }
    .stat span { font-size: 1.5rem; }
    .page-title { font-size: 1.5rem; }
    .nav-toggle-label { display: block; font-size: 24px; cursor: pointer; padding: 6px 10px; color: var(--gold-light); }
    .brand-logo { height: 40px; }
    .brand small { display: none; }
    .nav { display: none; width: 100%; flex-direction: column; padding-bottom: 12px; }
    .nav-toggle:checked ~ .nav { display: flex; }
    .row-2 { grid-template-columns: 1fr; }
    .paper { padding: 24px; }
}

@media (max-width: 480px) {
    .container { padding-left: 16px; padding-right: 16px; }
    .page { padding: 24px 16px 40px; }
    .card { padding: 16px; }
    .hero-search button { padding: 10px 14px; }
    .searchbar input { min-width: 0; flex: 1 1 100%; }
    .searchbar select { flex: 1 1 auto; min-width: 0; }
    .searchbar button { flex: none; }

    /* Bảng -> dạng thẻ trên điện thoại */
    .table-wrap:has(.table-stack) { background: transparent; border: 0; overflow: visible; }
    .table-stack thead { display: none; }
    .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
    .table-stack tr { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; display: flex; flex-wrap: wrap; gap: 6px 14px; }
    .table-stack td { padding: 0; border: 0 !important; width: auto; font-size: .88rem; }
    .table-stack tr:hover td { background: transparent; }
    .table-stack .cell-code { order: -2; width: 100%; font-size: .78rem; font-weight: 700; color: var(--bronze); letter-spacing: .5px; }
    .table-stack .cell-title { order: -1; width: 100%; font-size: 1rem; line-height: 1.4; margin-bottom: 4px; }
    .table-stack .cell-title a { font-weight: 600; }
    .table-stack td[data-label="Ban hành"]::before, .table-stack td[data-label="Hiệu lực"]::before { content: attr(data-label) ": "; color: var(--muted); }
    .info-grid { grid-template-columns: 1fr; }
    .paper { padding: 18px 14px; font-size: 15px; }
    .footer-inner { flex-direction: column; align-items: flex-start; }
}
