/* ledgeriq3d.css - Shared 3D explorer modal for LedgerIQ */

.liq3d-is-open {
    overflow: hidden;
}

.liq3d-overlay {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(14px, 2vw, 28px);
    background: rgba(30, 38, 34, 0.52);
    animation: liq3dOverlayIn 160ms ease-out;
}

.liq3d-overlay[hidden] {
    display: none;
}

.liq3d-dialog {
    width: min(1180px, 100%);
    height: min(840px, calc(100vh - 32px));
    max-height: calc(100vh - 32px);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
    background: #fbfaf6;
    color: #24312c;
    border: 1px solid #dcd7c8;
    border-radius: 8px;
    box-shadow: 0 30px 86px rgba(24, 34, 29, 0.3);
    animation: liq3dDialogIn 180ms ease-out;
}

.liq3d-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 22px 24px 16px;
    border-bottom: 1px solid #e5e0d2;
    background: linear-gradient(180deg, #fffdf8 0%, #fbfaf6 100%);
}

.liq3d-heading {
    min-width: 0;
}

.liq3d-kicker {
    font-family: var(--liq-font-mono, 'JetBrains Mono', monospace);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
    color: #8b7b50;
    margin-bottom: 7px;
}

.liq3d-head h2 {
    margin: 0;
    font-family: var(--liq-font-display, 'Fraunces', Georgia, serif);
    font-size: clamp(1.35rem, 2vw, 1.9rem);
    line-height: 1.12;
    font-weight: 600;
    letter-spacing: 0;
    color: #1f2a25;
}

.liq3d-head p {
    margin: 8px 0 0;
    max-width: 76ch;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #65736d;
}

.liq3d-close {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border: 1px solid #d9d3c3;
    border-radius: 999px;
    background: #fff;
    color: #24312c;
    cursor: pointer;
    font-family: var(--liq-font-body, 'DM Sans', sans-serif);
    font-size: 1.1rem;
    line-height: 1;
}

.liq3d-close:hover,
.liq3d-close:focus-visible {
    border-color: #4a9080;
    color: #1c6c5c;
    outline: none;
    box-shadow: 0 0 0 3px rgba(74, 144, 128, 0.16);
}

.liq3d-body {
    display: grid;
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
    min-height: 0;
}

.liq3d-side {
    min-width: 0;
    padding: 18px 18px 20px 24px;
    border-right: 1px solid #e5e0d2;
    background: #f7f4ec;
    overflow: auto;
}

.liq3d-side-label {
    margin-bottom: 10px;
    font-family: var(--liq-font-mono, 'JetBrains Mono', monospace);
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
    color: #8b7b50;
}

.liq3d-metrics {
    display: grid;
    gap: 10px;
}

.liq3d-metric {
    padding: 11px 12px;
    border: 1px solid #e0dacb;
    border-radius: 8px;
    background: #fffdf8;
    box-shadow: inset 0 0 0 1px rgba(255, 253, 248, 0.7);
}

.liq3d-metric.positive {
    border-color: rgba(74, 144, 128, 0.38);
    background: #f4faf7;
}

.liq3d-metric.warning {
    border-color: rgba(168, 118, 46, 0.34);
    background: #fffaf0;
}

.liq3d-metric.negative {
    border-color: rgba(142, 70, 62, 0.34);
    background: #fff7f4;
}

.liq3d-metric span,
.liq3d-metric small {
    display: block;
    color: #77857f;
}

.liq3d-metric span {
    font-family: var(--liq-font-mono, 'JetBrains Mono', monospace);
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.liq3d-metric strong {
    display: block;
    margin-top: 4px;
    font-family: var(--liq-font-mono, 'JetBrains Mono', monospace);
    font-size: 1.02rem;
    line-height: 1.2;
    color: #22302b;
}

.liq3d-metric small {
    margin-top: 4px;
    font-size: 0.72rem;
    line-height: 1.35;
}

.liq3d-notes {
    margin-top: 18px;
}

.liq3d-notes-title {
    margin-bottom: 8px;
    font-family: var(--liq-font-mono, 'JetBrains Mono', monospace);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
    color: #8b7b50;
}

.liq3d-notes p {
    margin: 0 0 10px;
    font-size: 0.8rem;
    line-height: 1.55;
    color: #55645e;
}

.liq3d-stage {
    position: relative;
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    padding: 14px 16px 12px;
    background: #fbfaf6;
}

.liq3d-chart-frame {
    min-width: 0;
    min-height: 0;
    border: 1px solid #e2dccd;
    border-radius: 8px;
    background: #fffdf8;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
    overflow: hidden;
}

.liq3d-chart {
    min-width: 0;
    height: 100%;
    min-height: 464px;
}

.liq3d-chart .modebar {
    top: 8px !important;
    right: 8px !important;
}

.liq3d-chart .modebar-group {
    border: 1px solid #e3ddcf;
    border-radius: 7px;
    background: rgba(255, 253, 248, 0.94) !important;
}

.liq3d-chart .modebar-btn svg path {
    fill: #56665f !important;
}

.liq3d-chart .modebar-btn:hover svg path,
.liq3d-chart .modebar-btn.active svg path {
    fill: #1c6c5c !important;
}

.liq3d-loading {
    height: 100%;
    min-height: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    color: #68766f;
    text-align: center;
}

.liq3d-loading span {
    width: 38px;
    height: 38px;
    border: 1px solid #d8d0bf;
    border-top-color: #4a9080;
    border-radius: 999px;
    animation: liq3dSpin 800ms linear infinite;
}

.liq3d-loading strong {
    font-family: var(--liq-font-display, 'Fraunces', Georgia, serif);
    font-size: 1.05rem;
    font-weight: 600;
    color: #23302b;
}

.liq3d-loading small {
    font-size: 0.78rem;
    color: #7d8b85;
}

.liq3d-hint {
    justify-self: end;
    padding: 5px 8px;
    border: 1px solid #e5e0d2;
    border-radius: 999px;
    font-family: var(--liq-font-mono, 'JetBrains Mono', monospace);
    font-size: 0.58rem;
    letter-spacing: 0;
    text-transform: uppercase;
    color: #7d8b85;
    background: #fffdf8;
}

.liq3d-foot {
    min-height: 22px;
    padding: 8px 24px 12px;
    border-top: 1px solid #e5e0d2;
    font-size: 0.72rem;
    line-height: 1.4;
    color: #7d8b85;
    background: #fbfaf6;
}

.liq3d-unavailable {
    height: 100%;
    min-height: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
    color: #66756f;
}

.liq3d-unavailable strong {
    font-family: var(--liq-font-display, 'Fraunces', Georgia, serif);
    color: #24312c;
    font-size: 1.2rem;
}

.liq3d-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 32px;
    padding: 7px 12px;
    border: 1px solid #b9cfc5;
    border-radius: 8px;
    background: #f4faf7;
    color: #286f60;
    font-family: var(--liq-font-body, 'DM Sans', sans-serif);
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: border-color 120ms ease, color 120ms ease, background 120ms ease, transform 120ms ease;
}

.liq3d-action::before {
    content: "3D";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 18px;
    border-radius: 6px;
    background: #286f60;
    color: #fff;
    font-family: var(--liq-font-mono, 'JetBrains Mono', monospace);
    font-size: 0.58rem;
    letter-spacing: 0;
}

.liq3d-action:hover,
.liq3d-action:focus-visible {
    background: #e9f4ef;
    border-color: #4a9080;
    color: #174f44;
    outline: none;
    transform: translateY(-1px);
    box-shadow: 0 0 0 3px rgba(74, 144, 128, 0.12);
}

.liq3d-action:disabled {
    cursor: not-allowed;
    opacity: 0.48;
    background: #f6f3eb;
    border-color: #ded7c8;
    color: #8b978f;
    transform: none;
    box-shadow: none;
}

.liq3d-action:disabled::before {
    background: #9aa49d;
}

.cvp-chart-tools,
.rf2-chart-actions,
.cso-head-actions,
.sa-3d-actions,
.anx-head-side,
.ccc-3d-actions,
.expense-3d-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.rf2-chart-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 8px;
}

.cso-head-actions {
    margin-left: auto;
    justify-content: flex-end;
}

.cso-head-actions .liq3d-action {
    align-self: flex-start;
}

.sa-3d-actions {
    margin-left: auto;
}

.anx-head-side {
    align-items: flex-start;
    justify-content: flex-end;
}

.anx-head-side .liq3d-action {
    margin-top: 2px;
}

.ccc-3d-actions,
.expense-3d-actions {
    justify-content: flex-end;
}

.oe-actions .liq3d-action {
    min-height: 36px;
}

.expense-actions .liq3d-action {
    border-color: rgba(255, 253, 248, 0.26);
    background: rgba(255, 253, 248, 0.12);
    color: #fffdf8;
}

.expense-actions .liq3d-action::before {
    background: #fffdf8;
    color: #286f60;
}

.expense-actions .liq3d-action:hover,
.expense-actions .liq3d-action:focus-visible {
    border-color: rgba(255, 253, 248, 0.46);
    background: rgba(255, 253, 248, 0.2);
    color: #fffdf8;
}

@keyframes liq3dOverlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes liq3dDialogIn {
    from { opacity: 0; transform: translateY(8px) scale(0.99); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes liq3dSpin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .liq3d-overlay,
    .liq3d-dialog,
    .liq3d-loading span,
    .liq3d-action {
        animation: none;
        transition: none;
    }

    .liq3d-action:hover,
    .liq3d-action:focus-visible {
        transform: none;
    }
}

@media (max-width: 860px) {
    .liq3d-dialog {
        height: calc(100vh - 24px);
        max-height: calc(100vh - 24px);
    }

    .liq3d-head {
        padding: 18px 18px 14px;
    }

    .liq3d-body {
        grid-template-columns: 1fr;
        grid-template-rows: auto minmax(0, 1fr);
    }

    .liq3d-side {
        display: grid;
        grid-template-columns: 1fr;
        padding: 14px 18px;
        border-right: 0;
        border-bottom: 1px solid #e5e0d2;
        max-height: 220px;
    }

    .liq3d-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .liq3d-chart {
        min-height: 360px;
    }

    .rf2-chart-head,
    .cso-curve-head,
    .anx-head {
        align-items: flex-start;
    }
}

@media (max-width: 560px) {
    .liq3d-overlay {
        padding: 8px;
    }

    .liq3d-dialog {
        height: calc(100vh - 16px);
        max-height: calc(100vh - 16px);
    }

    .liq3d-head {
        padding: 16px 16px 12px;
    }

    .liq3d-head h2 {
        font-size: 1.45rem;
        line-height: 1.14;
    }

    .liq3d-head p {
        font-size: 0.88rem;
        line-height: 1.45;
    }

    .liq3d-close {
        width: 38px;
        height: 38px;
    }

    .liq3d-metrics {
        grid-template-columns: 1fr;
    }

    .liq3d-chart {
        min-height: 320px;
    }

    .liq3d-hint {
        justify-self: stretch;
        text-align: center;
    }
}
