/* ═══════════════════════════════════════════════════════════════════
   echelon Client Portal Theme
   ───────────────────────────────────────────────────────────────────
   All rules scoped under body.echelon-theme so they CANNOT affect
   WealthSphere. This file is only loaded when echelon_mode_enabled
   is true (conditional <link> in App.razor).

   Design tokens from Brett's echelon-portal.html POC:
     --dark:    #1a1a2e   (header/sidebar bg)
     --dark2:   #16213e   (gradient end)
     --accent:  #11C683   (primary green)
     --accent-hover: #0eaa6f
     --accent-light: rgba(17,198,131,.08)
     --bg:      #f0f2f5   (page background)
     --card:    #ffffff
     --text:    #1a1a2e
     --text2:   #6b7280
     --text3:   #9ca3af
     --border:  #e5e7eb
     --border2: #f3f4f6
     --radius:  10px
     --radius-sm: 6px
   ═══════════════════════════════════════════════════════════════════ */


/* ─── Page background ────────────────────────────────────────────── */

.echelon-theme {
    background-color: #f0f2f5 !important;
}

.echelon-theme::before {
    content: '';
    position: fixed;
    inset: 0;
    opacity: .03;
    pointer-events: none;
    z-index: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%2311C683' fill-opacity='1'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* Subtle cross-hatch pattern overlay (matches POC) */
.echelon-theme::before {
    content: '';
    position: fixed;
    inset: 0;
    opacity: 0.03;
    pointer-events: none;
    z-index: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%2311C683' fill-opacity='1'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}


/* ─── Header — dark navy gradient ────────────────────────────────── */

.echelon-theme .top-menu {
    background: linear-gradient(135deg, #1a1a2e, #16213e) !important;
}


/* ─── Sidebar — dark navy ────────────────────────────────────────── */

.echelon-theme .sidebar {
    background-color: #1a1a2e !important;
}

.echelon-theme .gridlayout-left-side-bar:before {
    background-color: #1a1a2e !important;
}

/* Sidebar sub-menus */
.echelon-theme .dx-nav-sub-menu {
    background-color: #16213e !important;
}


/* ─── Accent colour — green #11C683 replaces teal #00d9c5 ────── */

/* Topbar pill badges */
.echelon-theme .topbar-pill {
    background: rgba(17, 198, 131, 0.15) !important;
    color: #11C683 !important;
    border: 1px solid rgba(17, 198, 131, 0.3) !important;
}

.echelon-theme .topbar-pill *:not(.topbar-pill) {
    color: #11C683 !important;
}

.echelon-theme .topbar-pill:hover {
    background: rgba(17, 198, 131, 0.35) !important;
}

.echelon-theme .topbar-pill:hover *:not(.topbar-pill) {
    color: #fff !important;
}

/* Toolbar icon hover — green instead of teal */
.echelon-theme .dx-nav-menu .dxbl-menu-item:not(.topbar-pill):not(.search-menu-item):hover [class*="dx-icon"],
.echelon-theme .dx-nav-menu .dxbl-menu-item:not(.topbar-pill):not(.search-menu-item):hover [class*="menu-icon"] {
    color: #11C683 !important;
}

/* IQ toolbar button active state */
.echelon-theme .iq-toolbar-active [class*="dx-icon"],
.echelon-theme .iq-toolbar-active [class*="menu-icon"] {
    color: #11C683 !important;
}


/* ─── Sidebar nav items — green accent on hover/active ───────────── */

/* Left sidebar menu items — green hover */
.echelon-theme .dxbl-menu .dxbl-menu-item:hover,
.echelon-theme .dxbl-menu .dxbl-menu-item.dxbl-active {
    background: rgba(17, 198, 131, 0.12) !important;
}

.echelon-theme .dxbl-menu .dxbl-menu-item:hover [class*="dx-icon"],
.echelon-theme .dxbl-menu .dxbl-menu-item:hover [class*="menu-icon"],
.echelon-theme .dxbl-menu .dxbl-menu-item.dxbl-active [class*="dx-icon"],
.echelon-theme .dxbl-menu .dxbl-menu-item.dxbl-active [class*="menu-icon"] {
    color: #11C683 !important;
}


/* ─── Content area ───────────────────────────────────────────────── */

.echelon-theme .content {
    background-color: #f0f2f5;
}


/* ─── Cards — white with echelon shadows ─────────────────────────── */

.echelon-theme .card,
.echelon-theme .dxbl-card {
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
}


/* ─── DevExpress grid — echelon POC table style ──────────────────── */

/* Header — tiny uppercase, light grey, heavier bottom border */
.echelon-theme .dxbl-grid .dxbl-grid-table th,
.echelon-theme .dxbl-grid .dxbl-grid-header-content {
    background: #f8f9fb !important;
    font-size: 0.67rem !important;
    font-weight: 700 !important;
    color: #9ca3af !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    white-space: nowrap !important;
    border-bottom: 2px solid #e5e7eb !important;
    border-top: none !important;
}

/* Cells — compact, clean, subtle bottom border only */
.echelon-theme .dxbl-grid .dxbl-grid-table td {
    font-size: 0.8rem !important;
    color: #1a1a2e !important;
    padding: 0.6rem 0.9rem !important;
    border-bottom: 1px solid #f3f4f6 !important;
    border-top: none !important;
    border-left: none !important;
    border-right: none !important;
    vertical-align: middle !important;
}

/* Last row — no bottom border */
.echelon-theme .dxbl-grid .dxbl-grid-table tr:last-child td {
    border-bottom: none !important;
}

/* Row hover — green tint */
.echelon-theme .dxbl-grid .dxbl-grid-table tr:hover td {
    background: rgba(17, 198, 131, 0.08) !important;
}

/* Selected row — slightly stronger green */
.echelon-theme .dxbl-grid .dxbl-grid-table tr.dxbl-grid-selected td {
    background: rgba(17, 198, 131, 0.12) !important;
}

/* Focused row — green left accent instead of default highlight */
.echelon-theme .dxbl-grid .dxbl-grid-table tr.dxbl-grid-focused td {
    background: rgba(17, 198, 131, 0.06) !important;
    box-shadow: inset 3px 0 0 #11C683 !important;
}

/* Grid header sort indicators */
.echelon-theme .dxbl-grid .dxbl-grid-header-content .dxbl-grid-sort-indicator {
    color: #11C683 !important;
}

/* Group row — clean style */
.echelon-theme .dxbl-grid .dxbl-grid-group-row td {
    background: #f8f9fb !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    color: #1a1a2e !important;
}

/* Filter row — subtle */
.echelon-theme .dxbl-grid .dxbl-grid-filter-row td {
    background: #fafbfc !important;
    border-bottom: 1px solid #e5e7eb !important;
}

/* Pager — clean, compact */
.echelon-theme .dxbl-grid .dxbl-pager {
    font-size: 0.75rem !important;
    border-top: 1px solid #f3f4f6 !important;
}

/* Grid container — softer shadow, rounded */
.echelon-theme .dxbl-grid {
    border-radius: 10px !important;
    overflow: hidden !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06) !important;
    border: none !important;
}

/* Toolbar — cleaner look */
.echelon-theme .toolbar-container {
    border-bottom: 1px solid #f3f4f6 !important;
}


/* ─── DevExpress buttons — green primary ─────────────────────────── */

.echelon-theme .dxbl-btn.dxbl-btn-primary,
.echelon-theme .btn-primary {
    background-color: #11C683 !important;
    border-color: #11C683 !important;
}

.echelon-theme .dxbl-btn.dxbl-btn-primary:hover,
.echelon-theme .btn-primary:hover {
    background-color: #0eaa6f !important;
    border-color: #0eaa6f !important;
}

/* Outline variant */
.echelon-theme .dxbl-btn.dxbl-btn-outline-primary,
.echelon-theme .btn-outline-primary {
    color: #11C683 !important;
    border-color: #11C683 !important;
}

.echelon-theme .dxbl-btn.dxbl-btn-outline-primary:hover,
.echelon-theme .btn-outline-primary:hover {
    background-color: #11C683 !important;
    color: #fff !important;
}


/* ─── DevExpress tabs — green active indicator ───────────────────── */

.echelon-theme .dxbl-tabs .dxbl-tabs-item.dxbl-active {
    border-bottom-color: #11C683 !important;
    color: #11C683 !important;
}

.echelon-theme .dxbl-tabs .dxbl-tabs-item:hover {
    color: #11C683 !important;
}


/* ─── DevExpress editors — green focus ring ──────────────────────── */

.echelon-theme .dxbl-input-editor.dxbl-focused,
.echelon-theme .dxbl-text-edit.dxbl-focused,
.echelon-theme .dxbl-combobox.dxbl-focused,
.echelon-theme .dxbl-spin-edit.dxbl-focused,
.echelon-theme .dxbl-date-edit.dxbl-focused {
    border-color: #11C683 !important;
    box-shadow: 0 0 0 0.2rem rgba(17, 198, 131, 0.25) !important;
}

/* Checkbox / toggle checked state */
.echelon-theme .dxbl-checkbox.dxbl-checked .dxbl-checkbox-check-element {
    background-color: #11C683 !important;
    border-color: #11C683 !important;
}


/* ─── DevExpress popup — green header accent ─────────────────────── */

.echelon-theme .dxbl-modal .dxbl-modal-header,
.echelon-theme .dxbl-popup .dxbl-popup-header {
    border-bottom-color: #11C683 !important;
}


/* ─── Links ──────────────────────────────────────────────────────── */

.echelon-theme a:not(.dxbl-menu-item):not(.topbar-pill):not(.nav-link) {
    color: #11C683;
}

.echelon-theme a:not(.dxbl-menu-item):not(.topbar-pill):not(.nav-link):hover {
    color: #0eaa6f;
}


/* ─── Form validation — green valid indicator ────────────────────── */

.echelon-theme .valid.modified:not([type=checkbox]) {
    outline-color: #11C683;
}


/* ─── Scrollbar — subtle green accent ────────────────────────────── */

.echelon-theme ::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.echelon-theme ::-webkit-scrollbar-track {
    background: transparent;
}

.echelon-theme ::-webkit-scrollbar-thumb {
    background: rgba(17, 198, 131, 0.3);
    border-radius: 3px;
}

.echelon-theme ::-webkit-scrollbar-thumb:hover {
    background: rgba(17, 198, 131, 0.5);
}


/* ─── Status pills — echelon palette ─────────────────────────────── */

.echelon-theme .badge-success,
.echelon-theme .bg-success {
    background-color: #11C683 !important;
}


/* ─── Login page — full echelon-branded login ────────────────────── */

/* Login header — dark navy to match POC */
.echelon-theme .login-header {
    background: linear-gradient(135deg, #1a1a2e, #16213e) !important;
}

/* Background overlay — darken and tint */
.echelon-theme .login-background-echelon {
    position: relative;
}

.echelon-theme .login-background-echelon::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(26, 26, 46, 0.5), rgba(22, 33, 62, 0.3));
    pointer-events: none;
    z-index: 0;
}

/* Login form card — glassmorphism card matching POC */
.echelon-theme .loginform-layout,
.echelon-theme .loginform-layout2 {
    position: relative;
    z-index: 1;
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 16px !important;
    padding: 2rem !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3) !important;
    margin-top: 60px !important;
}

/* Form group caption — echelon style */
.echelon-theme .loginform-layout .dxbl-fl-group-caption,
.echelon-theme .loginform-layout2 .dxbl-fl-group-caption {
    font-size: 1.4rem !important;
    font-weight: 300 !important;
    color: #1a1a2e !important;
    letter-spacing: -0.5px !important;
    text-align: center !important;
}

/* Input fields — match POC style */
.echelon-theme .login-background-echelon input.form-control {
    border: 1.5px solid #e5e7eb !important;
    border-radius: 6px !important;
    padding: 0.75rem 1rem !important;
    font-size: 0.9rem !important;
    transition: border-color 0.2s ease !important;
}

.echelon-theme .login-background-echelon input.form-control:focus {
    border-color: #11C683 !important;
    box-shadow: 0 0 0 0.2rem rgba(17, 198, 131, 0.25) !important;
}

/* Sign in button — green accent */
.echelon-theme .login-background-echelon .btn-primary {
    background-color: #11C683 !important;
    border-color: #11C683 !important;
    border-radius: 6px !important;
    font-weight: 600 !important;
    font-size: 0.95rem !important;
    padding: 0.8rem !important;
    transition: background-color 0.2s ease !important;
}

.echelon-theme .login-background-echelon .btn-primary:hover {
    background-color: #0eaa6f !important;
    border-color: #0eaa6f !important;
}

/* Echelon logo on login — centred and larger */
.echelon-theme .login-background-echelon #login-logo {
    max-width: 72px !important;
    max-height: 72px !important;
    margin: 0 auto 1rem !important;
    display: block !important;
}

/* "Powered by" footer text */
.echelon-theme .loginform-layout::after {
    content: 'Powered by WealthSphere — enSynergy Technology';
    display: block;
    text-align: center;
    font-size: 0.7rem;
    color: #9ca3af;
    margin-top: 1.5rem;
}


/* ─── Page transitions — fade in on navigation ──────────────────── */

.echelon-theme .content {
    animation: ech-page-fade 0.3s ease;
}

@keyframes ech-page-fade {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}


/* ─── Mobile — hide sidebar, show bottom nav, adjust content ────── */

@media (max-width: 768px) {
    /* Hide echelon sidebar on mobile */
    .echelon-theme .gridlayout-left-side-bar {
        display: none !important;
    }

    /* Remove left margin so content fills the screen */
    .echelon-theme .dxbl-gridlayout-root > [class*="dxbl-gridlayout-item"]:has(.gridlayout-left-side-bar) {
        display: none !important;
    }

    /* Add bottom padding to content so it doesn't sit under the mobile nav */
    .echelon-theme .content {
        padding-bottom: 70px !important;
    }

    /* Shift IQ FAB above mobile nav */
    .echelon-theme .iq-fab {
        bottom: 70px !important;
    }
}


/* ─── Dev toggle button styling ──────────────────────────────────── */
/* Visible only in dev mode — subtle indicator in both headers */

.echelon-toggle-btn [class*="dx-icon"] {
    color: #11C683 !important;
}


/* ─── Toast notifications — echelon POC style ────────────────────── */

.echelon-theme .dxbl-toast {
    background: #1a1a2e !important;
    color: #fff !important;
    border: none !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25) !important;
    font-size: 0.82rem !important;
    font-family: inherit !important;
}

.echelon-theme .dxbl-toast .dxbl-toast-header {
    background: transparent !important;
    color: #fff !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    font-weight: 600 !important;
}

.echelon-theme .dxbl-toast .dxbl-toast-body {
    color: rgba(255, 255, 255, 0.85) !important;
}

/* Close button */
.echelon-theme .dxbl-toast .btn-close {
    filter: invert(1) !important;
}

/* Success toast — green left accent */
.echelon-theme .dxbl-toast.dxbl-toast-success,
.echelon-theme .dxbl-toast[class*="success"] {
    border-left: 3px solid #11C683 !important;
}

/* Error/danger toast — red left accent */
.echelon-theme .dxbl-toast.dxbl-toast-danger,
.echelon-theme .dxbl-toast[class*="danger"] {
    border-left: 3px solid #ef4444 !important;
}

/* Warning toast — amber left accent */
.echelon-theme .dxbl-toast.dxbl-toast-warning,
.echelon-theme .dxbl-toast[class*="warning"] {
    border-left: 3px solid #f59e0b !important;
}

/* Info toast — blue left accent */
.echelon-theme .dxbl-toast.dxbl-toast-info,
.echelon-theme .dxbl-toast[class*="info"] {
    border-left: 3px solid #3b82f6 !important;
}


/* ─── DevExpress Fluent theme accent override ────────────────────── */
/* The Fluent theme uses CSS custom properties for its accent colour.
   Override them under .echelon-theme so DX controls pick up green. */

.echelon-theme {
    --dxbl-accent-color: #11C683;
    --dxbl-accent-color-hover: #0eaa6f;
    --dxbl-accent-bg: rgba(17, 198, 131, 0.08);
}
