/* ═══════════════════════════════════════════════════════════════════
   echelon-pages.css — shared page-level primitives for Echelon portal
   Scoped under .echelon-theme to prevent WealthSphere impact.
   ═══════════════════════════════════════════════════════════════════ */

/* ── Page title ──────────────────────────────────────────────────── */
.ech-page-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--ech-text, #1a1a2e);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.ech-page-title svg {
    width: 20px;
    height: 20px;
    color: var(--ech-accent,#11C683);
}

/* ── Cards ────────────────────────────────────────────────────────── */
.ech-card {
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    overflow: hidden;
}

.ech-card-header {
    padding: .75rem 1rem;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ech-card-title {
    font-size: .82rem;
    font-weight: 600;
    color: var(--ech-text, #1a1a2e);
}

/* ── Buttons ──────────────────────────────────────────────────────── */
.ech-btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .5rem 1rem;
    border-radius: 6px;
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    border: none;
    line-height: 1.2;
    font-family: inherit;
}

.ech-btn svg {
    width: 14px;
    height: 14px;
}

.ech-btn-primary {
    background: var(--ech-accent,#11C683);
    color: white;
}

.ech-btn-primary:hover {
    background: var(--ech-accent-hover,#0EAA6F);
}

.ech-btn-primary:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.ech-btn-outline {
    background: white;
    color: var(--ech-text, #1a1a2e);
    border: 1.5px solid #e5e7eb;
}

.ech-btn-outline:hover {
    border-color: var(--ech-accent,#11C683);
    color: var(--ech-accent,#11C683);
}

.ech-btn-sm {
    padding: .35rem .7rem;
    font-size: .72rem;
}

/* ── Tabs ─────────────────────────────────────────────────────────── */
.ech-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 1rem;
}

.ech-tab {
    padding: .55rem 1.1rem;
    font-size: .82rem;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all .2s;
    user-select: none;
}

.ech-tab:hover {
    color: var(--ech-text, #1a1a2e);
}

.ech-tab.active {
    color: var(--ech-accent,#11C683);
    border-bottom-color: var(--ech-accent,#11C683);
    font-weight: 600;
}

.ech-tab-count {
    background: color-mix(in srgb, var(--ech-accent,#11C683) 8%, transparent);
    color: var(--ech-accent,#11C683);
    font-size: .65rem;
    font-weight: 700;
    padding: .1rem .4rem;
    border-radius: 8px;
    margin-left: .3rem;
}

/* ── Split layout ─────────────────────────────────────────────────── */
/* Default: wide list on left (table), compact preview on right. Used by Documents. */
.ech-split {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 1rem;
}

/* Inbox variant: compact list on left, wide reading pane on right. Used by Messages. */
.ech-split.ech-split-inbox {
    grid-template-columns: minmax(280px, 360px) 1fr;
}

@media (max-width: 1024px) {
    .ech-split,
    .ech-split.ech-split-inbox {
        grid-template-columns: 1fr;
    }
}

/* ── Preview panel ────────────────────────────────────────────────── */
.ech-preview-panel {
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    padding: 1.25rem;
    position: sticky;
    top: calc(52px + 1.25rem);
}

.ech-preview-label {
    font-size: .65rem;
    font-weight: 700;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: .2rem;
}

.ech-preview-value {
    font-size: .85rem;
    color: var(--ech-text, #1a1a2e);
    margin-bottom: .75rem;
}

/* ── Hero banner (EchHero) ────────────────────────────────────────── */
/* Shared between Portfolio, Trust, and any future "primary KPI" page.
   Use via the <EchHero /> component, not raw markup. */
.ech-hero-banner {
    background: linear-gradient(135deg, var(--ech-dark,#1A1A2E), var(--ech-dark2,#16213E));
    border-radius: 10px;
    padding: 1.5rem;
    color: white;
    margin-bottom: 1.25rem;
}

.ech-hero-banner-label {
    font-size: .75rem;
    color: rgba(255,255,255,.5);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: .2rem;
}

.ech-hero-banner-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
}

.ech-hero-banner-val {
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -.5px;
}

.ech-hero-banner-stats {
    display: flex;
    gap: 2rem;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255,255,255,.1);
}

.ech-hero-banner-stat-val {
    font-size: 1.1rem;
    font-weight: 700;
}

.ech-hero-banner-stat-label {
    font-size: .68rem;
    color: rgba(255,255,255,.45);
    text-transform: uppercase;
    letter-spacing: .4px;
}

@media (max-width: 768px) {
    .ech-hero-banner-val { font-size: 1.5rem; }
    .ech-hero-banner-stats { gap: 1rem; }
}

/* ── Empty state (EchEmptyState) ──────────────────────────────────── */
.ech-empty-state {
    text-align: center;
    color: #9ca3af;
    padding: 3rem 1rem;
}

.ech-empty-state-icon {
    opacity: .25;
    display: flex;
    justify-content: center;
    margin-bottom: .5rem;
}

.ech-empty-state-icon svg {
    width: 40px;
    height: 40px;
}

.ech-empty-state-title {
    font-size: .9rem;
    font-weight: 600;
    color: #6b7280;
    margin: 0 0 .25rem;
}

.ech-empty-state-subtitle {
    font-size: .82rem;
    margin: .25rem 0 0;
}

/* ── Modal ────────────────────────────────────────────────────────── */
/* The portal's shared message box (EchelonHeader) is a DevExpress modal inside dxbl-popup-cell (z-index 1050), which caps it below
   .ech-modal-overlay (2000), so an error raised from inside an echelon modal opened behind it and was never seen. Raising the cell
   (not the modal root, which is inside its stacking context) puts every DevExpress popup above the echelon modals. LW+CL:19.10.26 */
body:has(.ech-header) dxbl-popup-cell {
    z-index: 2100 !important;
}

.ech-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all .3s;
}

.ech-modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.ech-modal {
    background: white;
    border-radius: 10px;
    width: 550px;
    max-width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
}

.ech-modal-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ech-modal-title {
    font-size: .95rem;
    font-weight: 600;
}

.ech-modal-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    transition: background .2s;
    color: #6b7280;
    font-size: 1.2rem;
    background: none;
    border: none;
    font-family: inherit;
}

.ech-modal-close:hover {
    background: #f3f4f6;
}

.ech-modal-body {
    padding: 1.25rem;
}

.ech-modal-footer {
    padding: .75rem 1.25rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: .5rem;
}

/* ── Form elements ────────────────────────────────────────────────── */
.ech-form-group {
    margin-bottom: 1rem;
}

.ech-form-label {
    display: block;
    font-size: .75rem;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: .3rem;
}

.ech-form-input {
    width: 100%;
    padding: .55rem .8rem;
    border: 1.5px solid #e5e7eb;
    border-radius: 6px;
    font-size: .85rem;
    outline: none;
    transition: border-color .2s;
    font-family: inherit;
    background: white;
    color: var(--ech-text, #1a1a2e);
    box-sizing: border-box;
}

.ech-form-input:focus {
    border-color: var(--ech-accent,#11C683);
}

.ech-form-input[readonly] {
    background: #f9fafb;
}

textarea.ech-form-input {
    resize: vertical;
    min-height: 80px;
}

/* ── Upload zone ──────────────────────────────────────────────────── */
.ech-upload-zone {
    border: 2px dashed #e5e7eb;
    border-radius: 10px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all .2s;
    color: #6b7280;
    position: relative;
}

.ech-upload-zone:hover,
.ech-upload-zone.drag-over {
    border-color: var(--ech-accent,#11C683);
    background: color-mix(in srgb, var(--ech-accent,#11C683) 4%, transparent);
}

.ech-upload-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.ech-upload-file-list {
    margin-top: .75rem;
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.ech-upload-file-item {
    display: flex;
    align-items: center;
    gap: .4rem;
    font-size: .78rem;
    color: var(--ech-text, #1a1a2e);
    padding: .25rem .5rem;
    background: #f3f4f6;
    border-radius: 4px;
}

/* ── Animations ───────────────────────────────────────────────────── */
.ech-fade-in {
    animation: echFadeIn .3s ease;
}

@keyframes echFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Single shared pulse for all skeleton/placeholder blocks across Echelon. */
@keyframes echPulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: .5; }
}

/* ── Focus rings ──────────────────────────────────────────────────── */
/* Echelon doesn't use <button> for clickable rows — make sure keyboard
   users still get a visible focus indicator on every clickable surface. */
.ech-tbl-row:focus-visible,
.ech-msg-item:focus-visible,
.ech-req-item:focus-visible,
.ech-service-card:focus-visible,
.ech-entity-card:focus-visible,
.ech-tile-item:focus-visible,
.ech-esq-picker-row:focus-visible,
.ech-tab:focus-visible {
    outline: 2px solid var(--ech-accent,#11C683);
    outline-offset: 2px;
}
