/* Enhanced Trading Terminal Styles - Professional Cloud Dashboard Features */

/* ===== CRITICAL SCROLL CONTAINER REQUIREMENTS ===== */
/* DataTables handles scrolling - no CSS interference needed */
.table-responsive {
    /* Let DataTables handle all scrolling */
    position: relative;
}

/* Mobile scroll optimizations */
@media (max-width: 768px) {
    .table-responsive {
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
    }
    
    /* Better touch targets */
    .btn-sm {
        min-height: 36px;
        padding: 8px 12px;
    }
}

/* ===== LET DATATABLES HANDLE EVERYTHING ===== */
/* Removed CSS sticky to avoid conflicts with DataTables rendering */

/* Use base theme variables instead of custom ones */
/* Remove conflicting variables and use base.css theme system */

/* ===== DYNAMIC VISUAL ENHANCEMENTS - CLOUD DASHBOARD FEATURES ===== */

/* P&L Based Symbol Coloring */
.symbol-cell.profit .symbol-link {
    color: var(--positive, #10b981) !important;
    background-color: rgba(16, 185, 129, 0.08) !important;
}

.symbol-cell.loss .symbol-link {
    color: var(--negative, #ef4444) !important;
    background-color: rgba(239, 68, 68, 0.08) !important;
}

/* LTP Visual Hierarchy - Row Level Effects */
.tr-row.near-resistance td {
    background-color: rgba(251, 191, 36, 0.12) !important;
    border-left: 3px solid #fbbf24 !important;
}

.tr-row.breakout td {
    background-color: rgba(16, 185, 129, 0.15) !important;
    border-left: 3px solid #10b981 !important;
    font-weight: 600 !important;
}

.tr-row.sl-breached td {
    background-color: rgba(239, 68, 68, 0.20) !important;
    border-left: 3px solid #ef4444 !important;
    font-weight: 700 !important;
}

/* Individual Cell Color Coding */
.cell-near-resistance {
    background-color: rgba(251, 191, 36, 0.12);
    color: #92400e;
    font-weight: 600;
}

.cell-breakout {
    background-color: rgba(16, 185, 129, 0.15);
    color: #065f46;
    font-weight: 600;
}

.cell-sl-breached {
    background-color: rgba(239, 68, 68, 0.20);
    color: #7f1d1d;
    font-weight: 700;
}

/* Volume Ratio Visual Indicators */
.vol-ratio-high {
    background-color: rgba(34, 197, 94, 0.1);
    color: var(--positive);
}

.vol-ratio-low {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--negative);
}

/* Technical Indicator Color Coding */
.tech-positive {
    color: var(--positive);
    background-color: rgba(16, 185, 129, 0.08);
}

.tech-negative {
    color: var(--negative);
    background-color: rgba(239, 68, 68, 0.08);
}

.tech-neutral {
    color: var(--muted, #6b7280);
    background-color: rgba(107, 114, 128, 0.05);
}

/* Resistance Distance Visual Coding */
.res-critical {
    background-color: rgba(239, 68, 68, 0.15) !important;
    color: #7f1d1d !important;
    font-weight: 600 !important;
}

.res-warning {
    background-color: rgba(251, 191, 36, 0.12) !important;
    color: #92400e !important;
}

.res-safe {
    background-color: rgba(16, 185, 129, 0.08) !important;
    color: #065f46 !important;
}

/* Ready to Sell Status */
.ready-sell-yes {
    background-color: rgba(34, 197, 94, 0.12) !important;
    color: var(--positive) !important;
    font-weight: 600 !important;
}

.ready-sell-no {
    background-color: rgba(107, 114, 128, 0.08) !important;
    color: var(--muted) !important;
}

/* Flash Animations for Real-time Updates */
/* ✅ REMOVED: Simple flash animations - keeping smoother multi-step version below */

/* Flash Animation Classes - Clean Implementation */
.flash-green {
    -webkit-animation: flashGreen 0.6s ease;
    -moz-animation: flashGreen 0.6s ease;
    -o-animation: flashGreen 0.6s ease;
    animation: flashGreen 0.6s ease;
}

.flash-red {
    -webkit-animation: flashRed 0.6s ease;
    -moz-animation: flashRed 0.6s ease;
    -o-animation: flashRed 0.6s ease;
    animation: flashRed 0.6s ease;
}

.flash-amber {
    -webkit-animation: flashAmber 0.6s ease;
    -moz-animation: flashAmber 0.6s ease;
    -o-animation: flashAmber 0.6s ease;
    animation: flashAmber 0.6s ease;
}

/* ===== COLUMN GROUPING FOR PERFORMANCE ===== */
/* Core Trading Columns - Always Visible */
.col-core { 
    min-width: 80px !important; 
    font-weight: 500 !important;
}

/* Technical Indicators - Collapsible Group */
.col-tech { 
    min-width: 60px !important; 
    font-size: 0.8rem !important;
    opacity: 0.8 !important;
}

.col-tech:hover {
    opacity: 1 !important;
    font-weight: 500 !important;
}

/* Volume & Delivery Analysis */
.col-volume { 
    min-width: 70px !important;
    background-color: rgba(59,130,246,0.02) !important;
}

/* Risk Management Columns */
.col-risk { 
    min-width: 75px !important;
    border-left: 1px solid var(--border, #e5e7eb) !important;
}

/* System/Meta Columns - Less Priority */
.col-meta { 
    min-width: 60px !important; 
    font-size: 0.75rem !important;
    color: var(--muted, #6b7280) !important;
}

/* Responsive Column Hiding */
@media (max-width: 1200px) {
    .col-tech { display: none !important; }
    .col-meta { display: none !important; }
}

@media (max-width: 768px) {
    .col-volume { display: none !important; }
    .col-risk { display: none !important; }
}

/* Professional Status Bar */
.status-bar {
    background: var(--surface) !important;
    border-radius: 12px !important;
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary) !important;
    box-shadow: var(--shadow-sm);
    color: var(--text) !important;
}

/* Professional Metric Cards */
/* ✅ REMOVED: .metric-card styles - use base.css definition */

/* ✅ REMOVED: .metric-label duplicate - use base.css definition */

/* ✅ REMOVED: .metric-value duplicate - use base.css definition */

/* Technical Indicators Styling */
.tech-indicator {
    font-family: 'Courier New', monospace;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    padding: 2px 4px;
    border-radius: 4px;
    min-width: 50px;
}

.tech-indicator.positive {
    background-color: rgba(34, 197, 94, 0.1);
    color: var(--positive);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.tech-indicator.negative {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--negative);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.tech-indicator.neutral {
    background-color: rgba(107, 114, 128, 0.1);
    color: var(--muted);
    border: 1px solid rgba(107, 114, 128, 0.3);
}

.decision-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.decision-badge.skip {
    background-color: var(--warning);
    color: var(--text);
}

.decision-badge.watch {
    background-color: var(--info);
    color: var(--text);
}

.decision-badge.execute {
    background-color: var(--positive);
    color: var(--text);
}

/* Symbol Links with P&L-based coloring */
/* ✅ REMOVED: .symbol-link duplicate - use base.css definition */

/* Sticky column implemented using CSS position: sticky (NO DataTables FixedColumns) */

/* Performance and smoothness improvements */
/* ✅ REMOVED: .dataTables_wrapper conflicts - handled in base.css */

/* ✅ REMOVED: .dataTables_scrollBody empty rule - was causing lint error */
/* ✅ REMOVED: will-change: transform - risky under heavy load */
/* ✅ REMOVED: scroll-behavior: smooth - causes lag under frequent updates */

table.dataTable {
    border-collapse: separate !important;
}

/* ✅ REMOVED: Duplicate cell coloring classes - use base.css definitions */

/* ✅ REMOVED: Duplicate flash animations - kept only the clean version at top */

@-webkit-keyframes flashGreen {
    0% { background-color: rgba(34, 197, 94, 0.3); }
    50% { background-color: rgba(34, 197, 94, 0.6); }
    100% { background-color: transparent; }
}

@-moz-keyframes flashGreen {
    0% { background-color: rgba(34, 197, 94, 0.3); }
    50% { background-color: rgba(34, 197, 94, 0.6); }
    100% { background-color: transparent; }
}

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

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

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

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

/* ✅ REMOVED: .metric-card:hover duplicate - use base.css definition */

/* ✅ REMOVED: Second .metric-label duplicate - use base.css definition */

/* ✅ REMOVED: Second .metric-value duplicate - use base.css definition */

/* ✅ REMOVED: Duplicate .nav-tabs - use base.css definition */

/* Trade Tab Styling - Two Tables */
.trade-section {
    margin-bottom: 2rem;
}

.trade-section h5 {
    color: var(--text);
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
}

/* Terminal-specific table compact mode */

/* PNL Color Coding */
.pnl-positive {
    color: var(--positive);
    font-weight: 600;
}

.pnl-negative {
    color: var(--negative);
    font-weight: 600;
}

.pnl-neutral {
    color: var(--muted);
}

/* Status Indicators */
.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
}

.status-indicator.live {
    background-color: var(--positive);
    animation: pulse 2s infinite;
}

.status-indicator.offline {
    background-color: var(--negative);
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Loading Spinner */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* TradingView Links */
.tv-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.tv-link:hover {
    color: var(--primary);
    text-decoration: underline;
}

.tv-link::after {
    content: "📊";
    font-size: 12px;
}

/* Badges */
.badge {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Buttons */
.btn {
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-sm {
    font-size: 11px;
    padding: 4px 8px;
}

.btn-danger {
    background-color: var(--negative);
    border-color: var(--negative);
}

.btn-danger:hover {
    background-color: var(--negative);
    border-color: var(--negative);
}

/* Compact Table Styling */
.table.compact {
    font-size: 12px;
}

.table.compact th,
.table.compact td {
    padding: 8px 6px;
}

/* Sticky Headers */
.sticky-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--sticky-bg);
}

/* ✅ REMOVED: Dangerous generic .positive/.negative classes - use specific ones like .pnl-positive */

/* Status Indicators */
.trade-signal {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.buy-signal {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--positive);
}

.sell-signal {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--negative);
}

/* Technical Indicators */
.technical-indicator {
    font-size: 11px;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 600;
}

.rsi-overbought {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--negative);
}

.rsi-oversold {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--positive);
}

.rsi-neutral {
    background-color: rgba(107, 114, 128, 0.1);
    color: var(--muted);
}

/* Risk Indicators */
.risk-low {
    color: var(--positive);
}

.risk-medium {
    color: var(--warning);
}

.risk-high {
    color: var(--negative);
}

/* Signal Strength */
.signal-strength {
    display: flex;
    gap: 2px;
    align-items: center;
}

.signal-bar {
    width: 3px;
    height: 12px;
    background-color: var(--border);
    border-radius: 1px;
}

.signal-bar.active {
    background-color: var(--positive);
}

/* Recommendations */
.recommendation {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
}

.buy-rec {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--positive);
}

.sell-rec {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--negative);
}

.hold-rec {
    background-color: rgba(107, 114, 128, 0.1);
    color: var(--muted);
}

/* Orange Button for AVG DN (NEW) */
.btn-orange {
    background-color: #fd7e14;
    border-color: #fd7e14;
    color: #fff;
}

.btn-orange:hover {
    background-color: #e96b0c;
    border-color: #e96b0c;
}

/* Sentiment Indicators */
.sentiment-positive {
    color: var(--positive);
}

.sentiment-negative {
    color: var(--negative);
}

.sentiment-neutral {
    color: var(--muted);
}

/* Scores */
.score-bullish {
    color: var(--positive);
}

.score-bearish {
    color: var(--negative);
}

.score-neutral {
    color: var(--muted);
}

/* Trends */
.trend-bullish {
    color: var(--positive);
}

.trend-bearish {
    color: var(--negative);
}

.trend-sideways {
    color: var(--muted);
}

/* Potential Indicators */
.potential-low {
    color: var(--muted);
}

.potential-medium {
    color: var(--warning);
}

.potential-high {
    color: var(--positive);
}

/* Insider Activity */
.insider-buying {
    color: var(--positive);
}

.insider-selling {
    color: var(--negative);
}

.insider-neutral {
    color: var(--muted);
}

/* Flow Indicators */
.flow-inflow {
    color: var(--positive);
}

.flow-outflow {
    color: var(--negative);
}

.flow-neutral {
    color: var(--muted);
}

/* Options Sentiment */
.options-bullish {
    color: var(--positive);
}

.options-bearish {
    color: var(--negative);
}

.options-neutral {
    color: var(--muted);
}

/* Volatility */
.volatility-low {
    color: var(--positive);
}

.volatility-medium {
    color: var(--warning);
}

.volatility-high {
    color: var(--negative);
}

/* Momentum */
.momentum-strong {
    color: var(--positive);
}

.momentum-weak {
    color: var(--negative);
}

.momentum-neutral {
    color: var(--muted);
}

/* Relative Strength */
.rs-strong {
    color: var(--positive);
}

.rs-weak {
    color: var(--negative);
}

.rs-neutral {
    color: var(--muted);
}

/* Pattern Recognition */
.pattern-bullish {
    color: var(--positive);
}

.pattern-bearish {
    color: var(--negative);
}

.pattern-neutral {
    color: var(--muted);
}

/* AI Scores */
.ai-strong-buy {
    color: var(--positive);
}

.ai-buy {
    color: var(--positive);
}

.ai-hold {
    color: var(--muted);
}

.ai-sell {
    color: var(--warning);
}

.ai-strong-sell {
    color: var(--negative);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 4px;
    justify-content: center;
}

.action-buttons .btn {
    padding: 4px 6px;
    font-size: 10px;
}

/* Responsive Design */
@media (max-width: 768px) {
    /* ✅ REMOVED: .metric-value mobile duplicate - base.css handles this */
    .table {
        font-size: 11px;
    }
    .table.compact {
        font-size: 10px;
    }
    
    /* Stack trade tables on mobile */
    .trade-section {
        margin-bottom: 1.5rem;
    }
    
    .trade-section h5 {
        font-size: 16px;
    }
    
    /* Adjust column widths for mobile */
    .table th,
    .table td {
        padding: 6px 4px;
        font-size: 10px;
    }
}

/* Dark Mode Enhancements */
/* ✅ REMOVED: Dark mode table styles - use base.css definition */

[data-theme="dark"] .status-bar {
    background: var(--surface-2) !important;
}

/* Performance Optimizations */
/* ✅ REMOVED: will-change: transform from .table - causes GPU memory issues */

.table tbody tr {
    transition: background-color 0.15s ease;
}

/* Print Styles */
@media print {
    .nav-tabs,
    .btn,
    .action-buttons {
        display: none !important;
    }
    
    .table {
        font-size: 10px;
    }
    
    .table th,
    .table td {
        padding: 4px 2px;
        border: 1px solid #000;
    }
}

/* ✅ REMOVED: Duplicate .positive/.negative at bottom - dangerous generic classes */

.action-buttons { white-space: nowrap; }
/* ✅ REMOVED: Duplicate .card definitions - use base.css */

.refresh-btn { 
    cursor: pointer; 
    transition: color 0.2s ease;
}
.refresh-btn:hover { 
    color: var(--primary); 
}
.status-badge { 
    font-size: 0.8rem; 
}
/* ✅ REMOVED: .dataTables_wrapper conflicts - handled in base.css */
.dataTables_filter { 
    margin-bottom: 10px; 
}
.dataTables_info, .dataTables_length { 
    margin-top: 10px; 
}

/* Theme Toggle Button */
.theme-toggle {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.theme-toggle:hover {
    background-color: rgba(59,130,246,0.1);
    border-color: var(--text);
}

/* Compact Professional Styling */
.table td, .table th {
    padding: 0.4rem 0.5rem;
    font-size: 0.85rem;
    white-space: nowrap;
    border-color: var(--border);
}

/* ✅ REMOVED: .table thead th conflict - use base.css definition */

/* Status Badge Styling (matches original) */
.status-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

/* Header sticky handled via CSS position: sticky */

/* ===== SELL POPUP STYLING ===== */
.sell-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.sell-popup-box {
    background: var(--surface, #ffffff);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 8px;
    padding: 20px;
    min-width: 300px;
    max-width: 400px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.sell-popup-box h5 {
    margin: 0 0 15px 0;
    color: var(--text, #111827);
    font-weight: 600;
    font-size: 1.1rem;
}

.sell-popup-box label {
    display: block;
    margin-bottom: 8px;
    color: var(--text, #374151);
    font-weight: 500;
    font-size: 0.9rem;
}

.sell-popup-box input[type="number"] {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border, #d1d5db);
    border-radius: 6px;
    font-size: 1rem;
    background: var(--surface, #ffffff);
    color: var(--text, #111827);
    margin-bottom: 15px;
}

.sell-popup-box input[type="number"]:focus {
    outline: none;
    border-color: var(--primary, #3b82f6);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.sell-popup-box .mt-3 {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Dark theme support for sell popup */
[data-theme="dark"] .sell-popup-box {
    background: var(--surface, #1e293b);
    border-color: var(--border, #334155);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .sell-popup-box h5 {
    color: var(--text, #f1f5f9);
}

[data-theme="dark"] .sell-popup-box label {
    color: var(--text, #cbd5e1);
}

[data-theme="dark"] .sell-popup-box input[type="number"] {
    background: var(--surface, #374151);
    border-color: var(--border, #4b5563);
    color: var(--text, #f9fafb);
}

/* Theme Toggle Button */
