/**
 * Confidence Card Display Fix
 * Ensures proper inline formatting for "Score X +Y%" display
 */

/* Confidence card header-left container */
[data-card="confidence"] .header-left {
    display: flex !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    gap: 8px !important;
}

/* Score display styling */
#confidence-score-display {
    display: inline !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    margin-right: 0 !important;
}

/* Change display styling */
#confidence-change-display {
    display: inline !important;
    font-weight: 500 !important;
    font-size: 12px !important;
    margin-left: 0 !important;
}

/* Ensure positive/negative colors work */
#confidence-change-display.positive {
    color: #10b981 !important;
}

#confidence-change-display.negative {
    color: #ef4444 !important;
}

/* Ensure text doesn't wrap */
[data-card="confidence"] .header-left * {
    white-space: nowrap !important;
}

/* ============================================
   FULL-WIDTH VOLATILITY GAUGE STYLING
   ============================================ */

/* Ensure the widget stays within the insight card */
.insight-card[data-card="volatility"] {
    position: relative;
    overflow: hidden;
}

.volatility-widget-container {
    width: 100%;
    padding: 4px 8px 8px 8px; /* Reduced padding to fit content */
    margin: 0;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
    contain: layout style;
    max-height: 150px; /* Constrain to card height */
}

.full-width-volatility-gauge {
    width: 100%;
    padding: 0;
    position: relative;
    max-width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden; /* Prevent content overflow */
}

/* Score Container - Compact for small card */
.score-container {
    text-align: center;
    margin-bottom: 6px;
    flex: 0 0 auto;
}

.main-score {
    font-size: 22px; /* Further reduced for compact display */
    font-weight: 700;
    color: #ffffff;
    line-height: 1;
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
    letter-spacing: -0.5px;
    margin-bottom: 1px;
}

.score-label {
    font-size: 11px; /* Reduced for compact display */
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #10b981;
    opacity: 0.9;
    margin-bottom: 1px;
}

.score-range {
    font-size: 10px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 0.2px;
}

/* Professional Bar Container */
.professional-bar-container {
    position: relative;
    margin: 4px 0;
    width: 100%;
    box-sizing: border-box;
    flex: 0 0 auto; /* Ensure it maintains its size */
}

/* Zone Labels */
.zone-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
    padding: 0 2px; /* Small padding to keep labels inside */
}

.zone-calm {
    font-size: 9px; /* Reduced size */
    font-weight: 700;
    color: #059669;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    opacity: 0.8;
}

.zone-volatile {
    font-size: 9px; /* Reduced size */
    font-weight: 700;
    color: #dc2626;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    opacity: 0.8;
}

/* Precision Bar Track - 80% thinner */
.precision-bar-track {
    position: relative;
    height: 6px; /* 80% reduction from 30px */
    border-radius: 3px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 
        inset 0 1px 2px rgba(0, 0, 0, 0.4),
        0 1px 3px rgba(0, 0, 0, 0.15);
    width: calc(100% - 4px); /* Ensure it fits within padding */
    box-sizing: border-box;
    margin: 0 2px; /* Small margin from edges */
}

/* Gradient Background */
.gradient-background {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        #059669 0%,
        #10b981 20%,
        #22c55e 30%,
        #fbbf24 45%,
        #f59e0b 55%,
        #ea580c 70%,
        #dc2626 85%,
        #b91c1c 100%
    );
    position: relative;
}

.gradient-background::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, 
        rgba(255, 255, 255, 0.15) 0%,
        rgba(255, 255, 255, 0.05) 50%,
        rgba(0, 0, 0, 0.1) 100%
    );
}

/* Precision Position Indicator */
.precision-indicator {
    position: absolute;
    top: -3px; /* Adjusted for 6px bar height */
    transform: translateX(-50%);
    z-index: 2;
    transition: left 1s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.indicator-needle {
    width: 2px; /* Thin needle */
    height: 12px; /* Much shorter for thin bar */
    background: linear-gradient(180deg, #ffffff 0%, #e5e7eb 100%);
    border-radius: 1px;
    margin: 0 auto;
    box-shadow: 
        0 0 4px rgba(255, 255, 255, 0.5),
        0 1px 2px rgba(0, 0, 0, 0.3);
    position: relative;
}

.indicator-dot {
    width: 6px;
    height: 6px;
    background: #ffffff;
    border: 1.5px solid #1e293b;
    border-radius: 50%;
    position: absolute;
    top: 3px; /* Centered on thin bar */
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 
        0 0 3px rgba(255, 255, 255, 0.4),
        0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Remove position label - no longer needed */

/* Precision Scale */
.precision-scale {
    position: relative;
    height: 20px;
    margin-top: 4px;
    padding: 0 2px; /* Keep scale within bounds */
}

/* Major Tick Marks */
.major-tick {
    position: absolute;
    transform: translateX(-50%);
    text-align: center;
}

.major-tick .tick-line {
    width: 1px;
    height: 8px;
    background: rgba(255, 255, 255, 0.5);
    margin: 0 auto 1px;
}

.major-tick .tick-label {
    font-size: 11px; /* Increased for better visibility */
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    font-family: 'SF Mono', 'Monaco', monospace;
}

/* Adjust positioning to keep numbers within bounds */
.major-tick:first-child {
    left: 4px !important; /* Move 0 closer to edge */
    transform: none;
}

.major-tick:last-child {
    left: auto !important;
    right: 2px !important; /* Move 100 closer to edge but prevent cutoff */
    transform: none;
}

/* Minor Tick Marks */
.minor-tick {
    position: absolute;
    transform: translateX(-50%);
}

.minor-tick .tick-line {
    width: 1px;
    height: 5px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 auto;
}

/* Professional Timestamp */
.update-timestamp {
    text-align: center;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 500;
    margin-top: 4px;
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
    letter-spacing: 0.2px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .volatility-widget-container {
        padding: 4px 6px 6px 6px;
        max-height: 140px;
    }
    
    .main-score {
        font-size: 20px;
    }
    
    .precision-bar-track {
        height: 28px;
    }
    
    .indicator-needle {
        height: 38px;
    }
    
    .indicator-dot {
        top: 26px;
        width: 7px;
        height: 7px;
    }
    
    .major-tick .tick-label {
        font-size: 8px;
    }
}

/* Hover Effects */
.full-width-volatility-gauge:hover .precision-bar-track {
    box-shadow: 
        inset 0 1px 3px rgba(0, 0, 0, 0.5),
        0 3px 12px rgba(0, 0, 0, 0.2);
}

.full-width-volatility-gauge:hover .indicator-needle {
    box-shadow: 
        0 0 12px rgba(255, 255, 255, 0.8),
        0 3px 8px rgba(0, 0, 0, 0.5);
}