/**
 * TOTRIEU Trading Technicals Styles - CLEANED VERSION 2.10
 * Trading Calculator CSS moved to riskreward.css for better performance
 */

/*--------------------------------------------------------------
# Base Table Styles
--------------------------------------------------------------*/
.totrieu-trading-table {
    margin: 20px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

.trend_technicals,
.pivot_levels {
    width: 100%;
    border-collapse: collapse;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 14px;
    line-height: 1.4;
}

.trend_technicals thead th,
.pivot_levels thead th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 13px;
    border: none;
}

.trend_technicals tbody td,
.pivot_levels tbody td {
    padding: 10px 15px;
    border-bottom: 1px solid #e1e5e9;
    vertical-align: middle;
    transition: background-color 0.2s ease;
    color: #2c3e50; /* Ensure readable text color */
}

.trend_technicals tbody tr:hover td,
.pivot_levels tbody tr:hover td {
    background-color: #f8f9fa;
}

.is-style-stripes .trend_technicals tbody tr:nth-child(even) td,
.is-style-stripes .pivot_levels tbody tr:nth-child(even) td {
    background-color: #f8f9fa;
}

.is-style-stripes .trend_technicals tbody tr:nth-child(even):hover td,
.is-style-stripes .pivot_levels tbody tr:nth-child(even):hover td {
    background-color: #e9ecef;
}

/*--------------------------------------------------------------
# Confluence Price Table - FIXED COLORS
--------------------------------------------------------------*/
.confluence-price-table {
    border-collapse: collapse;
    width: 100%;
    text-align: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.confluence-price-table th, 
.confluence-price-table td {
    padding: 12px 8px;
    border: 1px solid #dee2e6;
    color: #2c3e50; /* Ensure readable text */
}

.confluence-price-table thead th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 13px;
}

/* Current Price Row - FIXED */
.cp_row {
    background-color: #fff3cd !important; /* Light yellow background */
    font-weight: bold;
    color: #856404 !important; /* Dark yellow text for contrast */
}

.cp_row td {
    color: #856404 !important; /* Ensure all cells have proper contrast */
    background-color: transparent;
}

/* Resistance Rows - FIXED */
.cr_row td:nth-child(2) { 
    color: #dc3545 !important; /* Red for resistance prices */
    font-weight: bold; 
}

.cr_low { 
    opacity: 0.8; 
    background-color: rgba(220, 53, 69, 0.1) !important;
}

.cr_mid { 
    opacity: 0.9; 
    background-color: rgba(220, 53, 69, 0.15) !important;
}

.cr_high { 
    background-color: rgba(220, 53, 69, 0.25) !important; 
    font-size: 1.05em;
    color: #721c24 !important; /* Darker red for high resistance */
}

/* Support Rows - FIXED */
.cs_row td:nth-child(2) { 
    color: #28a745 !important; /* Green for support prices */
    font-weight: bold; 
}

.cs_low { 
    opacity: 0.8; 
    background-color: rgba(40, 167, 69, 0.1) !important;
}

.cs_mid { 
    opacity: 0.9; 
    background-color: rgba(40, 167, 69, 0.15) !important;
}

.cs_high { 
    background-color: rgba(40, 167, 69, 0.25) !important; 
    font-size: 1.05em;
    color: #155724 !important; /* Darker green for high support */
}

/*--------------------------------------------------------------
# Gauge Chart Styles
--------------------------------------------------------------*/
.totrieu-gauge-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    border: 1px solid #e9ecef;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    display: inline-block;
    vertical-align: top;
    text-align: center;
    background-color: #fff;
    margin: 10px;
}

.totrieu-gauge-container .gauge-header h4 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 5px 0;
    color: #343a40;
}

.totrieu-gauge-container .gauge-header small {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
}

.totrieu-gauge-container .gauge-center-text {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    pointer-events: none;
    line-height: 1.2;
}

/*--------------------------------------------------------------
# RRG Chart Styles
--------------------------------------------------------------*/
.totrieu-rrg-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #fff;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin: 20px 0;
    overflow: hidden;
}

.totrieu-rrg-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 25px;
    text-align: center;
}

.totrieu-rrg-header h3 {
    margin: 0 0 8px 0;
    font-size: 1.8em;
    font-weight: 700;
}

.totrieu-rrg-controls {
    padding: 15px 25px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.rrg-control-group {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
}

.rrg-control-group select, 
.rrg-control-group input {
    padding: 6px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 13px;
    background: white;
    min-width: 80px;
}

.rrg-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s ease;
}

.rrg-btn:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    transform: translateY(-1px);
}

.totrieu-rrg-chart-wrapper {
    position: relative;
    height: 500px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    padding: 15px;
    margin-bottom: 25px;
}

.totrieu-rrg-legend {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.rrg-quadrant-info {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid;
    transition: all 0.2s ease;
}

.rrg-quadrant-info.leading { 
    border-left-color: #28a745; 
    background: linear-gradient(90deg, rgba(40, 167, 69, 0.05) 0%, #f8f9fa 100%);
}

.rrg-quadrant-info.improving { 
    border-left-color: #17a2b8; 
    background: linear-gradient(90deg, rgba(23, 162, 184, 0.05) 0%, #f8f9fa 100%);
}

.rrg-quadrant-info.lagging { 
    border-left-color: #dc3545; 
    background: linear-gradient(90deg, rgba(220, 53, 69, 0.05) 0%, #f8f9fa 100%);
}

.rrg-quadrant-info.weakening { 
    border-left-color: #ffc107; 
    background: linear-gradient(90deg, rgba(255, 193, 7, 0.05) 0%, #f8f9fa 100%);
}

/*--------------------------------------------------------------
# RRG Asset Table
--------------------------------------------------------------*/
.totrieu-rrg-asset-table {
    margin: 25px 0;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.totrieu-rrg-asset-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.totrieu-rrg-asset-table th {
    background: linear-gradient(135deg, #495057 0%, #343a40 100%);
    color: white;
    padding: 12px 10px;
    text-align: center;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.totrieu-rrg-asset-table td {
    padding: 10px;
    text-align: center;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
}

.totrieu-rrg-asset-table tbody tr:nth-child(even) {
    background: #f8f9fa;
}

.totrieu-rrg-asset-table tbody tr:hover {
    background: #e3f2fd;
}

.asset-name {
    font-weight: 700;
    color: #495057;
}

.numeric-value {
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-weight: 600;
}

.rrg-status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rrg-status-leading {
    background: #d4edda;
    color: #155724;
}

.rrg-status-improving {
    background: #d1ecf1;
    color: #0c5460;
}

.rrg-status-lagging {
    background: #f8d7da;
    color: #721c24;
}

.rrg-status-weakening {
    background: #fff3cd;
    color: #856404;
}

.rrg-signal {
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
}

.movement-info {
    text-align: left;
    font-size: 12px;
}

.movement-pattern {
    font-weight: 600;
    color: #495057;
    margin-bottom: 4px;
}

.movement-details {
    color: #6c757d;
    line-height: 1.3;
}

/*--------------------------------------------------------------
# Error Messages
--------------------------------------------------------------*/
.totrieu-trading-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 12px 16px;
    border-radius: 6px;
    margin: 15px 0;
}

.totrieu-trading-warning {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 12px 16px;
    border-radius: 6px;
    margin: 15px 0;
}

.totrieu-trading-info {
    background: #d1ecf1;
    border: 1px solid #b8daff;
    color: #0c5460;
    padding: 12px 16px;
    border-radius: 6px;
    margin: 15px 0;
}

/*--------------------------------------------------------------
# Responsive Design for General Components
--------------------------------------------------------------*/
@media (max-width: 768px) {
    .totrieu-trading-table {
        margin: 15px 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .trend_technicals,
    .pivot_levels {
        min-width: 500px;
        font-size: 13px;
    }
    
    .confluence-price-table {
        font-size: 12px;
        min-width: 600px;
    }
    
    .confluence-price-table th,
    .confluence-price-table td {
        padding: 8px 6px;
    }
    
    .totrieu-gauge-container {
        margin: 8px;
        padding: 12px;
    }
    
    .totrieu-rrg-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .rrg-control-group {
        justify-content: space-between;
    }
    
    .totrieu-rrg-legend {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .totrieu-rrg-asset-table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .totrieu-rrg-asset-table table {
        min-width: 700px;
        font-size: 12px;
    }
    
    .totrieu-rrg-asset-table th,
    .totrieu-rrg-asset-table td {
        padding: 8px 6px;
    }
}

@media (max-width: 480px) {
    .totrieu-trading-table {
        margin: 10px 0;
    }
    
    .trend_technicals,
    .pivot_levels {
        min-width: 450px;
        font-size: 12px;
    }
    
    .trend_technicals th,
    .trend_technicals td,
    .pivot_levels th,
    .pivot_levels td {
        padding: 8px 10px;
    }
    
    .confluence-price-table {
        min-width: 550px;
        font-size: 11px;
    }
    
    .confluence-price-table th,
    .confluence-price-table td {
        padding: 6px 4px;
    }
    
    .totrieu-gauge-container {
        margin: 5px;
        padding: 10px;
        min-width: 200px;
    }
    
    .totrieu-rrg-header {
        padding: 15px;
    }
    
    .totrieu-rrg-header h3 {
        font-size: 1.5em;
    }
    
    .totrieu-rrg-chart-wrapper {
        height: 400px;
        padding: 10px;
        margin-bottom: 20px;
    }
    
    .totrieu-rrg-asset-table table {
        min-width: 600px;
        font-size: 11px;
    }
    
    .totrieu-rrg-asset-table th,
    .totrieu-rrg-asset-table td {
        padding: 6px 4px;
    }
    
    .movement-info {
        font-size: 10px;
    }
    
    .rrg-status-badge {
        font-size: 9px;
        padding: 2px 4px;
    }
}

/*--------------------------------------------------------------
# Print Styles
--------------------------------------------------------------*/
@media print {
    .totrieu-trading-table,
    .totrieu-rrg-container {
        box-shadow: none;
        border: 1px solid #000;
        margin: 10px 0;
    }
    
    .totrieu-rrg-controls {
        display: none;
    }
    
    .trend_technicals thead th,
    .pivot_levels thead th,
    .confluence-price-table thead th,
    .totrieu-rrg-header,
    .rrg-quadrant-info {
        -webkit-print-color-adjust: exact;
        color-adjust: exact;
    }
    
    .totrieu-rrg-chart-wrapper {
        height: auto;
        min-height: 300px;
    }
}

/*--------------------------------------------------------------
# High Contrast Mode
--------------------------------------------------------------*/
@media (prefers-contrast: high) {
    .totrieu-trading-table,
    .totrieu-rrg-container {
        border: 3px solid #000;
    }
    
    .trend_technicals th,
    .trend_technicals td,
    .pivot_levels th,
    .pivot_levels td,
    .confluence-price-table th,
    .confluence-price-table td {
        border: 2px solid #000;
    }
    
    .cr_row td:nth-child(2),
    .info-value.negative {
        color: #cc0000 !important;
        font-weight: 900;
    }
    
    .cs_row td:nth-child(2),
    .info-value.positive {
        color: #006600 !important;
        font-weight: 900;
    }
    
    .rrg-status-badge {
        border: 2px solid #000;
        font-weight: 900;
    }
}

/*--------------------------------------------------------------
# Accessibility Enhancements
--------------------------------------------------------------*/

/* Screen Reader Only Content */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Enhanced Focus Indicators */
.rrg-btn:focus,
.rrg-control-group select:focus,
.rrg-control-group input:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

/* Keyboard Navigation Support */
.totrieu-rrg-asset-table tbody tr:focus-within {
    background: #e3f2fd !important;
    outline: 2px solid #667eea;
    outline-offset: -2px;
}

/* High Contrast Focus Enhancement */
@media (prefers-contrast: high) {
    .rrg-btn:focus,
    .rrg-control-group select:focus,
    .rrg-control-group input:focus {
        outline: 3px solid #000000;
        outline-offset: 2px;
        box-shadow: none;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .rrg-btn,
    .rrg-quadrant-info {
        transition: none;
    }
}

/*--------------------------------------------------------------
# Utility Classes
--------------------------------------------------------------*/
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.font-mono {
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
}

.font-bold {
    font-weight: 700;
}

.text-green {
    color: #28a745 !important;
}

.text-red {
    color: #dc3545 !important;
}

.text-gray {
    color: #6c757d !important;
}