/* usdzar-market-styles.css */
/* Styles for USDZAR Market Information page that integrates with the main platform */

/* Hide only the components container when market info page is active, KEEP the header visible */
.main-content.market-info-active .components-container {
    display: none;
}

/* Market Info Page Container - adjusted to work with existing header */
.market-info-page {
    display: none; /* Hidden by default */
    width: 100%;
    height: calc(100% - 70px); /* Account for header height */
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 100%);
    color: #ffffff;
    overflow-y: auto;
    padding: 15px; /* Reduced padding */
    margin-top: 0; /* No top margin since header is above */
}

.market-info-page.active {
    display: block;
}

/* Minimal scrollbar for market info page */
.market-info-page::-webkit-scrollbar {
    width: 8px;
    height: 8px;
    background-color: transparent;
}

.market-info-page::-webkit-scrollbar-track {
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.market-info-page::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.market-info-page::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.market-info-container {
    max-width: 95%; /* Increased from 1400px to use 95% of available width */
    margin: 0 auto;
    width: 100%;
}

/* Market Info Header */
.market-info-header {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 25px; /* Slightly reduced */
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.market-info-header h1 {
    font-size: 28px;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #4f9cf9, #87ceeb);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.market-header-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.market-current-rate {
    font-size: 18px;
    font-weight: bold;
    color: #87ceeb;
}

.market-last-updated {
    color: #888;
    font-size: 14px;
}

/* Grid System - Wider gaps and better utilization */
.market-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px; /* Reduced gap to use more space */
    margin-bottom: 20px; /* Reduced margin */
}

.market-col-1 {
    grid-column: span 1;
}

.market-col-2 {
    grid-column: span 2;
}

.market-col-3 {
    grid-column: span 3;
}

.market-card {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    padding: 20px; /* Slightly reduced padding */
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.3s ease;
    width: 100%; /* Ensure full width usage */
}

.market-card:hover {
    transform: translateY(-5px);
    border-color: rgba(135, 206, 235, 0.3);
}

.market-card h3 {
    margin-bottom: 15px; /* Reduced margin */
    color: #87ceeb;
    font-size: 18px;
    border-bottom: 2px solid rgba(135, 206, 235, 0.3);
    padding-bottom: 8px; /* Reduced padding */
}

/* Market Flow Analysis */
.market-flow-indicator {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0px;
    padding: 8px 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
}

.market-flow-side {
    text-align: center;
    flex: 1;
}

.market-flow-label {
    font-size: 12px;
    color: #888;
    text-transform: uppercase;
}

.market-flow-value {
    font-size: 20px;
    font-weight: bold;
    margin: 5px 0;
}

.market-flow-percentage {
    font-size: 14px;
}

.market-lhs {
    color: #4CAF50;
}

.market-rhs {
    color: #f44336;
}

.market-flow-arrow {
    font-size: 24px;
    color: #87ceeb;
    margin: 0 20px;
}

/* Sentiment Gauge - Bigger gauge positioned lower */
.market-sentiment-gauge {
    position: relative;
    width: 400px; /* Increased size */
    height: 210px; /* Increased height */
    margin: 5px auto 5px auto; /* Moved lower with more top margin, less bottom */
}



.market-gauge-labels {
    display: flex;
    justify-content: space-between;
    margin: 8px 0 5px 0;
    font-size: 12px;
    color: #888;
    padding: 0 30px;
}

.market-sentiment-text {
    text-align: center;
    margin-top: 20px; /* Increased margin to prevent overlap */
    color: #4CAF50;
    font-weight: bold;
    font-size: 13px;
}

/* Trading Volume - Match button size to Spread Analysis */
.market-time-period-tabs {
    display: flex;
    gap: 8px; /* Reduced gap */
    margin-bottom: 15px;
}

.market-tab {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #888;
    padding: 6px 12px; /* Reduced from 8px 16px to match spread analysis buttons */
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 12px; /* Slightly smaller to match */
}

.market-tab.active {
    background: linear-gradient(135deg, #4f9cf9, #87ceeb);
    color: white;
    border-color: transparent;
}

.market-tab:hover:not(.active) {
    background: rgba(255, 255, 255, 0.1);
}

.market-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin: 12px 0; /* Reduced margin */
}

.market-stat-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 12px;
    border-radius: 8px;
    text-align: center;
}

.market-stat-value {
    font-size: 18px;
    font-weight: bold;
    color: #87ceeb;
    margin-bottom: 5px;
}

.market-stat-label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
}

/* Volume Chart - Better utilization */
.market-volume-chart {
    height: 140px; /* Slightly reduced */
    margin: 12px 0; /* Reduced margin */
}

.market-chart-bars {
    display: flex;
    align-items: flex-end;
    height: 110px; /* Slightly reduced */
    gap: 6px;
}

.market-bar {
    flex: 1;
    background: linear-gradient(to top, #4f9cf9, #87ceeb);
    border-radius: 3px 3px 0 0;
    min-height: 8px;
    position: relative;
    transition: all 0.3s ease;
}

.market-bar:hover {
    background: linear-gradient(to top, #87ceeb, #add8e6);
    transform: scaleY(1.05);
}

.market-bar-label {
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    color: #888;
}

.market-bar-value {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 8px;
    color: #fff;
    white-space: nowrap;
}

/* Volatility */
.market-vol-current {
    text-align: center;
    margin-bottom: 15px; /* Reduced margin */
}

.market-vol-value {
    font-size: 32px;
    font-weight: bold;
    color: #FFC107;
    margin-bottom: 8px;
}

.market-vol-label {
    color: #888;
    font-size: 13px;
}

.market-percentile-bar {
    height: 12px;
    background: linear-gradient(to right, 
        #4CAF50 0%, #4CAF50 20%, 
        #FFC107 20%, #FFC107 50%, 
        #FF9800 50%, #FF9800 80%, 
        #f44336 80%, #f44336 100%);
    border-radius: 6px;
    position: relative;
    margin: 12px 0; /* Reduced margin */
}

.market-percentile-fill {
    height: 100%;
    width: 68%;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    position: relative;
}

.market-percentile-fill::after {
    content: '';
    position: absolute;
    right: -2px;
    top: -4px;
    width: 4px;
    height: 20px;
    background: white;
    border-radius: 2px;
}

.market-percentile-labels {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: #888;
    margin-bottom: 5px;
}

.market-percentile-text {
    text-align: center;
    font-size: 12px;
    color: #87ceeb;
    font-weight: bold;
}

.market-vol-tenor-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px; /* Reduced gap */
    margin: 12px 0; /* Reduced margin */
}

.market-vol-tenor-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 10px; /* Reduced padding */
    border-radius: 8px;
    text-align: center;
}

.market-vol-tenor-label {
    font-size: 11px;
    color: #888;
    margin-bottom: 5px;
}

.market-vol-tenor-value {
    font-size: 16px;
    font-weight: bold;
    color: #FFC107;
    margin-bottom: 5px;
}

.market-vol-tenor-change {
    font-size: 11px;
    font-weight: bold;
}

.market-vol-tenor-change.positive {
    color: #4CAF50;
}

.market-vol-tenor-change.negative {
    color: #f44336;
}

/* Tables - Better width utilization with larger font size */
.market-tenor-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 13px; /* Increased from 12px */
}

.market-tenor-table th,
.market-tenor-table td {
    padding: 10px 8px; /* Increased padding for better readability */
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 13px; /* Increased from 12px */
}

.market-tenor-table th {
    background: rgba(255, 255, 255, 0.1);
    color: #87ceeb;
    font-weight: bold;
}

.market-tenor-table tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Spread Analysis - Fixed chart sizing and button styling */
.market-timeframe-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #888;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 5px;
    font-size: 12px;
}

.market-timeframe-btn.active {
    background: linear-gradient(135deg, #4f9cf9, #87ceeb);
    color: white;
    border-color: transparent;
}

.market-timeframe-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.1);
}

.market-spread-chart {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    padding: 10px 15px; /* Reduced top/bottom padding */
    margin: 12px 0;
    height: 220px; /* Increased height even more */
}

.market-spread-svg {
    width: 100%;
    height: 180px; /* Much larger to fill the space */
}

/* Spread values grid - 2x2 configuration like intraday distribution */
.market-spread-values-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* Changed to 2 columns for 2x2 layout */
    gap: 8px;
    margin-top: 15px;
}

.market-spread-value-box {
    background: rgba(255, 255, 255, 0.05); /* Same background as session stats */
    padding: 12px;
    border-radius: 6px;
    text-align: center;
    font-size: 11px;
}

/* Intraday Volume Distribution */
.market-intraday-container {
    padding: 4px 0; /* Reduced from 8px to save space */
}

.market-timezone-legend {
    display: flex;
    justify-content: space-between;
    margin: 6px 0 8px 0; /* Reduced top/bottom margins */
    font-size: 11px; /* Slightly smaller */
    color: #888;
    padding: 0 30px;
}


.market-timezone-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.market-timezone-color {
    width: 16px;
    height: 12px;
    border-radius: 2px;
}

.market-intraday-chart-container {
    border-radius: 8px;
    padding: 10px 10px 20px 10px; /* Added extra bottom padding to match spread analysis */
    height: calc(100% - 50px); /* Adjusted to account for extra bottom padding */
    display: flex;
    flex-direction: column;
}

.market-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px; /* Reduced from 12px */
    flex-wrap: wrap;
    gap: 10px;
    flex-shrink: 0; /* Don't let header shrink */
}

.market-chart-title {
    font-size: 14px;
    color: #87ceeb;
    font-weight: bold;
}

.market-tenor-selector {
    display: flex;
    gap: 4px;
}

.market-tenor-select-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #888;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 10px;
}

.market-tenor-select-btn.active {
    background: linear-gradient(135deg, #4f9cf9, #87ceeb);
    color: white;
    border-color: transparent;
}

.market-tenor-select-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.1);
}

.market-intraday-bars-container {
    background: rgba(255, 255, 255, 0.02); /* MOVE THE BACKGROUND HERE */
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.market-intraday-bars {
    display: flex;
    align-items: flex-end;
    height: 100%; /* Use full available height instead of fixed 110px */
    min-height: 160px; /* Set a good minimum height */
    gap: 3px;
    padding: 0 5px;
}

.market-intraday-bar-group {
    flex: 1;
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    height: 100%;
}

.market-intraday-bar {
    width: 100%;
    border-radius: 3px 3px 0 0;
    min-height: 5px;
    position: relative;
    transition: all 0.3s ease;
    cursor: pointer;
    margin-bottom: 6px; /* Reduced margin */
}

.market-overlap-session {
    background: linear-gradient(to top, #FF6B6B, #FF8E53);
}

.market-london-session {
    background: linear-gradient(to top, #4ECDC4, #44A08D);
}

.market-us-session {
    background: linear-gradient(to top, #45B7D1, #2C5AA0);
}

.market-asia-session {
    background: linear-gradient(to top, #96CEB4, #FFECD2);
}

.market-intraday-bar:hover {
    transform: scaleY(1.05);
    opacity: 0.8;
}

.market-bar-tooltip {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 3px 6px;
    border-radius: 3px;
    font-size: 8px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.market-intraday-bar:hover .market-bar-tooltip {
    opacity: 1;
}

.market-bar-time {
    font-size: 9px;
    color: #888;
    text-align: center;
}

.market-session-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    flex-shrink: 0; /* Don't let stats shrink */
}

.market-session-stat {
    background: rgba(255, 255, 255, 0.05);
    padding: 6px; /* Reduced from 8px */
    border-radius: 6px;
    text-align: center;
}

.market-stat-session-label {
    font-size: 9px; /* Slightly smaller */
    color: #888;
    margin-bottom: 2px;
}

.market-stat-session-value {
    font-size: 12px; /* Slightly smaller */
    font-weight: bold;
    color: #87ceeb;
    margin-bottom: 2px;
}

.market-stat-session-time {
    font-size: 8px;
    color: #666;
}

/* Responsive - Updated breakpoints for wider layout */
@media (max-width: 1200px) {
    .market-info-container {
        max-width: 98%; /* Even wider on medium screens */
    }
    
    .market-row {
        gap: 15px; /* Reduced gap on smaller screens */
    }
}

@media (max-width: 1000px) {
    .market-row {
        grid-template-columns: 1fr 1fr;
    }
    
    .market-col-2 {
        grid-column: span 2;
    }
    
    .market-col-3 {
        grid-column: span 2;
    }
    
    .market-info-container {
        max-width: 98%;
    }
}

@media (max-width: 600px) {
    .market-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .market-col-1,
    .market-col-2,
    .market-col-3 {
        grid-column: span 1;
    }
    
    .market-info-page {
        padding: 10px;
    }
    
    .market-info-container {
        max-width: 100%;
    }
}