/* ═══════════════════════════════════════════════════
   QUẢN LÝ BÁN HÀNG — Enterprise UI Custom Styles
   ═══════════════════════════════════════════════════ */

/* ── Fonts & Base ── */
html, body {
    font-family: 'Roboto', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: #F1F5F9;
    font-size: 14px;
}

/* ── Sidebar (Drawer) overrides ── */
.mud-drawer {
    border-right: none !important;
}

.mud-drawer-content {
    background: #1E293B !important;
}

.mud-nav-link {
    border-radius: 8px !important;
    margin: 2px 8px !important;
    padding: 8px 12px 8px 20px !important;
    color: #CBD5E1 !important;
    transition: all 0.15s ease !important;
    position: relative;
}

.mud-nav-link:hover {
    background: rgba(255,255,255,0.08) !important;
    color: #F1F5F9 !important;
}

.mud-nav-link.active {
    background: rgba(59,130,246,0.18) !important;
    color: #BFDBFE !important;
    font-weight: 600 !important;
    box-shadow: inset 3px 0 0 #3B82F6 !important;
}

/* ── Nav group: child items indent ── */
.mud-nav-group .mud-nav-link {
    padding-left: 44px !important;
}

.mud-nav-group > .mud-nav-link {
    /* group header: keep base padding */
    padding-left: 20px !important;
}

.mud-nav-group .mud-nav-link-icon {
    color: #94A3B8 !important;
}

.mud-nav-group .mud-nav-link-icon-default {
    font-size: 1.15rem !important;
}

.mud-nav-link .mud-nav-link-icon {
    color: inherit !important;
}

.mud-drawer-header {
    background: #1E293B !important;
    border-bottom: 1px solid rgba(255,255,255,0.06) !important;
}

/* ── AppBar ── */
.mud-appbar {
    background: #1E293B !important;
    border-bottom: 1px solid rgba(255,255,255,0.06) !important;
}

/* ── Main content background ── */
.mud-main-content {
    background: #F1F5F9 !important;
}

/* ── Page Header (reusable) ── */
.page-header {
    margin-bottom: 24px;
}

.page-header .page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1E293B;
    line-height: 1.2;
    margin: 0;
}

.page-header .page-subtitle {
    color: #64748B;
    font-size: 0.875rem;
    margin-top: 4px;
}

/* ── Stat Cards ── */
.stat-card {
    border-radius: 12px !important;
    border: none !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12) !important;
}

.stat-card-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Aging stack bar ── */
.aging-stack {
    display: flex;
    width: 100%;
    height: 38px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05);
}

.aging-seg {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    transition: filter 0.15s ease;
    cursor: default;
}

.aging-seg:hover {
    filter: brightness(1.08);
}

.aging-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.legend-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    display: inline-block;
}

.legend-label {
    color: #475569;
}

.legend-amount {
    color: #1E293B;
    font-weight: 600;
}

.aging-cell {
    font-size: 0.875rem;
}

.aging-cell-empty {
    color: #CBD5E1;
    font-size: 0.875rem;
}

/* ── MudTable enterprise style ── */
.mud-table-root {
    border-radius: 12px !important;
    overflow: hidden;
}

.mud-table-head .mud-table-cell {
    font-weight: 600 !important;
    font-size: 0.75rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    color: #64748B !important;
    background: #F8FAFC !important;
    border-bottom: 2px solid #E2E8F0 !important;
    padding: 10px 16px !important;
}

.mud-table-body .mud-table-row:hover .mud-table-cell {
    background: #EFF6FF !important;
}

.mud-table-body .mud-table-cell {
    padding: 10px 16px !important;
    border-bottom: 1px solid #F1F5F9 !important;
    color: #334155;
}

/* ── Filter toolbar ── */
.filter-toolbar {
    background: #FFFFFF;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

/* Căn thẳng hàng các control trong filter toolbar */
.filter-toolbar .mud-input-control,
.filter-toolbar .mud-select,
.filter-toolbar .mud-form-control {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

.filter-toolbar .mud-button-root {
    height: 40px;
}

/* ── Form sections ── */
.form-section-title {
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748B;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid #E2E8F0;
}

/* ── Status Chips (dot-style) ── */
.status-chip-active,
.status-chip-inactive {
    background: transparent !important;
    border: 1px solid transparent !important;
    font-weight: 500 !important;
    padding-left: 10px !important;
}

.status-chip-active {
    background: rgba(16, 185, 129, 0.08) !important;
    color: #047857 !important;
}

.status-chip-active::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10B981;
    margin-right: 6px;
    flex-shrink: 0;
}

.status-chip-inactive {
    background: rgba(239, 68, 68, 0.08) !important;
    color: #B91C1C !important;
}

.status-chip-inactive::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #EF4444;
    margin-right: 6px;
    flex-shrink: 0;
}

/* ── Login page ── */
.login-container {
    min-height: 100vh;
    background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    width: 100%;
    max-width: 420px;
    border-radius: 16px !important;
}

.login-logo {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #3B82F6, #1D4ED8);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

/* ── Breadcrumbs ── */
.mud-breadcrumb-item {
    font-size: 0.8125rem !important;
}

/* ── Action buttons in table rows ── */
.row-actions {
    display: flex;
    gap: 4px;
    opacity: 0.7;
    transition: opacity 0.15s;
}

.mud-table-row:hover .row-actions {
    opacity: 1;
}

/* ── Revenue Chart (custom, with axes + gridlines) ── */
.rchart {
    display: flex;
    height: 180px;
    align-items: stretch;
}

.rchart-yaxis {
    width: 44px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 0 6px 0 0;
    font-size: 0.7rem;
    color: #94A3B8;
    text-align: right;
    line-height: 1;
}

.rchart-ytick {
    transform: translateY(-50%);
    height: 0;
}

.rchart-ytick:first-child { transform: translateY(0); }
.rchart-ytick:last-child  { transform: translateY(-100%); }

.rchart-body {
    flex: 1;
    position: relative;
    border-left: 1px solid #CBD5E1;
    border-bottom: 1px solid #CBD5E1;
}

.rchart-gridline {
    position: absolute;
    left: 0;
    right: 0;
    border-top: 1px dashed #F1F5F9;
    pointer-events: none;
}

.rchart-bars {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    padding: 0 4px;
}

.rchart-bar-item {
    flex: 1 1 0;
    height: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    min-width: 0;
}

.rchart-bar-track {
    width: 60%;
    max-width: 36px;
    height: 100%;
    display: flex;
    align-items: flex-end;
    position: relative;
}

.rchart-bar-fill {
    width: 100%;
    min-height: 2px;
    background: linear-gradient(180deg, #60A5FA 0%, #3B82F6 100%);
    border-radius: 4px 4px 0 0;
    transition: all 0.15s ease;
    cursor: pointer;
    position: relative;
}

.rchart-bar-fill:hover {
    background: linear-gradient(180deg, #2563EB 0%, #1D4ED8 100%);
    box-shadow: 0 2px 10px rgba(29, 78, 216, 0.35);
}

.rchart-bar-fill::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #1E293B;
    color: white;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.rchart-bar-fill::after {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #1E293B;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
    z-index: 10;
}

.rchart-bar-fill:hover::before,
.rchart-bar-fill:hover::after {
    opacity: 1;
}

.rchart-xaxis {
    display: flex;
    justify-content: space-around;
    padding: 6px 4px 0 44px;
    font-size: 0.7rem;
    color: #64748B;
}

.rchart-xlabel {
    flex: 1 1 0;
    text-align: center;
    min-width: 0;
}


/* ── MudTabs — disable hover effect ── */
.mud-tabs .mud-tab:hover {
    background-color: transparent !important;
}

/* ── Inline Search (topbar) ── */
.inline-search {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    min-width: 420px;
    max-width: 520px;
    height: 38px;
    transition: all 0.15s;
}

.inline-search:focus-within {
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.3);
}

.inline-search-icon {
    color: #94A3B8;
    flex-shrink: 0;
}

.inline-search-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    color: #F1F5F9;
    font-size: 0.875rem;
    padding: 0;
    min-width: 0;
}

.inline-search-input::placeholder {
    color: #94A3B8;
}

.inline-search-clear {
    background: transparent;
    border: none;
    color: #94A3B8;
    cursor: pointer;
    padding: 2px;
    display: flex;
    align-items: center;
    border-radius: 4px;
    transition: background 0.1s;
}

.inline-search-clear:hover {
    color: #F1F5F9;
    background: rgba(255, 255, 255, 0.1);
}

.inline-search-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 440px;
    overflow-y: auto;
    background: white;
    color: #1E293B;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.18);
    z-index: 1300;
    padding: 6px 0;
}

.is-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
    color: #64748B;
}

.is-group {
    padding: 6px 0;
}

.is-group + .is-group {
    border-top: 1px solid #F1F5F9;
}

.is-group-title {
    font-size: 0.68rem;
    font-weight: 700;
    color: #94A3B8;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 4px 14px 4px;
}

.is-hit {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 14px;
    cursor: pointer;
    transition: background 0.1s;
}

.is-hit:hover {
    background: #EFF6FF;
}

.is-hit-icon {
    color: #64748B;
    flex-shrink: 0;
}

.is-hit-main {
    flex: 1;
    min-width: 0;
}

.is-hit-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: #1E293B;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.is-hit-sub {
    font-size: 0.75rem;
    color: #64748B;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.is-mark {
    background: #FEF3C7;
    color: #92400E;
    padding: 0 1px;
    border-radius: 2px;
    font-weight: 600;
}

@media (max-width: 900px) {
    .inline-search {
        min-width: 240px;
    }
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }

/* ── Drawer nav group labels ── */
.nav-group-label {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #475569;
    padding: 16px 20px 6px;
}

/* ── Version badge in drawer ── */
.drawer-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
    color: #475569;
    font-size: 0.75rem;
}

/* ── MudPaper cards ── */
.mud-paper {
    border-radius: 12px !important;
}

/* ── Responsive tweaks ── */
@media (max-width: 600px) {
    .page-header .page-title {
        font-size: 1.25rem;
    }
    .filter-toolbar {
        padding: 12px;
    }
}

/* ── Blazor error boundary ── */
#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 20px;
    background: #DC2626;
    color: white;
    font-size: 0.875rem;
    z-index: 9999;
    text-align: center;
}
