/* =============================================================================
   Polymarket Analytics - Layout Styles
   Left Sidebar Navigation, Main Content, Charts Layout
============================================================================= */

/* ---------- CSS OVERRIDES FROM BASE ---------- */
:root {
    --sidebar-width: 220px;
    --sidebar-collapsed-width: 64px;
}

/* ---------- BODY LAYOUT ---------- */
body {
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ---------- SIDEBAR ---------- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: rgba(10, 14, 23, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px 12px 16px;
    z-index: 100;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Brand */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 8px 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
    flex-shrink: 0;
}

.brand-text-wrap {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.brand-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.03em;
}

.brand-accent { color: var(--accent); }

.brand-sub {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* Section labels */
.sidebar-section-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0 10px;
    margin: 12px 0 6px;
    white-space: nowrap;
    overflow: hidden;
    flex-shrink: 0;
}

/* Nav group */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

/* Sidebar buttons */
.sidebar-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    white-space: nowrap;
    overflow: hidden;
    text-align: left;
    position: relative;
}

.sidebar-btn svg {
    flex-shrink: 0;
    opacity: 0.7;
    transition: opacity var(--transition);
}

.sidebar-btn:hover {
    background: var(--bg-card);
    color: var(--text-secondary);
}

.sidebar-btn:hover svg {
    opacity: 1;
}

.sidebar-btn.active {
    background: var(--accent-light);
    color: var(--accent-hover);
    font-weight: 600;
}

.sidebar-btn.active svg {
    opacity: 1;
    color: var(--accent);
}

/* Active indicator bar */
.sidebar-btn.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--accent);
    border-radius: 0 2px 2px 0;
}

/* Bottom status */
.sidebar-bottom {
    flex-shrink: 0;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    margin-top: 8px;
}

.api-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--text-muted);
    padding: 6px 8px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: var(--transition);
    flex-shrink: 0;
}

.status-dot.online { background: var(--green); box-shadow: 0 0 8px var(--green); }
.status-dot.offline { background: var(--red); }
.status-dot.loading { background: var(--amber); animation: pulse 1s infinite; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ---------- MAIN CONTENT ---------- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 28px 32px 60px;
    min-height: 100vh;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- VIEWS ---------- */
.view {
    display: none;
    animation: fadeIn 0.3s ease;
}

.view.active { display: block; }

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

.view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ---------- CHARTS LAYOUT ---------- */
.charts-row {
    display: grid;
    gap: 20px;
    margin-bottom: 20px;
}

.chart-card.wide { grid-column: 1 / -1; }

.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 1100px) {
    .two-col { grid-template-columns: 1fr; }
}

/* ---------- TOAST ---------- */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    font-size: 0.85rem;
    color: var(--text-primary);
    animation: slideIn 0.3s ease;
    max-width: 360px;
}

.toast.success { border-color: var(--green); }
.toast.error { border-color: var(--red); }

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

/* ---------- UTILITY ---------- */
.hidden { display: none !important; }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-amber { color: var(--amber); }
.text-muted { color: var(--text-muted); }
.mono { font-family: 'JetBrains Mono', monospace; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 768px) {
    .sidebar {
        width: var(--sidebar-collapsed-width);
        padding: 16px 8px;
    }

    .brand-text-wrap { display: none; }
    .sidebar-section-label { display: none; }
    .sidebar-btn { padding: 10px; justify-content: center; }
    .sidebar-btn span { display: none; }
    .sidebar-bottom { display: none; }

    .main-content {
        margin-left: var(--sidebar-collapsed-width);
        padding: 20px 16px 60px;
    }
}
