/* =====================================================================
   AN PHÁT 43 — Brand Guidelines
   shell.css — Layout sidebar + base typography
   ===================================================================== */

:root {
    --bg-primary:   #FD5D14;
    --bg-secondary: #FDBE33;
    --bg-dark:      #040F28;
    --bg-light:     #F4F6F8;
    --bg-text:      #1a1a1a;
    --bg-muted:     #6c757d;
    --bg-border:    #e5e7eb;

    --bg-sidebar-w: 280px;
    --bg-sidebar-bg: #0a1326;
    --bg-sidebar-fg: rgba(255,255,255,.78);
    --bg-sidebar-fg-muted: rgba(255,255,255,.45);
    --bg-sidebar-border: rgba(255,255,255,.08);

    --bg-content-max: 1400px;
}

/* ===== RESET & BASE ===== */
* { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: 24px;
}

body {
    margin: 0;
    font-family: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--bg-text);
    background: #fff;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--bg-primary); }

img { max-width: 100%; height: auto; }

/* ===== APP LAYOUT ===== */
.bg-app {
    display: grid;
    grid-template-columns: var(--bg-sidebar-w) 1fr;
    min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.bg-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--bg-sidebar-w);
    background: var(--bg-sidebar-bg);
    color: var(--bg-sidebar-fg);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 100;
    border-right: 1px solid var(--bg-sidebar-border);
}

.bg-sidebar::-webkit-scrollbar { width: 6px; }
.bg-sidebar::-webkit-scrollbar-track { background: transparent; }
.bg-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 3px; }
.bg-sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.2); }

/* Sidebar header */
.bg-sidebar-head {
    padding: 1.75rem 1.5rem 1.25rem;
    border-bottom: 1px solid var(--bg-sidebar-border);
}
.bg-sidebar-brand {
    display: block;
    text-decoration: none;
    color: #fff;
    margin-bottom: .5rem;
}
.bg-sidebar-brand:hover { color: var(--bg-secondary); }
.bs-brand-name {
    display: block;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: .04em;
    color: #fff;
    line-height: 1.2;
}
.bs-brand-sub {
    display: block;
    font-size: .68rem;
    letter-spacing: .25em;
    text-transform: uppercase;
    color: var(--bg-secondary);
    margin-top: .25rem;
    font-weight: 600;
}
.bg-sidebar-version {
    display: block;
    font-size: .68rem;
    color: var(--bg-sidebar-fg-muted);
    font-family: ui-monospace, 'SF Mono', Menlo, monospace;
    letter-spacing: .02em;
}

/* Sidebar nav */
.bg-sidebar-nav {
    flex: 1;
    padding: 1rem 0;
}

.bg-side-group {
    padding: .5rem 0 1rem;
    border-bottom: 1px solid var(--bg-sidebar-border);
}
.bg-side-group:last-child { border-bottom: none; }

.bg-side-group-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 1.5rem .5rem;
    gap: .5rem;
}
.bg-side-group-label {
    font-size: .65rem;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--bg-sidebar-fg-muted);
    font-weight: 700;
}
.bg-side-print {
    width: 26px;
    height: 26px;
    background: transparent;
    border: 1px solid var(--bg-sidebar-border);
    color: var(--bg-sidebar-fg-muted);
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .18s;
    padding: 0;
    flex-shrink: 0;
}
.bg-side-print:hover {
    background: var(--bg-primary);
    color: #fff;
    border-color: var(--bg-primary);
}

.bg-side-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.bg-side-list li a {
    display: flex;
    align-items: baseline;
    gap: .65rem;
    padding: .55rem 1.5rem;
    color: var(--bg-sidebar-fg);
    text-decoration: none;
    font-size: .88rem;
    line-height: 1.4;
    border-left: 2px solid transparent;
    transition: all .15s;
}
.bg-side-list li a:hover {
    background: rgba(253, 93, 20, .1);
    color: #fff;
    border-left-color: var(--bg-secondary);
}
.bg-side-list li a.active {
    background: rgba(253, 93, 20, .14);
    color: #fff;
    border-left-color: var(--bg-primary);
}
.bs-num {
    font-family: ui-monospace, 'SF Mono', Menlo, monospace;
    font-size: .72rem;
    color: var(--bg-secondary);
    font-weight: 700;
    letter-spacing: .02em;
    flex-shrink: 0;
    min-width: 2rem;
}
.bg-side-list li a.active .bs-num {
    color: var(--bg-primary);
}
.bg-side-sublist a {
    padding-left: 2.75rem;
    font-size: .82rem;
    color: var(--bg-sidebar-fg-muted);
}

/* Sidebar footer */
.bg-sidebar-foot {
    padding: 1rem 1.5rem 1.25rem;
    border-top: 1px solid var(--bg-sidebar-border);
}
.bs-foot-label {
    font-size: .65rem;
    color: var(--bg-sidebar-fg-muted);
    letter-spacing: .15em;
    text-transform: uppercase;
    font-weight: 600;
}

/* ===== MAIN ===== */
.bg-main {
    grid-column: 2;
    min-width: 0;
    background: #fff;
}

/* Stage wrapper — dùng cho print từng giai đoạn */
.bg-stage { display: block; }

.bg-stage-divider {
    background: var(--bg-dark);
    color: #fff;
    padding: 4rem 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.bg-stage-divider::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(253,93,20,.18) 0%, transparent 70%);
    pointer-events: none;
}
.bg-stage-divider .stage-num {
    display: inline-block;
    font-family: ui-monospace, 'SF Mono', Menlo, monospace;
    font-size: .75rem;
    letter-spacing: .3em;
    color: var(--bg-secondary);
    border: 1px solid rgba(253, 190, 51, .4);
    padding: .4rem 1rem;
    border-radius: 999px;
    margin-bottom: 1.25rem;
    position: relative;
    z-index: 1;
}
.bg-stage-divider h2 {
    font-size: clamp(2rem, 4.5vw, 3.25rem);
    font-weight: 700;
    color: #fff;
    margin: 0 0 .75rem;
    position: relative;
    z-index: 1;
    line-height: 1.15;
}
.bg-stage-divider .stage-lead {
    color: rgba(255, 255, 255, .7);
    max-width: 680px;
    margin: 0 auto;
    font-size: 1.05rem;
    line-height: 1.65;
    position: relative;
    z-index: 1;
}

/* Container chuẩn cho main content */
.bg-container {
    background: #fff;
    max-width: var(--bg-content-max);
    margin: 0 auto;
}

/* Endnote */
.bg-endnote {
    padding: 4rem 2rem;
    background: var(--bg-dark);
    color: rgba(255,255,255,.7);
    text-align: center;
}
.bg-endnote h3 {
    color: #fff;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}
.bg-endnote code {
    background: rgba(255,255,255,.1);
    padding: .2rem .5rem;
    color: var(--bg-secondary);
    border-radius: 3px;
    font-size: .85rem;
}

/* =====================================================================
   v2.2 — Sidebar: panel "Đã chốt phương án"
   ===================================================================== */
.bg-side-chosen {
    padding: 1rem 1.25rem 1.25rem;
    border-top: 1px solid var(--bg-sidebar-border);
    background: linear-gradient(180deg, rgba(253,93,20,.04) 0%, transparent 70%);
}
.bg-side-chosen-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: .85rem;
    cursor: pointer;
    user-select: none;
    padding: .2rem 0;
}
.bg-side-chosen-title {
    font-size: .62rem;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: #fff;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: .45rem;
}
.bg-side-chosen-title svg { color: var(--bg-primary); flex-shrink: 0; }
.bg-side-chosen-caret {
    color: var(--bg-sidebar-fg-muted);
    transition: transform .2s ease;
}
.bg-side-chosen.is-expanded .bg-side-chosen-caret { transform: rotate(90deg); }
.bg-side-chosen-counter {
    font-size: .65rem;
    font-family: ui-monospace, 'SF Mono', Menlo, monospace;
    color: var(--bg-sidebar-fg-muted);
    padding: .15rem .5rem;
    border: 1px solid var(--bg-sidebar-border);
    border-radius: 999px;
    font-weight: 600;
}
.bg-side-chosen-counter.is-complete {
    background: rgba(76,175,80,.15);
    color: #81C784;
    border-color: rgba(129,199,132,.3);
    animation: chosenPulse 1.2s ease-out 1;
}
@keyframes chosenPulse {
    0%   { box-shadow: 0 0 0 0 rgba(129,199,132,.6); }
    70%  { box-shadow: 0 0 0 8px rgba(129,199,132,0); }
    100% { box-shadow: 0 0 0 0 rgba(129,199,132,0); }
}

.bg-side-chosen-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .35rem;
}
.bg-side-chosen-item {
    display: block;
    padding: .5rem .65rem;
    border-radius: 5px;
    background: rgba(255,255,255,.03);
    border: 1px solid var(--bg-sidebar-border);
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: all .15s ease;
}
.bg-side-chosen-item:hover {
    background: rgba(253,93,20,.08);
    border-color: rgba(253,93,20,.3);
    transform: translateX(2px);
}
.bg-side-chosen-item.is-empty { opacity: .55; }
.bg-side-chosen-item.is-empty:hover { opacity: .85; }

.bg-side-chosen-row {
    display: flex;
    gap: .55rem;
    align-items: center;
}
.bg-side-chosen-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--bg-secondary);
}
.bg-side-chosen-meta {
    flex: 1;
    min-width: 0;
}
.bg-side-chosen-label {
    display: block;
    font-size: .6rem;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--bg-sidebar-fg-muted);
    font-weight: 600;
}
.bg-side-chosen-value {
    display: block;
    font-size: .8rem;
    color: #fff;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: .1rem;
}
.bg-side-chosen-item.is-empty .bg-side-chosen-value {
    color: var(--bg-sidebar-fg-muted);
    font-style: italic;
    font-weight: 400;
}

/* Nút "In phương án đã chốt" */
.bg-side-chosen-print {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    width: 100%;
    margin-top: .85rem;
    padding: .65rem .85rem;
    background: rgba(253,93,20,.08);
    color: #fff;
    border: 1px solid rgba(253,93,20,.4);
    border-radius: 5px;
    font-family: inherit;
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .02em;
    cursor: pointer;
    transition: all .15s ease;
}
.bg-side-chosen-print:hover {
    background: var(--bg-primary);
    border-color: var(--bg-primary);
    box-shadow: 0 4px 14px rgba(253,93,20,.25);
    transform: translateY(-1px);
}
.bg-side-chosen-print:active { transform: translateY(0); }
.bg-side-chosen-print svg { flex-shrink: 0; color: var(--bg-secondary); }
.bg-side-chosen-print:hover svg { color: #fff; }

/* B3 — expand state: show rich preview under each item */
.bg-side-chosen-preview {
    margin-left: 2.4rem;
    margin-top: .4rem;
    display: none;
}
.bg-side-chosen.is-expanded .bg-side-chosen-preview { display: block; }
.bg-side-chosen-preview .sc-swatches {
    display: flex;
    gap: .2rem;
}
.bg-side-chosen-preview .sc-swatches span {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    border: 1px solid rgba(255,255,255,.15);
    flex-shrink: 0;
}
.bg-side-chosen-preview .sc-font-sample {
    font-size: 1rem;
    line-height: 1.1;
    color: rgba(255,255,255,.7);
    font-weight: 600;
    letter-spacing: .02em;
}
.bg-side-chosen-preview .sc-logo-text {
    font-size: .9rem;
    color: var(--bg-secondary);
    font-weight: 700;
    letter-spacing: .04em;
}
.bg-side-chosen-preview .sc-mini-site {
    width: 100%;
    height: 32px;
    background: #122247;
    border-radius: 3px;
    border: 1px solid rgba(255,255,255,.08);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 4px 6px;
}
.bg-side-chosen-preview .sc-mini-site-bar {
    height: 3px;
    border-radius: 1px;
}
.bg-side-chosen-preview .sc-mini-site-row {
    display: flex;
    gap: 3px;
}
.bg-side-chosen-preview .sc-mini-site-row > div {
    height: 6px;
}

/* Highlight target khi click vào item từ sidebar */
.bg-chosen-highlight {
    animation: chosenHighlight 1.6s ease-out 1;
}
@keyframes chosenHighlight {
    0%   { box-shadow: 0 0 0 3px rgba(253,93,20,.6), 0 6px 22px rgba(253,93,20,.25); }
    100% { box-shadow: 0 0 0 0 transparent; }
}

/* Browser quá hẹp (dưới 1200px) — không cần optimize, chỉ chống vỡ */
@media (max-width: 1199px) {
    .bg-app { grid-template-columns: 240px 1fr; }
    :root { --bg-sidebar-w: 240px; }
}
