/**
 * Enhanced Trade Rating Transitions CSS
 * Smooth animations and transitions for trade rating column updates
 * Provides visual feedback during randomized transition cycles
 */

/* Trade Rating Wrapper */
.trade-rating-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100% !important;
}

/* Trade Rating Transition Container - Gray background for progress bar track */
.trade-rating-cell .trade-rating-progress-container,
.trade-rating-progress-container.trade-rating-progress-container {
    position: relative;
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    height: 20px;
    background: rgba(50, 50, 50, 0.8) !important;
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    margin-bottom: 4px;
}

.trade-rating-cell .trade-rating-progress-container:hover,
.trade-rating-progress-container.trade-rating-progress-container:hover {
    background: transparent !important;
    border: none !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Progress Bar Base - High Specificity to Override Modular CSS */
.trade-rating-cell .trade-rating-progress-bar,
.trade-rating-progress-bar.trade-rating-progress-bar {
    height: 100%;
    transition: width 0.8s ease-in-out, background 0.8s ease-in-out;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    /* Dynamic gradient that shows color based on score value - will be set by JavaScript */
    background: var(--progress-color, #dc2626) !important;
    /* REMOVED: box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3); - was causing white overlay */
    max-width: 100%;
    /* Use CSS custom property set by JavaScript with fallback to 50% */
    width: var(--progress-width, 50%) !important;
}

/* Shimmer Effect for Progress Bars - DISABLED to remove white overlay */
/* .trade-rating-progress-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: shimmer 2s infinite;
} */

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

@keyframes trade-rating-shimmer {
    0% { 
        opacity: 0;
        transform: translateX(-100%);
    }
    50% { 
        opacity: 1;
        transform: translateX(0%);
    }
    100% { 
        opacity: 0;
        transform: translateX(100%);
    }
}

/* .trade-rating-shimmer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.3) 50%, transparent 100%);
    border-radius: 12px;
} */

/* DISABLED: trade-rating-shimmer to remove white overlay - progress bars now show clean colors */

/* Trade Rating Text Container */
.trade-rating-text-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
}

.trade-rating-label {
    font-size: 11px;
    font-weight: 600;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    transition: color 0.3s ease;
    line-height: 1.2;
    margin: 0;
}

/* =================================================================
   TRADE RATING LABEL COLORS - DIFFERENTIATE BY TRADING ACTION
   ================================================================= */

/* Strong Buy - Bright Green */
.trade-rating-cell .trade-rating-strong-buy .trade-rating-label,
.trade-rating-text-container.trade-rating-strong-buy .trade-rating-label {
    color: #00ff88 !important;
    font-weight: 700;
}

/* Buy - Medium Green */
.trade-rating-cell .trade-rating-buy .trade-rating-label,
.trade-rating-text-container.trade-rating-buy .trade-rating-label {
    color: #22c55e !important;
    font-weight: 700;
}

/* Hold - Yellow/Orange */
.trade-rating-cell .trade-rating-hold .trade-rating-label,
.trade-rating-text-container.trade-rating-hold .trade-rating-label {
    color: #fbbf24 !important;
    font-weight: 600;
}

/* Sell - Medium Red */
.trade-rating-cell .trade-rating-sell .trade-rating-label,
.trade-rating-text-container.trade-rating-sell .trade-rating-label {
    color: #ef4444 !important;
    font-weight: 700;
}

/* Strong Sell - Bright Red */
.trade-rating-cell .trade-rating-strong-sell .trade-rating-label,
.trade-rating-text-container.trade-rating-strong-sell .trade-rating-label {
    color: #dc2626 !important;
    font-weight: 700;
}

/* Fallback: Use text content-based selectors for broader compatibility */
.trade-rating-label[data-label="Strong Buy"] {
    color: #00ff88 !important;
    font-weight: 700;
}

.trade-rating-label[data-label="Buy"] {
    color: #22c55e !important;
    font-weight: 700;
}

.trade-rating-label[data-label="Hold"] {
    color: #fbbf24 !important;
    font-weight: 600;
}

.trade-rating-label[data-label="Sell"] {
    color: #ef4444 !important;
    font-weight: 700;
}

.trade-rating-label[data-label="Strong Sell"] {
    color: #dc2626 !important;
    font-weight: 700;
}

.trade-rating-score {
    font-size: 10px;
    font-weight: 600;
    color: #ffffff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    opacity: 1.0;
    transition: color 0.3s ease;
    line-height: 1.2;
    margin: 0;
}

/* Legacy Trade Rating Text Support */
.trade-rating-text {
    position: absolute;
    top: 50%;
    left: 8px;
    transform: translateY(-50%);
    font-size: 11px;
    font-weight: 600;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    z-index: 2;
    transition: color 0.3s ease;
}

/* Category Badge */
.trade-rating-category {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    font-size: 9px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.6);
    z-index: 2;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color 0.3s ease;
}

/* Transition Effects */
.trade-rating-progress-container.morphing {
    animation: ratingMorph 0.8s ease-in-out;
}

@keyframes ratingMorph {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(0.95); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

/* Transition Pulse Effect */
.trade-rating-progress-container.transition-pulse {
    animation: transitionPulse 1.2s ease-in-out;
}

@keyframes transitionPulse {
    0% { 
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4);
        transform: scale(1);
    }
    50% { 
        box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.1);
        transform: scale(1.02);
    }
    100% { 
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
        transform: scale(1);
    }
}

/* Coordinated Update Animation */
.trade-rating-cell.updating {
    animation: coordinatedUpdate 0.8s ease-in-out;
}

@keyframes coordinatedUpdate {
    0% { background-color: transparent; }
    50% { background-color: rgba(34, 197, 94, 0.1); }
    100% { background-color: transparent; }
}

/* Trade Rating Cell Enhancements */
.trade-rating-cell {
    position: relative;
    padding: 8px;
    text-align: center;
    vertical-align: middle;
}

/* Override any legacy background styles with maximum specificity */
.trade-rating-cell .trade-rating-progress-container,
td.trade-rating-cell .trade-rating-progress-container,
.trade-rating-cell > div > .trade-rating-progress-container {
    background: transparent !important;
    border: none !important;
}

/* Force override .progress class from modular CSS */
.trade-rating-cell .progress,
.trade-rating-cell .trade-rating-progress-container.progress {
    background-color: transparent !important;
    background: transparent !important;
    border: none !important;
}

/* Override any conflicting .progress-bar class from modular CSS */
.trade-rating-cell .progress-bar,
.trade-rating-cell .trade-rating-progress-bar.progress-bar {
    background: linear-gradient(90deg, #dc2626 0%, #f97316 25%, #eab308 50%, #84cc16 75%, #22c55e 100%) !important;
    transition: width 0.8s ease-in-out !important;
    border-radius: 12px !important;
    height: 100% !important;
}

/* CRITICAL: Fix for legacy trade rating structure - Force correct gradient on fill element */
.trade-rating-cell .trade-rating-fill {
    background: linear-gradient(90deg, #dc2626 0%, #f97316 25%, #eab308 50%, #84cc16 75%, #22c55e 100%) !important;
    background-size: 100% 100% !important;
    background-position: left center !important;
    background-repeat: no-repeat !important;
    transition: width 0.5s ease !important;
    border-radius: 8px !important;
    height: 100% !important;
}

/* ENHANCED: Use score-based colors for progress bar elements in trade rating cells */
.trade-rating-cell .progress-bar,
.trade-rating-cell [class*="progress-bar"],
.trade-rating-cell [class*="trade-rating-progress-bar"] {
    /* Background color will be set by JavaScript based on actual score */
    background: var(--progress-color, #dc2626) !important;
    height: 100% !important;
    border-radius: 8px !important;
    transition: width 0.8s ease-in-out, background 0.3s ease !important;
    /* REMOVED: Full gradient - now using score-based single colors */
}

/* Force gradient on direct progress bar div elements - DISABLED to avoid width conflicts */
/* .trade-rating-cell div[style*="width:"]:not(.trade-rating-text-container):not(.trade-rating-wrapper) {
    background: linear-gradient(90deg, #dc2626 0%, #f97316 25%, #eab308 50%, #84cc16 75%, #22c55e 100%) !important;
    background-size: 100% 100% !important;
    border-radius: 8px !important;
    height: 100% !important;
} */

/* Ensure container has transparent background for legacy structure */
.trade-rating-cell .trade-rating-progress-bar {
    /* Background color will be set by JavaScript based on score */
    background: var(--progress-color, #dc2626) !important;
    border-radius: 8px !important;
    height: 12px !important;
    /* REMOVED: width: 100% !important; - This was causing the bar to always fill completely */
    /* REMOVED: min-width: 100% !important; */
    /* REMOVED: max-width: 100% !important; */
    position: relative !important;
    overflow: hidden !important;
    transition: width 0.8s ease-in-out, background 0.3s ease !important;
}

.trade-rating-cell[data-transition-enabled="true"] {
    cursor: pointer;
}

.trade-rating-cell[data-transition-enabled="true"]:hover .trade-rating-progress-container {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

/* Loading State */
.trade-rating-progress-container.loading {
    animation: loadingPulse 1.5s ease-in-out infinite;
}

@keyframes loadingPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Error State */
.trade-rating-progress-container.error {
    background: rgba(220, 38, 38, 0.2);
    border-color: rgba(220, 38, 38, 0.4);
}

.trade-rating-progress-container.error .trade-rating-progress-bar {
    background: linear-gradient(90deg, #dc2626, #b91c1c);
}

/* High Priority Transition Glow */
.trade-rating-cell[data-priority="high"] .trade-rating-progress-container {
    animation: highPriorityGlow 2s ease-in-out infinite;
}

@keyframes highPriorityGlow {
    0%, 100% { 
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.3);
    }
    50% { 
        box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.1);
    }
}

/* Medium Priority Transition */
.trade-rating-cell[data-priority="medium"] .trade-rating-progress-container {
    animation: mediumPriorityGlow 3s ease-in-out infinite;
}

@keyframes mediumPriorityGlow {
    0%, 100% { 
        box-shadow: 0 0 0 0 rgba(234, 179, 8, 0.2);
    }
    50% { 
        box-shadow: 0 0 0 3px rgba(234, 179, 8, 0.1);
    }
}

/* Transition Progress Indicator */
.trade-rating-transition-progress {
    position: fixed;
    top: 10px;
    right: 10px;
    width: 200px;
    height: 6px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.trade-rating-transition-progress.active {
    opacity: 1;
}

.trade-rating-transition-progress::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: linear-gradient(90deg, #22c55e, #16a34a);
    border-radius: 3px;
    animation: progressFill 9.5s linear;
}

@keyframes progressFill {
    0% { width: 0%; }
    100% { width: 100%; }
}

/* Responsive Design */
@media (max-width: 768px) {
    .trade-rating-progress-container {
        width: 100% !important;
        height: 20px;
    }
    
    .trade-rating-text {
        font-size: 10px;
        left: 6px;
    }
    
    .trade-rating-category {
        font-size: 8px;
        right: 4px;
    }
}

/* Dark Mode Enhancements */
@media (prefers-color-scheme: dark) {
    .trade-rating-progress-container {
        background: rgba(0, 0, 0, 0.3);
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .trade-rating-progress-container:hover {
        background: rgba(0, 0, 0, 0.4);
        border-color: rgba(255, 255, 255, 0.2);
    }
}

/* Accessibility Enhancements */
@media (prefers-reduced-motion: reduce) {
    .trade-rating-progress-bar,
    .trade-rating-progress-container,
    .trade-rating-text,
    .trade-rating-category {
        transition: none !important;
        animation: none !important;
    }
}

/* Focus States for Keyboard Navigation */
.trade-rating-cell:focus-within .trade-rating-progress-container {
    outline: 2px solid #22c55e;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .trade-rating-progress-container {
        background: #f3f4f6 !important;
        border: 1px solid #d1d5db !important;
    }
    
    .trade-rating-progress-bar {
        background: #6b7280 !important;
    }
    
    .trade-rating-text,
    .trade-rating-category {
        color: #111827 !important;
        text-shadow: none !important;
    }
}/* Updated Sun Jun 15 07:27:16 AM UTC 2025 */
