/* ============================================================
   Kho Giấy Dán Tường - Portal khách hàng
   Brand color palette + custom Bootstrap overrides
   ============================================================ */

:root {
    --kgt-primary:    #8B6F47;   /* Nâu earth */
    --kgt-primary-dark: #6E563A;
    --kgt-accent:     #D4A574;   /* Vàng đồng */
    --kgt-bg:         #FAF7F2;   /* Kem nhạt */
    --kgt-surface:    #FFFFFF;
    --kgt-text:       #2C2C2C;
    --kgt-text-soft:  #6B6B6B;
    --kgt-border:     #E8E2D7;
    --kgt-success:    #4A8B4A;
    --kgt-warning:    #D08B2C;
    --kgt-danger:     #B83C3C;
    --kgt-radius:     14px;
    --kgt-shadow:     0 2px 12px rgba(0, 0, 0, 0.04);
    --kgt-shadow-lg:  0 8px 32px rgba(0, 0, 0, 0.08);
}

html, body {
    font-family: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--kgt-bg);
    color: var(--kgt-text);
    font-size: 15px;
    line-height: 1.55;
}

a {
    color: var(--kgt-primary);
    text-decoration: none;
}

a:hover { color: var(--kgt-primary-dark); text-decoration: underline; }

h1, h2, h3, h4, h5, h6 { font-weight: 600; color: var(--kgt-text); }

/* Bootstrap primary override */
.btn-primary {
    background-color: var(--kgt-primary);
    border-color: var(--kgt-primary);
}
.btn-primary:hover, .btn-primary:focus {
    background-color: var(--kgt-primary-dark);
    border-color: var(--kgt-primary-dark);
}

.btn-outline-primary {
    color: var(--kgt-primary);
    border-color: var(--kgt-primary);
}
.btn-outline-primary:hover {
    background-color: var(--kgt-primary);
    border-color: var(--kgt-primary);
}

.text-primary { color: var(--kgt-primary) !important; }
.bg-primary  { background-color: var(--kgt-primary) !important; }

/* Card style */
.card {
    border: 1px solid var(--kgt-border);
    border-radius: var(--kgt-radius);
    background: var(--kgt-surface);
    box-shadow: var(--kgt-shadow);
}

/* Brand text logo */
.kgt-brand {
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--kgt-primary);
    font-size: 1.05rem;
    line-height: 1.1;
}

.kgt-brand-tagline {
    font-size: 0.72rem;
    font-weight: 400;
    color: var(--kgt-text-soft);
    text-transform: none;
    letter-spacing: 0.02em;
    margin-top: 2px;
}

/* Top navbar */
.kgt-navbar {
    background: var(--kgt-surface);
    border-bottom: 1px solid var(--kgt-border);
    padding: 0.75rem 1.25rem;
    box-shadow: var(--kgt-shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

/* Page container */
.kgt-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem;
}

/* Footer */
.kgt-footer {
    background: var(--kgt-surface);
    border-top: 1px solid var(--kgt-border);
    padding: 1.25rem 1.25rem;
    margin-top: 3rem;
    color: var(--kgt-text-soft);
    font-size: 0.85rem;
    text-align: center;
}

/* Mobile bottom navigation */
.portal-bottom-nav {
    display: none;
}

.portal-bottom-nav-item {
    position: relative;
    display: flex;
    min-width: 0;
    flex: 1 1 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.18rem;
    min-height: 58px;
    color: var(--kgt-text-soft);
    text-decoration: none;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.1;
    border-radius: 10px;
}

.portal-bottom-nav-item:hover {
    color: var(--kgt-primary-dark);
    text-decoration: none;
}

.portal-bottom-nav-item.active {
    color: var(--kgt-primary);
    background: rgba(139, 111, 71, 0.1);
}

.portal-bottom-nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    font-size: 1.2rem;
}

.portal-bottom-nav-text {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.portal-bottom-nav-badge {
    position: absolute;
    top: -5px;
    right: -11px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--kgt-danger);
    color: #fff;
    border: 2px solid var(--kgt-surface);
    font-size: 0.62rem;
    font-weight: 700;
    line-height: 13px;
    text-align: center;
}

/* Blazor error UI */
#blazor-error-ui {
    background: var(--kgt-warning);
    color: white;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .reload, #blazor-error-ui .dismiss {
    color: white;
    cursor: pointer;
    margin-left: 0.75rem;
    text-decoration: underline;
}

/* Blazor reconnect status */
.portal-reconnect-toast {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 99999;
    width: min(360px, calc(100vw - 28px));
    padding: 12px 14px;
    border: 1px solid;
    border-radius: 8px;
    background: var(--kgt-surface);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.16);
}

.portal-reconnect-title {
    font-weight: 700;
    line-height: 1.25;
}

.portal-reconnect-message {
    margin-top: 3px;
    font-size: 0.86rem;
}

.portal-reconnect-actions {
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.portal-reconnect-button {
    border: 0;
    border-radius: 6px;
    background: var(--kgt-primary);
    color: #fff;
    padding: 5px 12px;
    font-size: 0.86rem;
    font-weight: 700;
}

.portal-reconnect-countdown {
    font-size: 0.78rem;
}

.portal-reconnect-toast-warning {
    border-color: #f2c46d;
    background: #fff7e6;
    color: #6f4b13;
}

.portal-reconnect-toast-success {
    border-color: #badbcc;
    background: #d1e7dd;
    color: #0f5132;
}

.portal-reconnect-toast-danger {
    border-color: #f1aeb5;
    background: #f8d7da;
    color: #842029;
}

/* Auth pages (login, activate, reset, forgot) */
.kgt-empty-layout {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--kgt-bg) 0%, #F0E9DC 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.kgt-auth-wrap {
    width: 100%;
    max-width: 420px;
}

.kgt-auth-card {
    background: var(--kgt-surface);
    border: 1px solid var(--kgt-border);
    border-radius: var(--kgt-radius);
    box-shadow: var(--kgt-shadow-lg);
    padding: 2rem 1.75rem;
}

.kgt-auth-card .form-control:focus {
    border-color: var(--kgt-primary);
    box-shadow: 0 0 0 0.2rem rgba(139, 111, 71, 0.15);
}

/* User dropdown in navbar */
.kgt-user-chip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--kgt-bg);
    border: 1px solid var(--kgt-border);
    border-radius: 999px;
    padding: 0.25rem 0.75rem 0.25rem 0.4rem;
    font-size: 0.85rem;
    color: var(--kgt-text);
    text-decoration: none;
}

.kgt-user-chip:hover { background: #F0E9DC; color: var(--kgt-text); }

.kgt-user-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--kgt-primary);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
}

/* Mobile-first tweaks */
@media (max-width: 576px) {
    .kgt-container { padding: 1rem 0.75rem; }
    .kgt-brand { font-size: 0.95rem; }
    .kgt-auth-card { padding: 1.5rem 1.25rem; }
}

@media (max-width: 767.98px) {
    .kgt-main {
        padding-bottom: calc(76px + env(safe-area-inset-bottom));
    }

    .kgt-footer {
        margin-bottom: calc(70px + env(safe-area-inset-bottom));
    }

    .portal-bottom-nav {
        position: fixed;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 1030;
        display: flex;
        align-items: stretch;
        gap: 0.25rem;
        padding: 0.42rem 0.65rem calc(0.42rem + env(safe-area-inset-bottom));
        background: rgba(255, 255, 255, 0.96);
        border-top: 1px solid var(--kgt-border);
        box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.08);
        backdrop-filter: blur(12px);
    }
}

/* ═══════════════════════════════════════════════════
   Ô lọc tích NHIỀU giá trị — component Shared/LocNhieuGiaTri.razor
   Để ở đây chứ không nhét <style> vào component: một trang dựng 6 ô lọc,
   nhét vào component là lặp 6 khối CSS giống hệt nhau trong DOM.
   ═══════════════════════════════════════════════════ */
:root {
    --lnv-accent:    #c1121f;
    --lnv-accent-mo: rgba(193, 18, 31, .15);
    --lnv-the-nen:   #fdeaec;
    --lnv-the-chu:   #8f0d17;
}

.lnv-wrap { position: relative; }
/* Nâng ô đang mở lên trên các ô lọc đứng sau nó, nếu không panel bị ô kế tiếp đè. */
.lnv-wrap-mo { z-index: 1055; }

.lnv-dem {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 18px; height: 18px; padding: 0 5px; margin-left: 4px;
    border-radius: 999px; background: var(--lnv-accent); color: #fff;
    font-size: 11px; font-weight: 700; line-height: 1;
}

.lnv-hop {
    display: flex; align-items: center; gap: 6px; min-height: 38px;
    padding: 4px 8px; background: #fff;
    border: 1px solid var(--kgt-border); border-radius: 8px; cursor: pointer;
}
.lnv-hop:hover { border-color: var(--lnv-accent); }
.lnv-hop-mo { border-color: var(--lnv-accent); box-shadow: 0 0 0 .2rem var(--lnv-accent-mo); }
.lnv-hop-tat { background: #e9ecef; cursor: not-allowed; opacity: .65; }

.lnv-the-vung { display: flex; flex-wrap: wrap; gap: 4px; flex: 1 1 auto; min-width: 0; }
.lnv-goiy { color: #8a8a8a; font-size: .875rem; }

.lnv-the {
    display: inline-flex; align-items: center; gap: 4px; max-width: 100%;
    padding: 1px 4px 1px 8px; border-radius: 999px;
    background: var(--lnv-the-nen); color: var(--lnv-the-chu);
    font-size: 12px; line-height: 1.55; white-space: nowrap;
}
.lnv-the-bo {
    display: inline-flex; align-items: center; justify-content: center;
    width: 16px; height: 16px; border-radius: 50%;
    font-size: 14px; line-height: 1; cursor: pointer; opacity: .65;
}
.lnv-the-bo:hover { opacity: 1; background: rgba(0, 0, 0, .12); }
.lnv-mui { flex: 0 0 auto; font-size: 12px; color: #6c757d; }

/* Lớp phủ trong suốt: bấm ra ngoài thì đóng panel, không cần JS nghe click toàn trang. */
.lnv-nen { position: fixed; inset: 0; z-index: 1050; background: transparent; }

.lnv-panel {
    position: absolute; z-index: 1056; top: calc(100% + 4px); left: 0;
    min-width: 100%; max-width: min(340px, 92vw);
    background: #fff; border: 1px solid #d9d9d9; border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .16); overflow: hidden;
}

.lnv-timnhanh {
    display: flex; align-items: center; gap: 6px;
    padding: 8px; border-bottom: 1px solid #f0f0f0; color: #8a8a8a;
}

.lnv-ds { max-height: 260px; overflow-y: auto; padding: 4px; }
.lnv-dong {
    display: flex; align-items: center; gap: 8px; width: 100%;
    padding: 6px 8px; margin: 0; border-radius: 6px;
    cursor: pointer; font-size: .875rem;
}
.lnv-dong:hover { background: #f5f5f5; }
.lnv-dong-on { background: var(--lnv-the-nen); font-weight: 600; }
.lnv-rong { padding: 14px 10px; text-align: center; color: #8a8a8a; font-size: .85rem; }

.lnv-chan {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 8px; border-top: 1px solid #f0f0f0; background: #fafafa;
}

@media (max-width: 575.98px) {
    .lnv-panel { max-width: none; right: 0; }
    .lnv-ds { max-height: 220px; }
}
