/*
 * EstateHub — Metronic-inspired admin theme
 * Pure CSS (no SCSS build required). Override the CSS variables below
 * to re-skin the entire app — sidebar, buttons, cards, charts auto-pick
 * up the new palette.
 */

:root {
    /* Brand palette */
    --eh-primary: #5014d0;
    --eh-primary-rgb: 80, 20, 208;
    --eh-primary-hover: #3f0fb0;
    --eh-primary-light: #ece6fb;
    --eh-secondary: #6c757d;
    --eh-success: #1bc5bd;
    --eh-info: #2196f3;
    --eh-warning: #ffa800;
    --eh-danger: #f64e60;

    /* Surfaces */
    --eh-bg: #f4f6fa;
    --eh-surface: #ffffff;
    --eh-surface-alt: #f8f9fb;
    --eh-border: #ebedf3;
    --eh-shadow-sm: 0 2px 4px rgba(20, 25, 50, 0.04);
    --eh-shadow: 0 4px 12px rgba(20, 25, 50, 0.06);
    --eh-shadow-lg: 0 12px 32px rgba(20, 25, 50, 0.08);

    /* Type */
    --eh-text: #181c32;
    --eh-text-muted: #7e8299;
    --eh-text-subtle: #a1a5b7;
    --eh-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* Layout */
    --eh-sidebar-w: 264px;
    --eh-sidebar-w-collapsed: 72px;
    --eh-topbar-h: 64px;
    --eh-radius: 8px;
    --eh-radius-lg: 12px;
    --eh-transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

[data-bs-theme="dark"] {
    --eh-bg: #0f1014;
    --eh-surface: #181a20;
    --eh-surface-alt: #1f2128;
    --eh-border: #2b2d36;
    --eh-text: #e9ecef;
    --eh-text-muted: #9095a6;
    --eh-text-subtle: #6c7081;
    --eh-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    --eh-primary-light: rgba(80, 20, 208, 0.18);
}

/* Reset / base */
* { box-sizing: border-box; }

html, body {
    height: 100%;
    margin: 0;
}

body {
    font-family: var(--eh-font);
    font-size: 14px;
    line-height: 1.5;
    background: var(--eh-bg);
    color: var(--eh-text);
    -webkit-font-smoothing: antialiased;
}

/* ============= LAYOUT ============= */
.eh-layout {
    display: flex;
    min-height: 100vh;
}

.eh-main {
    flex: 1;
    margin-left: var(--eh-sidebar-w);
    transition: margin-left var(--eh-transition);
    min-width: 0;
}

.eh-content {
    padding: 24px 32px;
}

@media (max-width: 991.98px) {
    .eh-main { margin-left: 0; }
    .eh-content { padding: 16px; }
}

/* ============= SIDEBAR ============= */
.eh-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--eh-sidebar-w);
    background: var(--eh-surface);
    border-right: 1px solid var(--eh-border);
    z-index: 1030;
    display: flex;
    flex-direction: column;
    transition: transform var(--eh-transition), width var(--eh-transition);
}

.eh-sidebar-brand {
    height: var(--eh-topbar-h);
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid var(--eh-border);
    font-weight: 700;
    font-size: 18px;
    color: var(--eh-text);
    text-decoration: none;
    gap: 12px;
}

.eh-sidebar-brand i {
    color: var(--eh-primary);
    font-size: 24px;
}

.eh-sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
}

.eh-sidebar-section {
    font-size: 11px;
    font-weight: 600;
    color: var(--eh-text-subtle);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 16px 16px 8px;
}

.eh-sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: var(--eh-text-muted);
    text-decoration: none;
    border-radius: var(--eh-radius);
    font-weight: 500;
    transition: var(--eh-transition);
    margin-bottom: 2px;
}

.eh-sidebar-link i {
    font-size: 18px;
    width: 20px;
    text-align: center;
}

.eh-sidebar-link:hover {
    background: var(--eh-primary-light);
    color: var(--eh-primary);
}

.eh-sidebar-link.active {
    background: var(--eh-primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(var(--eh-primary-rgb), 0.3);
}

.eh-sidebar-link.active:hover {
    background: var(--eh-primary-hover);
    color: #fff;
}

.eh-sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--eh-border);
    font-size: 12px;
    color: var(--eh-text-subtle);
}

/* Collapsed sidebar */
.eh-sidebar-collapsed .eh-sidebar { width: var(--eh-sidebar-w-collapsed); }
.eh-sidebar-collapsed .eh-sidebar-brand span,
.eh-sidebar-collapsed .eh-sidebar-link span,
.eh-sidebar-collapsed .eh-sidebar-section,
.eh-sidebar-collapsed .eh-sidebar-footer { display: none; }
.eh-sidebar-collapsed .eh-sidebar-link { justify-content: center; padding: 10px; }
.eh-sidebar-collapsed .eh-main { margin-left: var(--eh-sidebar-w-collapsed); }

/* Mobile drawer */
@media (max-width: 991.98px) {
    .eh-sidebar { transform: translateX(-100%); }
    .eh-sidebar.show { transform: translateX(0); }
    .eh-sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1029;
        opacity: 0;
        pointer-events: none;
        transition: opacity var(--eh-transition);
    }
    .eh-sidebar-backdrop.show {
        opacity: 1;
        pointer-events: auto;
    }
}

/* ============= TOPBAR ============= */
.eh-topbar {
    height: var(--eh-topbar-h);
    background: var(--eh-surface);
    border-bottom: 1px solid var(--eh-border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.eh-topbar-toggle {
    background: none;
    border: 0;
    color: var(--eh-text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--eh-radius);
    transition: var(--eh-transition);
}

.eh-topbar-toggle:hover { background: var(--eh-surface-alt); color: var(--eh-text); }

.eh-topbar-search {
    flex: 1;
    max-width: 480px;
    position: relative;
}

.eh-topbar-search input {
    width: 100%;
    background: var(--eh-surface-alt);
    border: 1px solid transparent;
    border-radius: var(--eh-radius);
    padding: 8px 12px 8px 36px;
    color: var(--eh-text);
    font-size: 14px;
    transition: var(--eh-transition);
}

.eh-topbar-search input:focus {
    outline: none;
    border-color: var(--eh-primary);
    background: var(--eh-surface);
}

.eh-topbar-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--eh-text-subtle);
}

.eh-topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.eh-topbar-icon {
    background: none;
    border: 0;
    width: 40px;
    height: 40px;
    border-radius: var(--eh-radius);
    color: var(--eh-text-muted);
    cursor: pointer;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: var(--eh-transition);
    text-decoration: none;
}

.eh-topbar-icon:hover { background: var(--eh-surface-alt); color: var(--eh-text); }

.eh-topbar-icon .badge-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--eh-danger);
    border: 2px solid var(--eh-surface);
    border-radius: 50%;
}

.eh-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--eh-primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    overflow: hidden;
}

.eh-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ============= BREADCRUMBS ============= */
.eh-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 32px;
    color: var(--eh-text-muted);
    font-size: 13px;
    background: var(--eh-bg);
}

.eh-breadcrumbs a { color: var(--eh-text-muted); text-decoration: none; }
.eh-breadcrumbs a:hover { color: var(--eh-primary); }
.eh-breadcrumbs .sep { color: var(--eh-text-subtle); }
.eh-breadcrumbs .current { color: var(--eh-text); font-weight: 500; }

/* ============= CARDS ============= */
.card {
    background: var(--eh-surface);
    border: 1px solid var(--eh-border);
    border-radius: var(--eh-radius-lg);
    box-shadow: var(--eh-shadow-sm);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--eh-border);
    padding: 16px 20px;
    font-weight: 600;
}

.card-body { padding: 20px; }

/* Stat cards */
.eh-stat {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--eh-surface);
    border-radius: var(--eh-radius-lg);
    box-shadow: var(--eh-shadow-sm);
    border: 1px solid var(--eh-border);
}

.eh-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--eh-radius);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.eh-stat-icon.bg-primary-soft  { background: var(--eh-primary-light); color: var(--eh-primary); }
.eh-stat-icon.bg-success-soft  { background: rgba(27,197,189,0.12); color: var(--eh-success); }
.eh-stat-icon.bg-warning-soft  { background: rgba(255,168,0,0.12); color: var(--eh-warning); }
.eh-stat-icon.bg-danger-soft   { background: rgba(246,78,96,0.12); color: var(--eh-danger); }
.eh-stat-icon.bg-info-soft     { background: rgba(33,150,243,0.12); color: var(--eh-info); }

.eh-stat-label { font-size: 13px; color: var(--eh-text-muted); margin-bottom: 4px; }
.eh-stat-value { font-size: 24px; font-weight: 700; color: var(--eh-text); line-height: 1.2; }
.eh-stat-delta { font-size: 12px; margin-top: 4px; }
.eh-stat-delta.up { color: var(--eh-success); }
.eh-stat-delta.down { color: var(--eh-danger); }

/* Gradient stat variant */
.eh-stat-gradient {
    color: #fff;
    background: linear-gradient(135deg, var(--eh-primary), #7d3deb);
    border: 0;
}

.eh-stat-gradient .eh-stat-label,
.eh-stat-gradient .eh-stat-value { color: #fff; }

.eh-stat-gradient .eh-stat-icon {
    background: rgba(255,255,255,0.18);
    color: #fff;
}

/* ============= BUTTONS ============= */
.btn {
    border-radius: var(--eh-radius);
    font-weight: 500;
    padding: 8px 16px;
    transition: var(--eh-transition);
    border: 1px solid transparent;
}

.btn-primary,
.btn-brand {
    background: var(--eh-primary);
    border-color: var(--eh-primary);
    color: #fff;
}

.btn-primary:hover,
.btn-brand:hover {
    background: var(--eh-primary-hover);
    border-color: var(--eh-primary-hover);
    color: #fff;
}

.btn-light-primary {
    background: var(--eh-primary-light);
    color: var(--eh-primary);
    border: 0;
}

.btn-light-primary:hover {
    background: var(--eh-primary);
    color: #fff;
}

/* ============= FORMS ============= */
.form-control,
.form-select {
    border-radius: var(--eh-radius);
    border: 1px solid var(--eh-border);
    background: var(--eh-surface);
    color: var(--eh-text);
    padding: 9px 12px;
    transition: var(--eh-transition);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--eh-primary);
    box-shadow: 0 0 0 3px rgba(var(--eh-primary-rgb), 0.12);
}

.form-label { font-weight: 500; color: var(--eh-text); margin-bottom: 6px; font-size: 13px; }

/* ============= TABLES ============= */
.table {
    background: var(--eh-surface);
    color: var(--eh-text);
    border-color: var(--eh-border);
    margin-bottom: 0;
}

.table thead th {
    background: var(--eh-surface-alt);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--eh-text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--eh-border);
}

.table > :not(caption) > * > * {
    background: transparent;
    border-bottom-color: var(--eh-border);
    padding: 12px 16px;
}

.table-hover tbody tr:hover td { background: var(--eh-primary-light); }

/* ============= BADGES ============= */
.badge {
    border-radius: 4px;
    font-weight: 500;
    padding: 4px 8px;
}

.badge-soft-primary { background: var(--eh-primary-light); color: var(--eh-primary); }
.badge-soft-success { background: rgba(27,197,189,0.12); color: var(--eh-success); }
.badge-soft-warning { background: rgba(255,168,0,0.12); color: var(--eh-warning); }
.badge-soft-danger  { background: rgba(246,78,96,0.12); color: var(--eh-danger); }

/* ============= ALERTS ============= */
.alert { border-radius: var(--eh-radius); border: 0; padding: 12px 16px; }
.alert-success { background: rgba(27,197,189,0.12); color: var(--eh-success); }
.alert-warning { background: rgba(255,168,0,0.12); color: var(--eh-warning); }
.alert-danger  { background: rgba(246,78,96,0.12); color: var(--eh-danger); }
.alert-info    { background: rgba(33,150,243,0.12); color: var(--eh-info); }

/* ============= AUTH SCREENS ============= */
.eh-auth {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 10% 10%, rgba(var(--eh-primary-rgb),0.08), transparent 40%),
        radial-gradient(circle at 90% 90%, rgba(var(--eh-primary-rgb),0.08), transparent 40%),
        var(--eh-bg);
    padding: 24px;
}

.eh-auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--eh-surface);
    border-radius: var(--eh-radius-lg);
    box-shadow: var(--eh-shadow-lg);
    padding: 40px 32px;
}

.eh-auth-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-weight: 700;
    font-size: 20px;
    margin-bottom: 24px;
}

.eh-auth-brand i { color: var(--eh-primary); font-size: 28px; }

/* ============= TOAST ============= */
.eh-toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1080;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.eh-toast {
    background: var(--eh-surface);
    border: 1px solid var(--eh-border);
    border-left: 4px solid var(--eh-primary);
    border-radius: var(--eh-radius);
    box-shadow: var(--eh-shadow-lg);
    padding: 12px 16px;
    min-width: 280px;
    max-width: 360px;
    color: var(--eh-text);
    pointer-events: auto;
    animation: eh-toast-in 250ms cubic-bezier(0.4,0,0.2,1);
}

.eh-toast.success { border-left-color: var(--eh-success); }
.eh-toast.warning { border-left-color: var(--eh-warning); }
.eh-toast.danger  { border-left-color: var(--eh-danger); }

@keyframes eh-toast-in {
    from { transform: translateX(120%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

/* ============= CHARTS ============= */
.eh-chart-card { padding: 20px; }
.eh-chart-card h5 { margin: 0 0 4px; font-size: 16px; }
.eh-chart-card .subtitle { font-size: 13px; color: var(--eh-text-muted); margin-bottom: 16px; }
.eh-chart-canvas { position: relative; height: 280px; }

/* ============= SCROLLBAR ============= */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--eh-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--eh-text-subtle); }

/* ============= UTILS ============= */
.text-brand { color: var(--eh-primary) !important; }
.bg-brand { background: var(--eh-primary) !important; color: #fff; }
.border-brand { border-color: var(--eh-primary) !important; }
.fw-medium { font-weight: 500 !important; }
.text-muted { color: var(--eh-text-muted) !important; }
