/* =====================================================================
   COMPONENTS - dung chung cho moi trang (dang nhap, dashboard, trang phu)
   ===================================================================== */

/* ---------- Icon SVG ---------- */
.ic {
    width: 20px; height: 20px; flex-shrink: 0;
    fill: none; stroke: currentColor; stroke-width: 1.9;
    stroke-linecap: round; stroke-linejoin: round;
}
.ic-sm { width: 16px; height: 16px; }
.ic-lg { width: 24px; height: 24px; }

/* ---------- Nut ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: none; border-radius: 999px; padding: 11px 20px;
    font-weight: 600; font-size: 14px; line-height: 1.2; white-space: nowrap;
    transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.sm { padding: 8px 14px; font-size: 13px; }
.btn-gradient { background: var(--gradient-primary); color: #fff; box-shadow: 0 8px 20px rgba(37, 99, 235, .28); }
.btn-gradient:hover { box-shadow: 0 12px 26px rgba(37, 99, 235, .36); }
.btn-white { background: #fff; color: var(--color-primary); box-shadow: 0 6px 16px rgba(20, 44, 85, .14); }
.btn-soft { background: var(--color-primary-light); color: var(--color-primary); }
.btn-soft:hover { background: #DCE8FF; }
.btn-ghost { background: transparent; color: var(--color-text-muted); }
.btn-ghost:hover { background: var(--color-bg); color: var(--color-text); }
.btn-danger { background: var(--color-danger); color: #fff; box-shadow: 0 8px 20px rgba(239, 68, 68, .25); }

.icon-btn {
    position: relative; width: 44px; height: 44px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: #fff; color: var(--color-navy); border: 1px solid var(--color-border);
    transition: background-color .15s, box-shadow .15s, transform .15s;
}
.icon-btn:hover { box-shadow: 0 6px 16px rgba(20, 44, 85, .1); transform: translateY(-1px); }
.icon-btn.ghost { background: transparent; border-color: transparent; }
.icon-btn.ghost:hover { background: rgba(20, 44, 85, .06); box-shadow: none; }
.icon-btn.sm { width: 32px; height: 32px; }
.icon-btn.sm .ic { width: 16px; height: 16px; }
.badge {
    position: absolute; top: -3px; right: -3px; min-width: 19px; height: 19px; padding: 0 5px;
    border-radius: 999px; background: var(--color-danger); color: #fff;
    font-size: 11px; font-weight: 700; line-height: 15px; text-align: center;
    border: 2px solid #fff;
}

/* ---------- Gradient nen icon theo chuc nang ---------- */
.g-blue   { background: linear-gradient(135deg, #60A5FA, #2563EB); box-shadow: 0 8px 18px rgba(37, 99, 235, .28); }
.g-purple { background: linear-gradient(135deg, #A78BFA, #7655F7); box-shadow: 0 8px 18px rgba(118, 85, 247, .28); }
.g-orange { background: linear-gradient(135deg, #FDBA74, #F97316); box-shadow: 0 8px 18px rgba(249, 115, 22, .28); }
.g-green  { background: linear-gradient(135deg, #4ADE80, #16A34A); box-shadow: 0 8px 18px rgba(22, 163, 74, .26); }
.g-cyan   { background: linear-gradient(135deg, #67E8F9, #0EA5E9); box-shadow: 0 8px 18px rgba(14, 165, 233, .28); }
.g-pink   { background: linear-gradient(135deg, #F9A8D4, #EC4899); box-shadow: 0 8px 18px rgba(236, 72, 153, .26); }

/* ---------- Mau theo loai nhac nho ---------- */
.t-birthday    { --tc: #DB2777; --tb: #FDE7F3; }
.t-anniversary { --tc: #E11D48; --tb: #FFE4EA; }
.t-memorial    { --tc: #B45309; --tb: #FEF3C7; }
.t-maintenance { --tc: #2563EB; --tb: #E3EDFF; }
.t-document    { --tc: #D97706; --tb: #FFF1D6; }
.t-payment     { --tc: #16A34A; --tb: #DCFCE7; }
.t-personal    { --tc: #7655F7; --tb: #EDE9FE; }
.t-health      { --tc: #DC2626; --tb: #FEE2E2; }
.t-other       { --tc: #0284C7; --tb: #E0F2FE; }

.tag {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap;
    background: var(--tb, var(--color-primary-light)); color: var(--tc, var(--color-primary));
}

/* ---------- Avatar ---------- */
.avatar {
    width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 15px; letter-spacing: .2px;
    background: var(--gradient-primary);
}
.av-0 { background: linear-gradient(135deg, #60A5FA, #2563EB); }
.av-1 { background: linear-gradient(135deg, #F9A8D4, #DB2777); }
.av-2 { background: linear-gradient(135deg, #FCD34D, #F59E0B); }
.av-3 { background: linear-gradient(135deg, #86EFAC, #16A34A); }
.av-4 { background: linear-gradient(135deg, #C4B5FD, #7655F7); }
.av-5 { background: linear-gradient(135deg, #67E8F9, #0891B2); }

/* ---------- Pill trang thai ---------- */
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.pill.ok, .s-valid { background: #DCFCE7; color: #15803D; }
.pill.bad, .s-expired { background: #FEE2E2; color: #B91C1C; }
.s-expiring { background: #FFEDD5; color: #C2410C; }
.s-none { background: #EEF1F7; color: #64748B; }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 14px 8px 6px; }
.empty-state img { width: 130px; margin: 0 auto 10px; }
.empty-state p { color: var(--color-text-muted); font-size: 13.5px; margin-bottom: 12px; }

/* ---------- Dropdown ---------- */
.dropdown { position: relative; }
.dropdown-menu {
    position: absolute; right: 0; top: calc(100% + 10px); min-width: 270px; z-index: 80;
    background: #fff; border-radius: 18px; padding: 8px;
    border: 1px solid var(--color-border);
    box-shadow: 0 20px 50px rgba(20, 44, 85, .18);
    opacity: 0; visibility: hidden; transform: translateY(-6px);
    transition: opacity .16s ease, transform .16s ease, visibility .16s;
}
.dropdown.open .dropdown-menu { opacity: 1; visibility: visible; transform: none; }
.dropdown-head { display: flex; gap: 12px; align-items: center; padding: 10px 10px 12px; }
.dropdown-head strong { display: block; font-size: 14.5px; }
.dropdown-head span { font-size: 12.5px; color: var(--color-text-muted); word-break: break-all; }
.dropdown-label { padding: 8px 12px 4px; font-size: 11.5px; font-weight: 700; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: .5px; }
.dropdown-item {
    width: 100%; display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 12px; border: none; background: none;
    font-size: 14px; font-weight: 500; color: var(--color-text); text-align: left;
    transition: background-color .12s;
}
.dropdown-item:hover { background: var(--color-bg); }
.dropdown-item .ic { color: var(--color-text-muted); }
.dropdown-item.active { color: var(--color-primary); font-weight: 600; }
.dropdown-item.active .ic { color: var(--color-primary); }
.dropdown-item .check { margin-left: auto; color: var(--color-primary); }
.dropdown-item.danger { color: #DC2626; }
.dropdown-item.danger .ic { color: #DC2626; }
.dropdown-sep { height: 1px; background: var(--color-border); margin: 6px 4px; }
.dropdown-menu form { margin: 0; }

/* ---------- Toast ---------- */
.lb-toasts {
    position: fixed; top: 20px; right: 20px; z-index: 1000;
    display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.lb-toast {
    pointer-events: auto; display: flex; align-items: flex-start; gap: 10px;
    min-width: 260px; max-width: 380px; padding: 12px 12px 12px 14px;
    background: #fff; border-radius: 14px; border: 1px solid var(--color-border);
    box-shadow: 0 16px 40px rgba(20, 44, 85, .16);
    font-size: 13.5px; color: var(--color-text);
    opacity: 0; transform: translateY(-8px);
    transition: opacity .2s ease, transform .2s ease;
}
.lb-toast.show { opacity: 1; transform: none; }
.lb-toast .ic { margin-top: 1px; }
.lb-toast span { flex: 1; }
.lb-toast button { border: none; background: none; color: var(--color-text-muted); padding: 0; line-height: 0; }
.lb-toast-success .ic:first-child { color: var(--color-success); }
.lb-toast-error .ic:first-child { color: var(--color-danger); }
.lb-toast-warning .ic:first-child { color: var(--color-warning); }
.lb-toast-info .ic:first-child { color: var(--color-primary); }

/* ---------- Modal xac nhan ---------- */
.lb-modal-backdrop {
    position: fixed; inset: 0; z-index: 900;
    background: rgba(15, 23, 42, .45); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
    display: flex; align-items: center; justify-content: center; padding: 20px;
    opacity: 0; transition: opacity .18s ease;
}
.lb-modal-backdrop.show { opacity: 1; }
.lb-modal {
    width: 100%; max-width: 400px; background: #fff; border-radius: 22px; padding: 26px 24px 20px;
    box-shadow: 0 30px 70px rgba(15, 23, 42, .3); text-align: center;
    transform: translateY(10px) scale(.98); transition: transform .2s ease;
}
.lb-modal-backdrop.show .lb-modal { transform: none; }
.lb-modal-icon {
    width: 56px; height: 56px; border-radius: 18px; margin: 0 auto 14px;
    display: flex; align-items: center; justify-content: center; color: #fff;
}
.lb-modal h3 { font-size: 18px; color: var(--color-navy); margin-bottom: 6px; }
.lb-modal p { font-size: 14px; color: var(--color-text-muted); margin-bottom: 20px; }
.lb-modal-actions { display: flex; gap: 10px; }
.lb-modal-actions .btn { flex: 1; }

/* ---------- Trang kiem tra database (/system/db-check) ---------- */
.plain-page { background: var(--color-bg); }
.check-wrap { max-width: 860px; margin: 0 auto; padding: 32px 20px 60px; }
.check-head { display: flex; gap: 14px; align-items: center; margin-bottom: 22px; }
.check-head h1 { font-size: 24px; color: var(--color-navy); }
.check-head p { color: var(--color-text-muted); font-size: 13.5px; }
.check-card { background: #fff; border-radius: 20px; padding: 22px; box-shadow: var(--shadow-card); margin-bottom: 18px; border-left: 5px solid var(--color-success); }
.check-card.is-error { border-left-color: var(--color-danger); }
.check-card h2 { display: flex; align-items: center; gap: 10px; font-size: 17px; margin-bottom: 14px; color: var(--color-navy); }
.check-card h2 .ic { color: var(--color-success); }
.check-card.is-error h2 .ic { color: var(--color-danger); }
.check-info { display: grid; grid-template-columns: 160px 1fr; gap: 8px 14px; margin: 0; font-size: 14px; }
.check-info dt { color: var(--color-text-muted); }
.check-info dd { margin: 0; word-break: break-all; }
.check-warn { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: #FFF7ED; color: #9A3412; font-size: 13.5px; }
.check-pre { white-space: pre-wrap; background: #FEF2F2; color: #991B1B; padding: 14px; border-radius: 12px; font-size: 13px; }
.check-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.check-table th { text-align: left; color: var(--color-text-muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--color-border); }
.check-table td { padding: 8px 10px; border-bottom: 1px solid #F0F3F9; }
.check-steps { margin-top: 18px; background: var(--color-bg); border-radius: 14px; padding: 16px 18px; }
.check-steps h3 { font-size: 15px; margin-bottom: 8px; }
.check-steps ol { list-style: decimal; padding-left: 20px; font-size: 14px; display: grid; gap: 6px; }
.check-foot { text-align: center; }
kbd { background: #fff; border: 1px solid var(--color-border); border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; }

@media (max-width: 600px) {
    .check-info { grid-template-columns: 1fr; gap: 2px; }
    .check-info dd { margin-bottom: 8px; }
    .check-table th:nth-child(3), .check-table td:nth-child(3) { display: none; }
    .lb-toasts { left: 12px; right: 12px; top: 12px; }
    .lb-toast { max-width: none; min-width: 0; }
}
