/* ═══════════════════════════════════════════════════════════
   AI Real Estate System — Modern Smart UI
   ═══════════════════════════════════════════════════════════ */

:root {
    --brand-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    --card-glass: rgba(255, 255, 255, 0.03);
    --card-border: rgba(255, 255, 255, 0.06);
    --accent-blue: #3b82f6;
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    --accent-rose: #f43f5e;
    --accent-violet: #8b5cf6;
    --sidebar-width: 280px;
    --topbar-height: 64px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
    --shadow-lg: 0 10px 25px -3px rgba(0,0,0,.08), 0 4px 6px -4px rgba(0,0,0,.04);
    --shadow-glow-blue: 0 0 20px rgba(59,130,246,.15);
    --shadow-glow-emerald: 0 0 20px rgba(16,185,129,.15);
}

html, body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #f8fafc;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,.15); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,.25); }

/* ── Global Link & Button ── */
a, .btn-link { color: var(--accent-blue); }
.btn-primary { color: #fff; background-color: var(--accent-blue); border-color: var(--accent-blue); }
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem var(--accent-blue);
}
h1:focus { outline: none; }

/* ── Form Validation ── */
.valid.modified:not([type=checkbox]) { outline: 1px solid var(--accent-emerald); }
.invalid { outline: 1px solid var(--accent-rose); }
.validation-message { color: var(--accent-rose); }

/* ── Blazor Error Boundary ── */
.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
    border-radius: var(--radius-sm);
}
.blazor-error-boundary::after { content: "An error has occurred."; }

.darker-border-checkbox.form-check-input { border-color: #929292; }
.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color); text-align: end;
}
.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* ═══════════════════════════════════════════════════════════
   Modern KPI Card System
   ═══════════════════════════════════════════════════════════ */

.kpi-card {
    border-radius: var(--radius-md) !important;
    border: 1px solid rgba(0,0,0,.04) !important;
    transition: all .3s cubic-bezier(.4,0,.2,1) !important;
    position: relative;
    overflow: hidden;
}
.kpi-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg) !important;
}
.kpi-card.blue::before { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.kpi-card.green::before { background: linear-gradient(90deg, #10b981, #34d399); }
.kpi-card.amber::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.kpi-card.rose::before { background: linear-gradient(90deg, #f43f5e, #fb7185); }
.kpi-card.violet::before { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }

/* ═══════════════════════════════════════════════════════════
   Gradient Icon Badge
   ═══════════════════════════════════════════════════════════ */

.icon-badge {
    width: 48px; height: 48px;
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.icon-badge.blue { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.icon-badge.green { background: linear-gradient(135deg, #10b981, #059669); }
.icon-badge.amber { background: linear-gradient(135deg, #f59e0b, #d97706); }
.icon-badge.rose { background: linear-gradient(135deg, #f43f5e, #e11d48); }
.icon-badge.violet { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.icon-badge .mud-icon-root { color: white !important; font-size: 1.5rem !important; }

.right-sub-menu.mud-popover.mud-popover-open {
    opacity: 1;
    transition: opacity;
    position: absolute;
    right: 10px !important;
    left: calc(100% - 120px) !important;
    width: 120px !important;
    border: 1px solid #efefef;
    border-radius: 0px;
    margin: 0px;
}
.right-sub-menu .mud-menu-list {
    padding: 0px;
}
/* ═══════════════════════════════════════════════════════════
   Page Header
   ═══════════════════════════════════════════════════════════ */
.page-header {
    margin-bottom: 28px;
    padding: 0;
}
.page-header .page-title {
    font-weight: 700 !important;
    font-size: 1.75rem !important;
    letter-spacing: -0.02em;
    color: #0f172a;
    line-height: 1.2;
}
.page-header .page-subtitle {
    color: #64748b !important;
    font-size: 0.925rem !important;
    margin-top: 4px;
}

/* ═══════════════════════════════════════════════════════════
   Modern Card / Paper
   ═══════════════════════════════════════════════════════════ */

.modern-card {
    border-radius: var(--radius-md) !important;
    border: 1px solid rgba(0,0,0,.05) !important;
    box-shadow: var(--shadow-sm) !important;
    transition: box-shadow .3s ease, transform .3s ease !important;
}
.modern-card:hover {
    box-shadow: var(--shadow-md) !important;
}

/* ═══════════════════════════════════════════════════════════
   Modern Table Styling
   ═══════════════════════════════════════════════════════════ */

.mud-table {
    border-radius: var(--radius-md) !important;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,.05);
}
.mud-table .mud-table-head .mud-table-row .mud-table-cell {
    background: #f8fafc !important;
    font-weight: 600 !important;
    font-size: 0.8rem !important;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b !important;
    border-bottom: 2px solid #e2e8f0 !important;
    padding: 14px 16px !important;
}
.mud-table .mud-table-body .mud-table-row {
    transition: background .15s ease;
}
.mud-table .mud-table-body .mud-table-row:hover {
    background: #f1f5f9 !important;
}
.mud-table .mud-table-body .mud-table-row .mud-table-cell {
    padding: 12px 16px !important;
    font-size: 0.875rem;
    border-bottom: 1px solid #f1f5f9 !important;
}
.mud-table .mud-table-toolbar {
    background: transparent !important;
    padding: 16px 16px 12px !important;
}
.mud-table .mud-table-footer .mud-table-cell {
    font-weight: 700 !important;
    background: #f8fafc !important;
    border-top: 2px solid #e2e8f0 !important;
}

/* ═══════════════════════════════════════════════════════════
   Modern Chips
   ═══════════════════════════════════════════════════════════ */

.mud-chip {
    border-radius: 8px !important;
    font-weight: 600 !important;
    font-size: 0.75rem !important;
    letter-spacing: 0.02em !important;
}

/* ═══════════════════════════════════════════════════════════
   Modern Tabs
   ═══════════════════════════════════════════════════════════ */

.mud-tabs {
    border-radius: var(--radius-md) !important;
}
.mud-tabs .mud-tab {
    font-weight: 600 !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    min-width: 120px;
    font-size: 0.875rem !important;
}

/* ═══════════════════════════════════════════════════════════
   Modern Dialog
   ═══════════════════════════════════════════════════════════ */

.mud-dialog {
    border-radius: var(--radius-lg) !important;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,.15) !important;
}
.mud-dialog .mud-dialog-title {
    font-weight: 700 !important;
    font-size: 1.25rem !important;
    padding: 24px 24px 8px !important;
}
.mud-dialog .mud-dialog-content {
    padding: 16px 24px !important;
}
.mud-dialog .mud-dialog-actions {
    padding: 12px 24px 20px !important;
}

/* ═══════════════════════════════════════════════════════════
   Modern Input Fields
   ═══════════════════════════════════════════════════════════ */

.mud-input-control .mud-input-outlined .mud-input-outlined-border {
    border-radius: var(--radius-sm) !important;
}

/* ═══════════════════════════════════════════════════════════
   Modern Alert
   ═══════════════════════════════════════════════════════════ */

.mud-alert {
    border-radius: var(--radius-sm) !important;
}

/* ═══════════════════════════════════════════════════════════
   Progress Bars
   ═══════════════════════════════════════════════════════════ */

.mud-progress-linear {
    border-radius: 20px !important;
    overflow: hidden;
}
.mud-progress-linear .mud-progress-linear-bar {
    border-radius: 20px !important;
}

/* ═══════════════════════════════════════════════════════════
   Sidebar Styling
   ═══════════════════════════════════════════════════════════ */

.mud-drawer {
    border-right: 1px solid rgba(0,0,0,.05) !important;
}
.sidebar-brand {
    padding: 20px 16px;
    border-bottom: 1px solid rgba(0,0,0,.06);
}
.sidebar-brand .brand-icon {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 1.25rem; font-weight: 800;
    flex-shrink: 0;
}
.sidebar-brand .brand-text {
    font-weight: 700;
    font-size: 0.95rem;
    color: #0f172a;
    line-height: 1.2;
}
.sidebar-brand .brand-sub {
    font-size: 0.7rem;
    color: #94a3b8;
    font-weight: 500;
}

/* Nav Menu Modern */
.mud-nav-link {
    border-radius: var(--radius-sm) !important;
    margin: 2px 8px !important;
    font-weight: 500 !important;
    font-size: 0.85rem !important;
    transition: all .2s ease !important;
    color: #475569 !important;
}
.mud-nav-link:hover {
    background: #f1f5f9 !important;
    color: #0f172a !important;
}
.mud-nav-link.active {
    background: linear-gradient(135deg, #eff6ff, #e0f2fe) !important;
    color: #2563eb !important;
    font-weight: 600 !important;
}
.mud-nav-link.active .mud-nav-link-icon {
    color: #2563eb !important;
}

.mud-navmenu .mud-nav-group .mud-nav-group-title {
    font-weight: 600 !important;
    font-size: 0.8rem !important;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8 !important;
    padding: 12px 16px 4px !important;
}

/* ═══════════════════════════════════════════════════════════
   App Bar
   ═══════════════════════════════════════════════════════════ */

.mud-appbar {
    background: white !important;
    color: #0f172a !important;
    border-bottom: 1px solid rgba(0,0,0,.06) !important;
    box-shadow: none !important;
}
.mud-appbar .mud-icon-button {
    color: #64748b !important;
}
.mud-appbar .mud-icon-button:hover {
    background: #f1f5f9 !important;
    color: #0f172a !important;
}

/* ═══════════════════════════════════════════════════════════
   Animations
   ═══════════════════════════════════════════════════════════ */

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes slideIn {
    from { opacity: 0; transform: translateX(-8px); }
    to { opacity: 1; transform: translateX(0); }
}
.animate-in {
    animation: fadeInUp .4s cubic-bezier(.4,0,.2,1) both;
}
.animate-in-delay-1 { animation-delay: .05s; }
.animate-in-delay-2 { animation-delay: .1s; }
.animate-in-delay-3 { animation-delay: .15s; }
.animate-in-delay-4 { animation-delay: .2s; }

/* ═══════════════════════════════════════════════════════════
   Stat Card Variants (for dashboard)
   ═══════════════════════════════════════════════════════════ */

.stat-card {
    border-radius: var(--radius-md) !important;
    border: 1px solid rgba(0,0,0,.04) !important;
    box-shadow: var(--shadow-sm) !important;
    padding: 20px !important;
    transition: all .3s cubic-bezier(.4,0,.2,1) !important;
    position: relative;
    overflow: hidden;
}
.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg) !important;
}
.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
    color: #0f172a;
}
.stat-card .stat-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    margin-bottom: 8px;
}
.stat-card .stat-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
}
.stat-card .stat-icon.blue { background: linear-gradient(135deg, #dbeafe, #bfdbfe); color: #2563eb; }
.stat-card .stat-icon.green { background: linear-gradient(135deg, #d1fae5, #a7f3d0); color: #059669; }
.stat-card .stat-icon.amber { background: linear-gradient(135deg, #fef3c7, #fde68a); color: #d97706; }
.stat-card .stat-icon.rose { background: linear-gradient(135deg, #ffe4e6, #fecdd3); color: #e11d48; }
.stat-card .stat-icon.violet { background: linear-gradient(135deg, #ede9fe, #ddd6fe); color: #7c3aed; }

/* ═══════════════════════════════════════════════════════════
   Chart Container
   ═══════════════════════════════════════════════════════════ */

.chart-card {
    border-radius: var(--radius-md) !important;
    border: 1px solid rgba(0,0,0,.04) !important;
    box-shadow: var(--shadow-sm) !important;
}
.chart-card .chart-title {
    font-weight: 700;
    font-size: 1rem;
    color: #0f172a;
    margin-bottom: 4px;
}
.chart-card .chart-subtitle {
    font-size: 0.8rem;
    color: #94a3b8;
}

/* ═══════════════════════════════════════════════════════════
   Utility
   ═══════════════════════════════════════════════════════════ */

.text-gradient {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.border-accent { border-left: 4px solid var(--accent-blue) !important; }
.border-accent-green { border-left: 4px solid var(--accent-emerald) !important; }
.border-accent-amber { border-left: 4px solid var(--accent-amber) !important; }
.border-accent-rose { border-left: 4px solid var(--accent-rose) !important; }
.border-accent-violet { border-left: 4px solid var(--accent-violet) !important; }

/* ═══════════════════════════════════════════════════════════
   Auth Pages
   ═══════════════════════════════════════════════════════════ */

.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}
.auth-card {
    width: 100%;
    max-width: 440px;
    border-radius: var(--radius-lg) !important;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,.25) !important;
    padding: 40px !important;
}
.auth-card .auth-logo {
    width: 56px; height: 56px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 20px;
    font-size: 1.5rem; color: white; font-weight: 800;
}

/* ═══════════════════════════════════════════════════════════
   Section Divider
   ═══════════════════════════════════════════════════════════ */

.section-title {
    font-weight: 700 !important;
    font-size: 1.15rem !important;
    color: #0f172a;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 10px;
}
.section-title .section-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1rem;
}

/* Empty state */
.empty-state {
    padding: 48px 24px;
    text-align: center;
}
.empty-state .empty-icon {
    width: 64px; height: 64px;
    border-radius: 50%;
    background: #f1f5f9;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 16px;
}

/* ═══════════════════════════════════════════════════════════
   Responsive Adjustments
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 960px) {
    .stat-card .stat-value { font-size: 1.35rem; }
    .page-header .page-title { font-size: 1.35rem !important; }
}