/* 
 * Premium Market Dashboard CSS
 * Institutional Grade Fintech UI inspired by Apple Stocks & TradingView
 */

.sf-market-dashboard-section {
    padding: 80px 0;
    background: #010405;
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

/* Background Atmosphere */
.sf-market-dashboard-section::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, rgba(35, 219, 224, 0.05) 0%, transparent 70%);
    border-radius: 50%;
    z-index: -1;
    pointer-events: none;
}

.sf-dashboard-container {
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 24px;
}

.sf-dashboard-header-title {
    font-family: var(--sf-font-heading, sans-serif);
    color: #fff;
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sf-dashboard-header-title i {
    color: #23dbe0;
}

/* ── Grid Layout ── */
.sf-market-grid {
    display: grid;
    grid-template-columns: 2.2fr 1fr;
    gap: 24px;
    align-items: start;
}

/* ── Shared Glassmorphism Panel ── */
.sf-glass-panel {
    background: rgba(10, 15, 20, 0.6);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.02);
    overflow: hidden;
    position: relative;
}

/* ── Main Chart Area ── */
.sf-chart-card {
    display: flex;
    flex-direction: column;
    min-height: 520px;
}

.sf-chart-header {
    padding: 24px 32px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.sf-asset-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sf-asset-name {
    font-family: var(--sf-font-heading, sans-serif);
    font-size: 24px;
    font-weight: 800;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sf-market-pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.6);
    animation: sf-pulse 2s infinite;
}

@keyframes sf-pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.sf-asset-status {
    font-size: 11px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
}

.sf-asset-price-box {
    text-align: right;
}

.sf-live-price {
    font-family: var(--sf-font-heading, sans-serif);
    font-size: 32px;
    font-weight: 800;
    color: #ffffff;
    line-height: 1;
    margin-bottom: 6px;
    transition: color 0.3s;
}

.sf-live-change {
    font-size: 15px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background 0.3s, color 0.3s;
}

.sf-live-change.positive {
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.sf-live-change.negative {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.sf-chart-toolbar {
    padding: 12px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}

.sf-timeframe-tabs {
    display: flex;
    gap: 8px;
    background: rgba(0, 0, 0, 0.2);
    padding: 4px;
    border-radius: 10px;
}

.sf-timeframe-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.sf-timeframe-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}

.sf-timeframe-btn.active {
    background: #1e293b;
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.sf-chart-container {
    flex-grow: 1;
    position: relative;
    padding: 20px;
    min-height: 400px;
}

#sf-tv-chart {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.sf-chart-loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 15, 20, 0.8);
    backdrop-filter: blur(4px);
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.sf-chart-loader.active {
    opacity: 1;
    pointer-events: all;
}

.sf-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(35, 219, 224, 0.1);
    border-top-color: #23dbe0;
    border-radius: 50%;
    animation: sf-spin 1s linear infinite;
}

@keyframes sf-spin { to { transform: rotate(360deg); } }

/* ── Sidebar ── */
.sf-market-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Asset Selector List */
.sf-asset-selector {
    padding: 12px;
}

.sf-asset-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sf-asset-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.sf-asset-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.sf-asset-item.active {
    background: linear-gradient(135deg, rgba(35, 219, 224, 0.1), rgba(16, 185, 129, 0.02));
    border-color: rgba(35, 219, 224, 0.2);
}

.sf-asset-item-name {
    font-weight: 700;
    color: #e2e8f0;
    font-size: 14px;
}

.sf-asset-item.active .sf-asset-item-name {
    color: #23dbe0;
}

.sf-asset-item-price {
    font-weight: 600;
    color: #94a3b8;
    font-size: 14px;
}

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

.sf-stat-box {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sf-stat-label {
    font-size: 12px;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sf-stat-value {
    font-size: 15px;
    color: #e2e8f0;
    font-family: var(--sf-font-heading, sans-serif);
    font-weight: 700;
}

.sf-stat-value.highlight {
    color: #ffffff;
}

/* Sidebar CTAs */
.sf-sidebar-ctas {
    padding: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sf-btn-market {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sf-btn-market-primary {
    background: linear-gradient(135deg, #23dbe0, #10b981);
    color: #040f10 !important;
}

.sf-btn-market-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(35, 219, 224, 0.3);
}

.sf-btn-market-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.sf-btn-market-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Flash Animations for Price Updates */
@keyframes flashGreen {
    0% { background-color: rgba(16, 185, 129, 0.4); }
    100% { background-color: transparent; }
}

@keyframes flashRed {
    0% { background-color: rgba(239, 68, 68, 0.4); }
    100% { background-color: transparent; }
}

.flash-up {
    animation: flashGreen 1s ease-out;
}

.flash-down {
    animation: flashRed 1s ease-out;
}

/* ── Responsiveness ── */
@media (max-width: 991px) {
    .sf-market-grid {
        grid-template-columns: 1fr;
    }
    
    .sf-chart-card {
        min-height: 480px;
    }
    
    .sf-dashboard-header-title {
        font-size: 24px;
    }
    
    .sf-stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 767px) {
    .sf-market-dashboard-section {
        padding: 40px 0;
    }

    .sf-chart-header {
        flex-direction: column;
        gap: 16px;
        padding: 20px;
    }
    
    .sf-asset-price-box {
        text-align: left;
    }
    
    .sf-chart-toolbar {
        padding: 12px 20px;
        overflow-x: auto;
    }
    
    .sf-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ── Market Insights Slider ── */
.sf-market-tips-container {
    margin-top: 24px;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.sf-tips-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(35, 219, 224, 0.1);
    color: #23dbe0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    box-shadow: 0 0 16px rgba(35, 219, 224, 0.2);
}

.sf-tips-slider {
    flex-grow: 1;
    position: relative;
    height: 48px; /* Fixed height to accommodate multiline text if needed */
    overflow: hidden;
    display: flex;
    align-items: center;
}

.sf-tip-slide {
    position: absolute;
    width: 100%;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
    color: #94a3b8;
    font-size: 14px;
    line-height: 1.5;
    pointer-events: none;
}

.sf-tip-slide.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.sf-tip-slide strong {
    color: #e2e8f0;
    font-weight: 700;
}

@media (max-width: 767px) {
    .sf-market-tips-container {
        align-items: flex-start;
    }
    .sf-tips-slider {
        height: 60px; /* More height on mobile */
    }
    .sf-tip-slide {
        font-size: 13px;
    }
}
