:root {
    --bg-dark: #080808;
    --card-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --accent-blue: #00d2ff;
    --accent-purple: #9d50bb;
    --text-main: #e0e0e0;
    --text-muted: #888888;
    --positive: #00ff88;
    --negative: #ff4444;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow: hidden;
    height: 100vh;
    display: flex;
}

.glass-background {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 70% 30%, rgba(157, 80, 187, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 30% 70%, rgba(0, 210, 255, 0.1) 0%, transparent 50%);
    z-index: -1;
    filter: blur(100px);
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: rgba(10, 10, 10, 0.8);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    padding: 30px 20px;
}

.logo {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 2px;
    margin-bottom: 50px;
}

.logo span { color: var(--accent-blue); }

.nav-links {
    list-style: none;
    flex-grow: 1;
}

.nav-links li {
    margin-bottom: 15px;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 16px;
    display: block;
    padding: 12px 15px;
    border-radius: 12px;
    transition: all 0.3s;
}

.nav-links li.active a, .nav-links a:hover {
    background: var(--card-bg);
    color: var(--text-main);
    border: 1px solid var(--glass-border);
}

.user-profile {
    display: block;
    padding-top: 20px;
    border-top: 1px solid var(--glass-border);
}

.avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(45deg, var(--accent-blue), var(--accent-purple));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-right: 12px;
}

/* Content Area */
.content {
    flex-grow: 1;
    padding: 40px;
    overflow-y: auto;
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.main-header h1 span {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 400;
}

.indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    background: var(--positive);
    border-radius: 50%;
    margin-right: 8px;
}

.pulsing {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.5; }
    100% { transform: scale(1); opacity: 1; }
}

/* Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: auto 400px;
    gap: 30px;
}

.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 30px;
}

.stat-card .value {
    font-size: 32px;
    font-weight: 700;
    margin: 10px 0;
}

.positive { color: var(--positive); }

.main-chart {
    grid-column: span 2;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.chart-controls button {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 5px 12px;
    cursor: pointer;
    border-radius: 8px;
}

.chart-controls button.active {
    background: var(--card-bg);
    color: var(--text-main);
    border: 1px solid var(--glass-border);
}

.feed-items {
    margin-top: 20px;
}

.feed-item {
    margin-bottom: 20px;
    padding-left: 15px;
    border-left: 2px solid var(--accent-blue);
}

.feed-item.urgent { border-left: 2px solid var(--negative); }

.feed-item .time {
    font-size: 12px;
    color: var(--text-muted);
}

/* Voice Button */
.voice-assistant {
    position: fixed;
    bottom: 40px;
    right: 40px;
    background: linear-gradient(45deg, var(--accent-blue), var(--accent-purple));
    padding: 15px 25px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s;
}

.voice-assistant:hover { transform: translateY(-5px); }

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: #111;
    border: 1px solid var(--glass-border);
    padding: 40px;
    border-radius: 32px;
    text-align: center;
    max-width: 400px;
}

.qr-placeholder {
    width: 200px;
    height: 200px;
    background: white;
    margin: 20px auto;
    padding: 10px;
    border-radius: 12px;
}

.qr-placeholder img {
    width: 100%;
    height: 100%;
}

.action-btn {
    background: linear-gradient(45deg, var(--accent-blue), var(--accent-purple));
    border: none;
    color: white;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 20px;
}

/* Governance & RWA Cards */
.governance-grid, .rwa-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.proposal-card, .opportunity-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 25px;
    transition: transform 0.3s;
}

.proposal-card:hover, .opportunity-card:hover {
    transform: translateY(-5px);
}

.proposal-card h4, .opportunity-card h4 {
    margin-bottom: 10px;
    font-size: 18px;
}

.proposal-card p, .opportunity-card p {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 20px;
}

.vote-btns {
    display: flex;
    gap: 10px;
}

.vote-btn {
    flex: 1;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    background: transparent;
    color: var(--text-main);
    cursor: pointer;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(0, 210, 255, 0.2);
    border: 1px solid var(--accent-blue);
    border-radius: 4px;
    font-size: 10px;
    font-weight: 800;
    margin-left: 10px;
    vertical-align: middle;
    color: var(--accent-blue);
    letter-spacing: 1px;
}

.system-status span.pulsing {
    box-shadow: 0 0 10px var(--accent-blue);
}

.vote-btn.for { border-color: var(--positive); color: var(--positive); }
.vote-btn.against { border-color: var(--negative); color: var(--negative); }

/* Language Switcher */
.lang-btn {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.lang-btn:hover {
    background: rgba(255,255,255,0.05);
}

.lang-btn.active {
    background: var(--accent-blue);
    color: white;
    border-color: var(--accent-blue);
}

/* Guide Styles (Redesigned) */
.guide-nav-item {
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 12px 15px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
}

.guide-nav-item:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-main);
}

.guide-nav-item.active {
    background: var(--card-bg);
    color: var(--accent-blue);
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.guide-article h2 {
    color: var(--accent-blue);
    font-size: 32px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 15px;
}

.guide-article h3 {
    color: var(--accent-purple);
    margin: 30px 0 15px 0;
    font-size: 20px;
}

.guide-article p {
    line-height: 1.8;
    color: var(--text-muted);
    margin-bottom: 20px;
    font-size: 16px;
}

.guide-article ul {
    margin-bottom: 25px;
    list-style: none;
}

.guide-article li {
    margin-bottom: 15px;
    padding-left: 25px;
    position: relative;
    line-height: 1.6;
}

.guide-article li::before {
    content: '✦';
    position: absolute;
    left: 0;
    color: var(--accent-blue);
}

.tech-note {
    background: rgba(0, 210, 255, 0.05);
    border-left: 3px solid var(--accent-blue);
    padding: 20px;
    border-radius: 0 12px 12px 0;
    margin: 30px 0;
}
/* High-Density Layout & Ticker */
.market-ticker-container {
    flex: 1;
    margin: 0 40px;
    background: rgba(0,0,0,0.3);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    padding: 10px;
    overflow: hidden;
    white-space: nowrap;
}

.ticker-wrap {
    display: flex;
    gap: 30px;
    animation: ticker 30s linear infinite;
}

@keyframes ticker {
    0% { transform: translateX(100%); }
    100% { transform: translateX(-100%); }
}

.ticker-item {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
}

.ticker-item span.up { color: var(--positive); }
.ticker-item span.down { color: var(--negative); }

.dashboard-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 30px;
}

.stats-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.allocation-chart-container {
    height: 180px;
    position: relative;
    margin-top: 20px;
}

/* Sentiment Meter */
.sentiment-meter {
    margin-top: 20px;
}

.meter-bar {
    height: 8px;
    background: rgba(255,255,255,0.05);
    border-radius: 4px;
    overflow: hidden;
}

.meter-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-blue), var(--positive));
    box-shadow: 0 0 15px var(--accent-blue);
    transition: width 1s ease-in-out;
}

.meter-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1px;
}

.sentiment-desc {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 15px;
    line-height: 1.4;
}

.nav-icon {
    margin-right: 12px;
    font-size: 14px;
}

.header-auth {
    font-size: 11px;
    padding: 10px 20px;
    background: transparent;
    border: 1px solid var(--accent-blue);
    color: var(--accent-blue);
}

.header-auth:hover {
    background: var(--accent-blue);
    color: white;
}

/* AI Proposals */
.ai-proposals-card {
    background: linear-gradient(135deg, rgba(157, 80, 187, 0.05) 0%, rgba(0, 210, 255, 0.05) 100%);
    border: 1px solid var(--glass-border);
}

.proposals-list {
    margin-top: 25px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.proposal-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
}

.proposal-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--accent-blue);
    transform: translateX(5px);
}

.proposal-info h4 {
    color: var(--accent-blue);
    margin-bottom: 5px;
    font-size: 16px;
}

.proposal-info p {
    font-size: 13px;
    color: var(--text-muted);
    max-width: 500px;
}

.proposal-actions {
    display: flex;
    gap: 12px;
}

.action-btn.secondary {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-main);
}

.action-btn.secondary:hover {
    background: var(--card-bg);
}

/* Auth Logic & Locking */
.authenticated-only {
    position: relative;
    transition: filter 0.5s;
}

body:not(.is-sovereign) .authenticated-only {
    filter: blur(8px);
    pointer-events: none;
    user-select: none;
}

body:not(.is-sovereign) .authenticated-only::after {
    content: '🔒 REQUIRES SOVEREIGN LINK';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--accent-blue);
    color: white;
    padding: 8px 15px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 900;
    white-space: nowrap;
    z-index: 10;
}

.pro-badge {
    display: inline-block;
    background: var(--positive);
    color: black;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 900;
}

/* Intelligence Lab Scenarios */
.scenario-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.scenario-item {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s;
}

.scenario-item:hover, .scenario-item.active {
    background: rgba(0, 210, 255, 0.08);
    border-color: var(--accent-blue);
    transform: translateX(5px);
}

.scenario-item h4 {
    font-size: 14px;
    margin-bottom: 4px;
}

.scenario-item span {
    font-size: 11px;
    color: var(--text-muted);
}

.simulation-chart-container {
    padding: 20px;
}

/* Governance Grid */
.governance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-top: 25px;
}

.proposal-card h4 {
    color: var(--accent-blue);
    margin-bottom: 10px;
}

.vote-btns {
    display: flex;
    gap: 10px;
}

.vote-btn {
    flex: 1;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    background: transparent;
    color: var(--text-main);
    cursor: pointer;
    font-weight: 700;
    font-size: 12px;
}

.vote-btn.for { border-color: var(--positive); color: var(--positive); }
.vote-btn.against { border-color: var(--negative); color: var(--negative); }

.vote-btn:hover {
    background: rgba(255,255,255,0.05);
}
/* Search Box */
.search-box {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 8px 15px;
    gap: 10px;
    min-width: 300px;
}

.search-box input {
    background: transparent;
    border: none;
    color: white;
    outline: none;
    font-size: 13px;
    width: 100%;
}

/* Asset Table */
.asset-table-container {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 10px;
}

.asset-row {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    transition: all 0.3s;
    display: grid;
    grid-template-columns: 2fr 1fr 1.5fr 1.5fr 1fr;
    padding: 20px;
    align-items: center;
    margin-bottom: 10px;
}

.asset-row:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--accent-blue);
    transform: translateX(5px);
}

.asset-info h4 { margin: 0; font-size: 16px; }
.asset-info span { font-size: 10px; color: var(--text-muted); }

/* Sub Nav Tabs */
.sub-nav-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 10px 0;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    position: relative;
    transition: color 0.3s;
}

.sub-nav-btn.active {
    color: var(--accent-blue);
}

.sub-nav-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent-blue);
    box-shadow: 0 0 10px var(--accent-blue);
}

/* Strategy Rule Blocks */
.rule-blocks {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rule-block-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 15px;
    border-radius: 12px;
    font-size: 13px;
    cursor: grab;
    transition: all 0.2s;
}

.rule-block-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-purple);
}

.strategy-drop-zone {
    flex: 1;
    border: 2px dashed var(--glass-border);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 20px;
    overflow-y: auto;
}

.empty-hint {
    margin: auto;
    color: var(--text-muted);
    font-size: 14px;
    text-align: center;
}

.strategy-step {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-blue);
    box-shadow: 0 0 10px var(--accent-blue);
}

/* Premium Inputs & Selects */
select, input[type="number"], input[type="text"] {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: white;
    padding: 8px 12px;
    font-size: 12px;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: all 0.3s;
}

select:focus, input:focus {
    border-color: var(--accent-blue);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.2);
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='white' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

/* Section Spacing Fix */
section {
    padding-bottom: 80px !important; /* Ensure content doesn't hit the bottom */
}

.market-container {
    overflow-x: hidden; /* Prevent horizontal scroll on hover */
}

.asset-row {
    width: 100%;
    box-sizing: border-box;
}

.asset-row:hover {
    transform: translateX(3px); /* Subtle shift that doesn't break layout */
    background: rgba(255, 255, 255, 0.08);
}

.strategy-step select, .strategy-step input {
    font-size: 11px;
    padding: 4px 8px;
}

/* Multi-Broker Theme Extensions */
.is-sovereign-binance {
    --accent-blue: #F3BA2F; /* Binance Yellow */
    --accent-glow: rgba(243, 186, 47, 0.3);
}

.is-sovereign-kraken {
    --accent-blue: #5841D8; /* Kraken Purple */
    --accent-glow: rgba(88, 65, 216, 0.3);
}

.badge.broker-binance { background: #F3BA2F; color: #000; }
.badge.broker-kraken { background: #5841D8; color: #fff; }

/* Connection Lost State */
.broker-disconnected .trading-form-container {
    filter: grayscale(1) opacity(0.6);
    pointer-events: none;
    position: relative;
}

.broker-disconnected .trading-form-container::after {
    content: 'BROKER CONNECTION LOST';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #ff4b2b;
    color: white;
    padding: 10px 20px;
    border-radius: 4px;
    font-weight: 800;
    font-size: 14px;
    letter-spacing: 2px;
    z-index: 10;
}
/* --------------------------------------------------------- */
/* 16. Responsive Adaptation (Sovereign Flow)                */
/* --------------------------------------------------------- */

@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: 280px 1fr;
    }
}

@media (max-width: 992px) {
    body {
        flex-direction: column;
        overflow-y: auto;
        height: auto;
    }

    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--glass-border);
        padding: 15px 20px;
        position: sticky;
        top: 0;
        z-index: 100;
    }

    .logo { margin-bottom: 0; }
    .nav-links { display: none; } /* Mobile menu toggle would go here */
    
    .content {
        padding: 20px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }

    .main-column {
        grid-column: span 1;
    }

    .market-ticker-container {
        display: none;
    }
}

@media (max-width: 600px) {
    .main-header h1 { font-size: 20px; }
    
    .glass-card {
        padding: 20px;
    }

    .stat-card .value {
        font-size: 24px;
    }

    .proposal-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .proposal-actions {
        width: 100%;
    }

    .proposal-actions button {
        flex: 1;
        font-size: 11px;
    }

    .auth-container {
        padding: 0;
    }

    .auth-container h1 { font-size: 24px; }
    
    .connection-card img { width: 40px; }
    
    #authSection {
        padding: 20px;
        height: auto;
    }

    #authSection .auth-container > div:first-of-type {
        grid-template-columns: 1fr;
    }

    #authSection .auth-container > div:last-of-type {
        grid-template-columns: 1fr;
    }
    
    .voice-assistant {
        bottom: 20px;
        right: 20px;
        padding: 10px 15px;
        font-size: 12px;
    }
}
