/* ============================================
   XORA — Banking Dashboard Stylesheet
   Extends the Xora metallic chrome design system
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
    --bg: #050505;
    --bg-secondary: #0c0c0c;
    --surface: rgba(255, 255, 255, .03);
    --surface-hover: rgba(255, 255, 255, .06);
    --white: #f5f5f5;
    --dim: #999;
    --dim-light: #bbb;
    --accent: #e0e0e0;
    --accent-mid: #c0c0c0;
    --accent-end: #a0a0a0;
    --accent-glow: rgba(255, 255, 255, .12);
    --accent-dim: rgba(255, 255, 255, .05);
    --border: rgba(255, 255, 255, .08);
    --card: rgba(255, 255, 255, .025);
    --card-hover: rgba(255, 255, 255, .04);
    --green: #00d68f;
    --green-dim: rgba(0, 214, 143, .12);
    --red: #ff5252;
    --font: 'Outfit', -apple-system, sans-serif;
    --mono: 'JetBrains Mono', monospace;
    --gradient-text: linear-gradient(135deg, #fff 0%, #ccc 50%, #999 100%);
    --gradient-accent: linear-gradient(135deg, #fff, #ccc, #999);
    --sidebar-width: 240px;
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    background: var(--accent);
    color: #000;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--white);
    overflow-x: hidden;
    line-height: 1.6;
    display: flex;
    min-height: 100vh;
}

/* Ambient background */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -2;
    background:
        radial-gradient(ellipse 600px 400px at 20% 30%, rgba(255, 255, 255, .025) 0%, transparent 70%),
        radial-gradient(ellipse 500px 400px at 80% 70%, rgba(255, 255, 255, .03) 0%, transparent 70%);
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    background: rgba(8, 8, 8, .95);
    backdrop-filter: blur(24px);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: transform .3s cubic-bezier(.16, 1, .3, 1);
}

.sidebar-header {
    padding: 1.5rem 1.5rem 1rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--white);
    font-family: var(--mono);
    font-weight: 700;
    font-size: .85rem;
    letter-spacing: .2em;
}

.sidebar-logo:hover {
    opacity: .8;
}

.sidebar-logo-icon {
    width: 22px;
    height: 22px;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: .75rem 1.5rem;
    text-decoration: none;
    color: var(--dim);
    font-family: var(--mono);
    font-size: .85rem;
    letter-spacing: .12em;
    transition: all .3s;
    position: relative;
    border-left: 2px solid transparent;
}

.sidebar-item:hover {
    color: var(--white);
    background: rgba(255, 255, 255, .02);
    opacity: 1;
}

.sidebar-item.active {
    color: var(--white);
    background: rgba(255, 255, 255, .04);
    border-left-color: var(--accent);
}

.sidebar-icon {
    font-size: .85rem;
    width: 20px;
    text-align: center;
}

.sidebar-divider {
    height: 1px;
    background: var(--border);
    margin: .5rem 1.5rem;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
}

.sidebar-wallet {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--mono);
    font-size: .7rem;
    color: var(--dim);
    letter-spacing: .1em;
}

.sidebar-wallet-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 8px rgba(0, 214, 143, .4);
}

/* ===== MOBILE TOP BAR ===== */
.mobile-topbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    z-index: 200;
    background: rgba(8, 8, 8, .95);
    backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--border);
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
}

.mobile-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--white);
    font-family: var(--mono);
    font-weight: 700;
    font-size: .7rem;
    letter-spacing: .2em;
}

.mobile-menu-btn {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.mobile-menu-btn span {
    display: block;
    width: 20px;
    height: 1.5px;
    background: var(--white);
    transition: all .3s;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 2rem 3rem 3rem;
    width: calc(100% - var(--sidebar-width));
}

/* ===== TOPBAR ===== */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.topbar-title {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -.02em;
    margin-bottom: 2px;
}

.topbar-greeting {
    font-size: .85rem;
    color: var(--dim);
    font-weight: 300;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.topbar-price {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-family: var(--mono);
    font-size: .75rem;
    padding: .4rem .8rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.topbar-price-label {
    color: var(--dim);
    letter-spacing: .15em;
}

.topbar-price-value {
    font-weight: 700;
    color: var(--white);
}

.topbar-price-change {
    font-size: .7rem;
}

.topbar-price-change.positive {
    color: var(--green);
}

.topbar-price-change.negative {
    color: var(--red);
}

.topbar-notifications {
    position: relative;
    cursor: pointer;
}

.notif-bell {
    font-size: 1rem;
}

.notif-badge {
    position: absolute;
    top: -4px;
    right: -6px;
    background: var(--red);
    color: #fff;
    font-family: var(--mono);
    font-size: .65rem;
    font-weight: 700;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gradient-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--mono);
    font-size: .75rem;
    font-weight: 700;
    color: #000;
}

/* ===== QUICK ACTIONS ===== */
.quick-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 2rem;
}

.quick-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: .6rem 1.2rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--white);
    font-family: var(--mono);
    font-size: .7rem;
    letter-spacing: .12em;
    cursor: pointer;
    transition: all .3s;
}

.quick-btn:hover {
    border-color: rgba(255, 255, 255, .1);
    background: var(--card-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
}

.quick-icon {
    font-size: .85rem;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: rgba(255, 255, 255, .06);
}

/* ===== CARDS ===== */
.cards-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 1.5rem;
}

.dash-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    transition: all .4s cubic-bezier(.16, 1, .3, 1);
}

.dash-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, .02) 40%, rgba(255, 255, 255, .05) 50%, rgba(255, 255, 255, .02) 60%, rgba(255, 255, 255, 0) 100%);
    opacity: 0;
    transition: opacity .5s;
}

.dash-card:hover::before {
    opacity: 1;
}

.dash-card:hover {
    border-color: rgba(255, 255, 255, .08);
    box-shadow: 0 16px 48px rgba(0, 0, 0, .3);
}

.card-label {
    font-family: var(--mono);
    font-size: .65rem;
    letter-spacing: .25em;
    color: var(--dim);
    margin-bottom: .75rem;
}

.card-value {
    font-family: var(--mono);
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: .3rem;
}

.card-unit {
    font-size: .85rem;
    font-weight: 400;
    color: var(--dim);
}

.card-sub {
    font-family: var(--mono);
    font-size: .7rem;
    color: var(--dim);
    margin-bottom: .4rem;
}

.card-change {
    font-family: var(--mono);
    font-size: .7rem;
}

.card-change.positive {
    color: var(--green);
}

.card-change.negative {
    color: var(--red);
}

.yield-green {
    color: var(--green);
}

.card-apy {
    font-family: var(--mono);
    font-size: .85rem;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-apy-badge {
    font-size: .75rem;
    letter-spacing: .15em;
    padding: 2px 6px;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 3px;
    color: var(--accent);
}

/* Balance card accent glow */
.balance-card::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -30%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255, 255, 255, .05) 0%, transparent 70%);
    pointer-events: none;
}

/* ===== CHART + VAULT ROW ===== */
.chart-vault-row {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 16px;
    margin-bottom: 1.5rem;
}

.chart-card {
    padding: 1.5rem !important;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.chart-title {
    font-family: var(--mono);
    font-size: .7rem;
    letter-spacing: .2em;
    color: var(--dim);
}

.chart-tabs {
    display: flex;
    gap: 4px;
}

.chart-tab {
    font-family: var(--mono);
    font-size: .65rem;
    letter-spacing: .1em;
    padding: .35rem .6rem;
    background: none;
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--dim);
    cursor: pointer;
    transition: all .3s;
}

.chart-tab:hover {
    color: var(--white);
}

.chart-tab.active {
    background: rgba(255, 255, 255, .06);
    border-color: rgba(255, 255, 255, .1);
    color: var(--accent);
}

#portfolioChart {
    width: 100% !important;
    height: 220px !important;
    display: block;
}

/* ===== VAULT SUMMARY ===== */
.vault-summary-card {
    padding: 1.5rem !important;
}

.vault-summary-title {
    font-family: var(--mono);
    font-size: .7rem;
    letter-spacing: .2em;
    color: var(--dim);
    margin-bottom: 1rem;
}

.vault-position {
    padding: 1rem 0;
    border-top: 1px solid var(--border);
}

.vault-position:first-of-type {
    border-top: none;
    padding-top: 0;
}

.vault-pos-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: .6rem;
}

.vault-badge {
    font-family: var(--mono);
    font-size: .75rem;
    letter-spacing: .15em;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid;
}

.vault-badge.safe {
    color: var(--green);
    border-color: rgba(0, 214, 143, .3);
    background: rgba(0, 214, 143, .06);
}

.vault-badge.moderate {
    color: #ffa726;
    border-color: rgba(255, 167, 38, .3);
    background: rgba(255, 167, 38, .06);
}

.vault-badge.aggressive {
    color: var(--accent);
    border-color: rgba(255, 255, 255, .15);
    background: rgba(255, 255, 255, .05);
}

.vault-pos-name {
    font-family: var(--mono);
    font-size: .7rem;
    color: var(--dim-light);
    letter-spacing: .1em;
}

.vault-pos-details {
    margin-bottom: .5rem;
}

.vault-pos-row {
    display: flex;
    justify-content: space-between;
    font-family: var(--mono);
    font-size: .7rem;
    color: var(--dim);
    padding: 2px 0;
}

.vault-pos-row .green {
    color: var(--green);
}

.vault-pos-row .cyan {
    color: var(--accent);
}

.vault-pos-bar {
    height: 3px;
    background: rgba(255, 255, 255, .04);
    border-radius: 2px;
    overflow: hidden;
}

.vault-pos-fill {
    height: 100%;
    background: var(--green);
    border-radius: 2px;
    transition: width 1s ease;
}

.vault-pos-fill.moderate-fill {
    background: #ffa726;
}

.vault-pos-fill.aggressive-fill {
    background: var(--accent);
}

/* ===== TRANSACTION TABLE ===== */
.tx-card {
    padding: 1.5rem !important;
}

.tx-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: .5rem;
}

.tx-table-title {
    font-family: var(--mono);
    font-size: .7rem;
    letter-spacing: .2em;
    color: var(--dim);
}

.tx-filters {
    display: flex;
    gap: 4px;
}

.tx-filter {
    font-family: var(--mono);
    font-size: .65rem;
    letter-spacing: .1em;
    padding: .3rem .6rem;
    background: none;
    border: 1px solid transparent;
    border-radius: 4px;
    color: var(--dim);
    cursor: pointer;
    transition: all .3s;
}

.tx-filter:hover {
    color: var(--white);
}

.tx-filter.active {
    background: rgba(255, 255, 255, .06);
    border-color: rgba(255, 255, 255, .1);
    color: var(--accent);
}

.tx-table {
    width: 100%;
    border-collapse: collapse;
}

.tx-table th {
    font-family: var(--mono);
    font-size: .65rem;
    letter-spacing: .2em;
    color: var(--dim);
    text-align: left;
    padding: .6rem .5rem;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}

.tx-table td {
    font-family: var(--mono);
    font-size: .7rem;
    color: var(--dim-light);
    padding: .75rem .5rem;
    border-bottom: 1px solid rgba(255, 255, 255, .025);
    transition: background .2s;
}

.tx-table tr:hover td {
    background: rgba(255, 255, 255, .015);
}

.tx-type {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tx-type-icon {
    width: 20px;
    height: 20px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .7rem;
    flex-shrink: 0;
}

.tx-type-icon.deposit {
    background: rgba(0, 214, 143, .08);
    color: var(--green);
}

.tx-type-icon.withdrawal {
    background: rgba(255, 68, 68, .08);
    color: var(--red);
}

.tx-type-icon.yield {
    background: rgba(255, 255, 255, .06);
    color: var(--accent);
}

.tx-type-icon.transfer {
    background: rgba(255, 255, 255, .05);
    color: var(--accent-end);
}

.tx-amount.positive {
    color: var(--green);
    font-weight: 600;
}

.tx-amount.negative {
    color: var(--red);
    font-weight: 600;
}

.tx-status {
    font-size: .65rem;
    letter-spacing: .12em;
    padding: 3px 8px;
    border-radius: 3px;
    display: inline-block;
}

.tx-status.confirmed {
    background: rgba(0, 214, 143, .08);
    color: var(--green);
    border: 1px solid rgba(0, 214, 143, .15);
}

.tx-status.pending {
    background: rgba(255, 167, 38, .08);
    color: #ffa726;
    border: 1px solid rgba(255, 167, 38, .15);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .mobile-topbar {
        display: flex;
    }

    .main-content {
        margin-left: 0;
        padding: 70px 1rem 2rem;
    }

    .cards-row {
        grid-template-columns: 1fr;
    }

    .chart-vault-row {
        grid-template-columns: 1fr;
    }

    .topbar {
        flex-direction: column;
    }

    .quick-actions {
        flex-wrap: wrap;
    }

    .tx-filters {
        flex-wrap: wrap;
    }
}

@media (max-width: 600px) {
    .topbar-right {
        gap: .8rem;
    }

    .topbar-price {
        display: none;
    }

    .quick-btn span:not(.quick-icon) {
        display: none;
    }

    .quick-btn {
        padding: .6rem .8rem;
    }
}

/* ===== LUCIDE ICON SIZING ===== */
.sidebar-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

.quick-icon svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

.notif-bell svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

/* ===== API Status Banner ===== */
.api-status-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 16px;
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--dim-light);
    transition: opacity 0.5s ease;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #f59e0b;
    flex-shrink: 0;
    animation: pulse-dot 1.5s ease-in-out infinite;
}

@keyframes pulse-dot {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

#linkBankBtn {
    transition: border-color 0.3s ease, background 0.3s ease;
}

#linkBankBtn:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.3) !important;
}