/* Two Column Layout - Stock Cards + Chart Panel */
.two-column-layout {
    display: flex;
    gap: 20px;
    padding: 20px;
    padding-left: 20px; /* Ensure left padding */
    max-width: 100%;
    margin: 0; /* Remove any auto margins */
    width: 100%;
    box-sizing: border-box;
    transition: margin-right 0.3s ease;
}

/* Ensure main content container doesn't center */
.main-content {
    width: 100%;
    margin: 0;
    padding: 0;
}

/* When sidebar is open, shrink the main content */
body:has(.sidebar.mobile-open) .two-column-layout {
    margin-right: 350px;
}

/* Left Column - Stock Cards (1/3 width on PC) */
.stock-cards-column {
    flex: 0 0 33.333%; /* 1/3 of the width */
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* Right Column - Chart Panel (2/3 width on PC) */
.chart-column {
    flex: 0 0 66.667%; /* 2/3 of the width */
    min-width: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 24px;
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    display: none; /* Hidden by default */
}

.chart-column.active {
    display: block;
}

/* Stock Grid */
.stock-grid {
    display: grid;
    grid-template-columns: 1fr; /* Single column for stock cards */
    gap: 16px;
}

/* Stock Card Styling - TradingView Style */
.stock-card {
    background: white;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    border: 1px solid #e0e3eb;
}

.stock-card:hover {
    border-color: #2962ff;
    box-shadow: 0 2px 8px rgba(41,98,255,0.1);
}

.stock-ticker {
    font-size: 15px;
    font-weight: 600;
    color: #131722;
    margin-bottom: 4px;
    letter-spacing: 0.3px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.stock-name {
    font-size: 13px;
    color: #787b86;
    margin-bottom: 12px;
    line-height: 1.3;
    font-weight: 400;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.stock-price {
    font-size: 20px;
    font-weight: 600;
    color: #131722;
    margin-bottom: 4px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    letter-spacing: -0.2px;
}

.stock-change {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 10px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.stock-change.positive {
    color: #089981;
}

.stock-change.negative {
    color: #f23645;
}

.stock-category {
    font-size: 11px;
    color: #787b86;
    padding: 4px 8px;
    background: #f7f8fa;
    border-radius: 4px;
    display: inline-block;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Chart Header */
.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #f0f0f0;
}

.chart-ticker {
    font-size: 24px;
    font-weight: 700;
    color: #333;
    margin-bottom: 8px;
}

.close-chart-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #f5f5f5;
    color: #666;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.close-chart-btn:hover {
    background: #ff3b30;
    color: white;
}

/* Time Range Buttons */
.time-range-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.time-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.time-btn:hover {
    background: #f5f5f5;
}

.time-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Main Chart */
.main-chart {
    width: 100%;
    height: 400px;
    margin-bottom: 24px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 8px;
}

.stat-label {
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: #333;
}

/* ============================================
   RESPONSIVE DESIGN - Mobile & Tablet
   ============================================ */

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) {
    .two-column-layout {
        flex-direction: column;
    }
    
    .stock-cards-column {
        flex: 1 1 100%;
    }
    
    .chart-column {
        flex: 1 1 100%;
        position: static;
        max-height: none;
    }
    
    .stock-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Remove sidebar margin adjustment on tablet */
    body:has(.sidebar.mobile-open) .two-column-layout {
        margin-right: 0;
    }
}

/* Mobile (below 768px) */
@media (max-width: 768px) {
    .two-column-layout {
        padding: 12px;
        gap: 12px;
    }
    
    .stock-grid {
        grid-template-columns: 1fr;
    }
    
    .chart-column {
        padding: 16px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .time-range-buttons {
        gap: 4px;
    }
    
    .time-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .main-chart {
        height: 300px;
    }
}

/* Small Mobile (below 480px) */
@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stock-ticker {
        font-size: 20px;
    }
    
    .stock-price {
        font-size: 24px;
    }
}
