/* =====================================================
   MarketFlow Sidebar Styles
   Bitcoin Auto Trader - Dashboard UI
   ===================================================== */

/* -------------------- Layout -------------------- */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    /* margin-left removed for flex layout */
    transition: all 0.3s ease;
    min-width: 0;
}

.main-content.sidebar-collapsed {
    /* margin-left removed */
}

/* -------------------- Sidebar Base -------------------- */
.sidebar {
    position: sticky;
    height: 100vh;
    left: 0;
    top: 0;
    /* bottom removed */
    width: 240px;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease, transform 0.3s ease;
    overflow: hidden;
}

.sidebar.collapsed {
    width: 64px;
}

.sidebar.collapsed .sidebar-logo-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-arrow,
.sidebar.collapsed .nav-group-title,
.sidebar.collapsed .sidebar-version {
    opacity: 0;
    visibility: hidden;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 0.75rem;
}

.sidebar.collapsed .nav-item .nav-icon {
    margin-right: 0;
}

.sidebar.collapsed .nav-submenu {
    display: none;
}

/* -------------------- Sidebar Header -------------------- */
.sidebar-header {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.sidebar-logo-icon {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
    box-shadow: none;
}

.sidebar-logo-text {
    font-size: 1rem;
    font-weight: 700;
    background: linear-gradient(135deg, #f7931a 0%, #ffc107 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    white-space: nowrap;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.sidebar-toggle {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
}

.sidebar-toggle i {
    transition: transform 0.3s ease;
}

.sidebar.collapsed .sidebar-toggle i {
    transform: rotate(180deg);
}

/* -------------------- Navigation -------------------- */
.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.nav-group {
    margin-bottom: 1.5rem;
}

.nav-group-title {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.35);
    padding: 0 1rem;
    margin-bottom: 0.5rem;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.625rem 1rem;
    margin: 0.125rem 0.5rem;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.65);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.9);
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.05);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: #ffffff;
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
    border-radius: 0 2px 2px 0;
}

.nav-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.75rem;
    font-size: 0.9rem;
    flex-shrink: 0;
    transition: margin 0.2s ease;
}

.nav-label {
    flex: 1;
    white-space: nowrap;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.nav-arrow {
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.3);
    transition: transform 0.2s ease, opacity 0.2s ease, visibility 0.2s ease;
}

.nav-item.expanded .nav-arrow {
    transform: rotate(90deg);
}

/* -------------------- Submenu -------------------- */
.nav-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.nav-submenu.open {
    max-height: 500px;
}

.nav-submenu .nav-item {
    padding-left: 2.75rem;
    font-size: 0.8125rem;
}

.nav-submenu .nav-item::before {
    display: none;
}

.nav-submenu .nav-item.active {
    background: rgba(96, 165, 250, 0.1);
}

/* -------------------- Sidebar Footer -------------------- */
.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-version {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.3);
    text-align: center;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

/* -------------------- Phase Badges -------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.badge-breakout {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-near-pivot {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-approaching {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-accumulation {
    background: rgba(156, 163, 175, 0.2);
    color: #9ca3af;
    border: 1px solid rgba(156, 163, 175, 0.3);
}

/* -------------------- 2-Column Layout -------------------- */
.content-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
    gap: 1.5rem;
    height: calc(100vh - 180px);
    min-height: 600px;
}

.content-grid>* {
    min-width: 0;
    overflow: hidden;
}

.table-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chart-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
}

.panel-title {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
}

.panel-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.panel-content {
    flex: 1;
    overflow: auto;
}

/* -------------------- VCP Table -------------------- */
.vcp-table {
    width: 100%;
    border-collapse: collapse;
}

.vcp-table thead {
    position: sticky;
    top: 0;
    background: rgba(10, 10, 15, 0.95);
    z-index: 10;
}

.vcp-table th {
    padding: 0.75rem 0.5rem;
    text-align: left;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.vcp-table td {
    padding: 0.75rem 0.5rem;
    font-size: 0.8125rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.vcp-table tbody tr {
    cursor: pointer;
    transition: all 0.15s ease;
}

.vcp-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.vcp-table tbody tr.selected {
    background: rgba(96, 165, 250, 0.1);
}

.coin-cell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.coin-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
}

.coin-icon.eth {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.coin-icon.alt {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.coin-symbol {
    font-weight: 600;
    color: #fff;
}

.score-cell {
    font-weight: 700;
    font-family: 'SF Mono', 'Consolas', monospace;
}

.score-high {
    color: #10b981;
}

.score-medium {
    color: #f59e0b;
}

.score-low {
    color: #ef4444;
}

/* -------------------- Chart Panel -------------------- */
.chart-container-wrapper {
    flex: 1;
    min-height: 300px;
    position: relative;
}

.ai-analysis-section {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    max-height: 200px;
    overflow-y: auto;
}

.ai-analysis-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ai-analysis-content {
    font-size: 0.8125rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.75);
}

/* -------------------- Breadcrumb -------------------- */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.5);
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.breadcrumb-item a {
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb-item a:hover {
    color: #ffffff;
}

.breadcrumb-item.active {
    color: #fff;
    font-weight: 500;
}

.breadcrumb-separator {
    color: rgba(255, 255, 255, 0.25);
    font-size: 0.7rem;
}

/* -------------------- Mobile Responsive -------------------- */
@media (max-width: 1024px) {
    .content-grid {
        grid-template-columns: 1fr;
        height: auto;
    }

    .table-panel,
    .chart-panel {
        max-height: 500px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }

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

    .main-content {
        margin-left: 0;
    }

    .mobile-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }

    .mobile-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    .mobile-menu-btn {
        display: flex;
    }
}

@media (min-width: 769px) {

    .mobile-menu-btn,
    .mobile-overlay {
        display: none;
    }
}

/* -------------------- Animations -------------------- */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.nav-item {
    animation: slideIn 0.2s ease;
}

/* -------------------- Scrollbar -------------------- */
.panel-content::-webkit-scrollbar {
    width: 6px;
}

.panel-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

.panel-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.panel-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}