:root {
    --bg-dark: #0f1923;
    --bg-panel: #1a242d;
    --bg-header: #1a242d;
    --border-color: #2c3e50;
    --text-primary: #ffffff;
    --text-secondary: #9ca3af;
    --accent-red: #f12c4c;
    --accent-white: #ffffff;
    --accent-black: #262f3c;
    --accent-gold: #ffd700;
    --accent-blue: #00d2ff;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    overflow: hidden;
    margin: 0;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    min-height: 1100px;
    /* Increased from 950px to accommodate 40 players */
    overflow: hidden;
    transition: height 0.3s ease;
}

/* Fix for layout loop when embedded in iframes with auto-resize */
.app-container.is-iframe {
    height: auto !important;
    min-height: unset !important;
    /* Remove vh dependency which causes loops */
    overflow: visible !important;
}

.app-container.is-iframe .app-main {
    flex: none !important;
    height: auto !important;
}

.app-container.is-iframe .chart-view {
    height: 500px !important;
    /* Stable height for chart in auto-resizing iframe */
    flex: none !important;
}

.app-container.is-iframe .app-middle {
    height: auto !important;
    flex: none !important;
}

.app-container.is-iframe .app-sidebar {
    height: auto !important;
    max-height: none !important;
}

.app-container.is-iframe .app-bottom {
    height: auto !important;
    min-height: 400px;
}

.app-container.is-iframe .app-sidebar>div {
    height: auto !important;
    flex: none !important;
}

.app-container.is-iframe .flex-grow-1.overflow-auto {
    overflow: visible !important;
    /* Let parent handle scrolling */
    max-height: none !important;
}

/* Re-enable scroll for Order Books inside iframe */
.app-container.is-iframe .app-bottom .flex-grow-1.overflow-auto {
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

.app-header {
    height: 50px;
    background-color: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    flex-shrink: 0;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text-primary);
}

.header-kpi {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.app-middle {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
    transition: width 0.3s ease, height 0.3s ease;
}

.app-main {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    position: relative;
    transition: width 0.3s ease, height 0.3s ease, flex 0.3s ease;
}

.app-sidebar {
    width: 375px;
    background-color: var(--bg-panel);
    border-left: none;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 10;
    transition: width 0.3s ease, opacity 0.3s ease;
}

.app-bottom {
    max-height: 500px;
    /* Increased from 350px */
    background-color: var(--bg-panel);
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: max-height 0.35s ease, opacity 0.35s ease, transform 0.35s ease;
}

.app-container.orderbook-expanded {
    height: auto !important;
    min-height: 1500px !important;
    overflow: visible !important;
}
.app-container.orderbook-expanded .app-middle,
.app-container.orderbook-expanded .app-content-column,
.app-container.orderbook-expanded .app-main {
    height: auto !important;
    overflow: visible !important;
    flex: none !important;
}
.app-container.orderbook-expanded .app-bottom {
    max-height: none !important;
}
.app-container.orderbook-expanded .app-bottom .d-flex.flex-grow-1.overflow-hidden {
    overflow: visible !important;
}
.app-container.orderbook-expanded .app-bottom .custom-scrollbar {
    overflow: visible !important;
    max-height: none !important;
}
body.orderbook-expanded-page {
    overflow: auto !important;
}

/* Helper Classes */
.text-xxs {
    font-size: 0.65rem;
}

.text-xs {
    font-size: 0.75rem;
}

.text-sm {
    font-size: 0.875rem;
}

.font-mono {
    font-family: 'JetBrains Mono', monospace;
}

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

.tracking-wide {
    letter-spacing: 0.025em;
}

/* Components */
.panel-head {
    height: 36px;
    background-color: #212b36;
    border: none !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.panel-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-pill {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
}

.status-pill.pending {
    background-color: #374151;
    color: #9ca3af;
}

.status-pill.rolling {
    background-color: #f59e0b;
    color: #fff;
}

.status-pill.complete {
    background-color: #10b981;
    color: #fff;
}

.history-strip {
    min-height: 40px;
    background-color: var(--bg-dark);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 4px 1rem;
    overflow: hidden;
    flex-shrink: 0;
    

}

.border-danger {
    background-color: var(--bs-border-opacity);
}

.badge-result-container {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    margin-right: 4px;
    position: relative;
    flex-shrink: 0;
    line-height: 0;
}

.badge-result-container img {
    width: 100%;
    height: 100%;
    display: block;
}

.badge-result-container span {
    position: absolute;
    font-size: 0.7rem;
    color: #fff;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    z-index: 2;
}

.chart-view {
    flex: 1;
    position: relative;
    background-color: var(--bg-dark);
    overflow: hidden;
    min-height: 0;
    /* Important for flex child */
    transition: width 0.3s ease, height 0.3s ease, transform 0.3s ease, opacity 0.3s ease;
}

.chart-view .flex-grow-1 {
    min-width: 0;
    min-height: 0;
}

#houseProfitChart {
    width: 100%;
    height: 100%;
    display: block;
}

/* Tables */
.table-trading {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
}

.table-trading th {
    position: sticky;
    top: 0;
    background-color: #212b36;
    color: var(--text-secondary);
    font-weight: 600;
    padding: 4px 8px;
    text-align: left;
    font-size: 0.7rem;
    z-index: 1;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.table-trading td {
    padding: 2px 8px;
    color: var(--text-primary);
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.table-trading tr:hover td {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #374151;
    border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #4b5563;
}

.custom-scrollbar {
    overflow-anchor: none;
}

/* Progress Bars */
.progress-thin {
    height: 4px;
    background-color: #374151;
    border-radius: 2px;
    overflow: hidden;
}

/* Monitoring */
.monitor-gauge-container {
    position: relative;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.monitor-stat-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2px;
}

/* Layout overrides for hidden elements */
.d-none {
    display: none !important;
}

/* Button Groups Overrides */
.btn-group-sm>.btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.btn-outline-secondary {
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.btn-outline-secondary:hover {
    background-color: #374151;
    color: #fff;
}

.btn-outline-light.active {
    background-color: #fff;
    color: #000;
}

/* Global Panel Styles */
.panel {
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    display: flex;
    flex-direction: column;
}

.panel-body {
    padding: 1rem;
    flex: 1;
    overflow: hidden;
}

/* Input Group (Bootstrap-like minimal) */
.input-group {
    display: flex;
    align-items: stretch;
    width: 100%;
}
.input-group-text {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    background-color: var(--bg-dark);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-right: none;
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
    line-height: 1;
    gap: 6px;
}
.input-group .form-control-dark {
    border-left: none;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* Global Button Styles */
.btn-primary-blaze {
    background-color: var(--accent-red);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.btn-primary-blaze:hover {
    background-color: #d11f3d;
    color: white;
}

.btn-secondary-blaze {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.btn-secondary-blaze:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

.btn-success-blaze {
    background-color: #10b981;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.85rem;
}

.btn-success-blaze:hover {
    background-color: #059669;
}

.btn-danger-blaze {
    background-color: rgba(241, 44, 76, 0.1);
    border: 1px solid rgba(241, 44, 76, 0.3);
    color: var(--accent-red);
    padding: 6px 12px;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-danger-blaze:hover {
    background-color: var(--accent-red);
    color: white;
}

/* Form Controls */
.form-control-dark {
    background-color: var(--bg-dark);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 0.9rem;
}

.form-control-dark:focus {
    background-color: var(--bg-dark);
    border-color: var(--accent-red);
    color: var(--text-primary);
    box-shadow: none;
    outline: none;
}

.form-label {
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(2px);
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: center;
}

.modal-overlay.show {
    display: flex;
}

.modal-content-dark {
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    width: 90%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

/* Força todos modals Bootstrap a usarem a paleta escura do sistema */
.modal-content {
    background-color: var(--bg-panel) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    background-color: rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 15px;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--accent-red);
    border-bottom-color: var(--accent-red);
}

.tab-btn.active.text-win {
    background-color: rgba(16, 185, 129, 0.15) !important;
    border-color: #10b981 !important;
    color: #10b981 !important;
}

.tab-btn.active.text-loss {
    background-color: rgba(241, 44, 76, 0.15) !important;
    border-color: #f12c4c !important;
    color: #f12c4c !important;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Player Indicators */
.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
    margin-left: 6px;
    vertical-align: middle;
    transition: all 0.3s ease;
}

.pending-bet-dot {
    background-color: #39ff14 !important;
    box-shadow: 0 0 8px #39ff14, 0 0 15px rgba(57, 255, 20, 0.5);
    animation: glow-pulse 1.2s infinite alternate;
}

@keyframes glow-pulse {
    from {
        box-shadow: 0 0 4px #39ff14, 0 0 8px rgba(57, 255, 20, 0.4);
        transform: scale(0.95);
    }
    to {
        box-shadow: 0 0 10px #39ff14, 0 0 18px rgba(57, 255, 20, 0.6);
        transform: scale(1.15);
    }
}

/* Variable Badges */
.badge-variable {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: 'JetBrains Mono', monospace;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-block;
    margin: 2px;
}

.badge-variable:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

.app-content-column {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    position: relative;
}

/* Global Status Colors */
.text-win {
    color: #10b981 !important;
}

.text-loss {
    color: #f12c4c !important;
}

.bg-win {
    background-color: #10b981 !important;
    color: white;
}

.bg-loss {
    background-color: #f12c4c !important;
    color: white;
}

/* AI Tool Styles - Global Standardization */
.text-gold {
    color: var(--accent-gold) !important;
}

.text-red {
    color: var(--accent-red) !important;
}

.text-white {
    color: var(--accent-white) !important;
}

.text-blue {
    color: var(--accent-blue) !important;
}

.border-bottom-gold {
    border-bottom: 2px solid var(--accent-gold) !important;
}

.border-bottom-red {
    border-bottom: 2px solid var(--accent-red) !important;
}

.border-bottom-white {
    border-bottom: 2px solid var(--accent-white) !important;
}

.border-left-red {
    border-left: 3px solid var(--accent-red) !important;
}

.border-left-black {
    border-left: 3px solid var(--accent-white) !important;
}

/* White for Black in Dark Mode */
.border-left-white {
    border-left: 3px solid var(--text-secondary) !important;
}

.quantum-box {
    background: linear-gradient(145deg, rgba(255, 215, 0, 0.05), rgba(0, 0, 0, 0.2));
    border: 1px solid rgba(255, 215, 0, 0.2);
}

.prediction-bubble {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    font-weight: bold;
    font-size: 1.2rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.prediction-bubble.red {
    background-color: var(--accent-red);
    color: white;
}

.prediction-bubble.black {
    background-color: #262f3c;
    color: white;
    border: 1px solid #4b5563;
}

.prediction-bubble.white {
    background-color: white;
    color: black;
}

/* AI Visual Animations */
.ai-visual-container {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto 20px;
}

.ai-circle-outer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px solid rgba(0, 210, 255, 0.3);
    border-radius: 50%;
    animation: spin 3s linear infinite;
    border-top-color: var(--accent-blue);
}

.ai-circle-inner {
    position: absolute;
    top: 15px;
    left: 15px;
    right: 15px;
    bottom: 15px;
    border: 2px solid rgba(0, 210, 255, 0.1);
    border-radius: 50%;
    animation: spin-reverse 2s linear infinite;
    border-bottom-color: var(--accent-blue);
}

.ai-core-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 10px;
    background-color: var(--accent-blue);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 15px var(--accent-blue);
    animation: pulse 1.5s ease-in-out infinite;
}

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

@keyframes spin-reverse {
    100% {
        transform: rotate(-360deg);
    }
}

@keyframes pulse {
    0% {
        opacity: 0.5;
        transform: translate(-50%, -50%) scale(0.8);
    }

    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }

    100% {
        opacity: 0.5;
        transform: translate(-50%, -50%) scale(0.8);
    }
}

.recalibrating-anim {
    font-family: 'Orbitron', sans-serif;
    letter-spacing: 2px;
    animation: blink 2s infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

/* Trend Meter */
.trend-meter-container {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.trend-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: 600;
}

.trend-segments {
    display: flex;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.trend-segment {
    transition: flex 0.5s ease;
}

/* Prediction Display */
.prediction-display {
    text-align: center;
}

.prediction-color-box {
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.prediction-color-box.red {
    background: linear-gradient(145deg, rgba(241, 44, 76, 0.2), rgba(0, 0, 0, 0.2));
    border-color: var(--accent-red);
}

.prediction-color-box.black {
    background: linear-gradient(145deg, rgba(38, 47, 60, 0.5), rgba(0, 0, 0, 0.2));
    border-color: #4b5563;
}

.prediction-color-box.white {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.2), rgba(0, 0, 0, 0.2));
    border-color: white;
    color: white;
}

.confidence-bar-container {
    margin-bottom: 15px;
}

.confidence-bar {
    height: 6px;
    background: linear-gradient(90deg, #00d2ff, #3a7bd5);
    border-radius: 3px;
    transition: width 1s ease;
}

.prediction-reasoning {
    background-color: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: left;
    border-left: 2px solid var(--accent-blue);
}

/* Pulse Animations for Win/Loss */
@keyframes pulse-green {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(241, 44, 76, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(241, 44, 76, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(241, 44, 76, 0);
    }
}

/* Flash Classes Logic - Applied to Header Blocks */
.flash-success #header-red,
.flash-success #header-white,
.flash-success #header-black {
    animation: pulse-green 1.5s infinite;
    position: relative;
    z-index: 5;
}

.flash-error #header-red,
.flash-error #header-white,
.flash-error #header-black {
    animation: pulse-red 1.5s infinite;
}

/* Text Coloring for Amounts in Win/Loss State */
.flash-success #total-red,
.flash-success #total-white,
.flash-success #total-black {
    color: #10b981 !important;
    /* Green */
}

.flash-error #total-red,
.flash-error #total-white,
.flash-error #total-black {
    color: #f12c4c !important;
    /* Red */
}

/* Win/Loss Animation for Values in Table */
.win-anim {
    color: #10b981 !important;
    font-weight: bold;
    animation: slide-up-fade 0.5s ease-out;
    display: inline-block;
}

.loss-anim {
    color: #f12c4c !important;
    opacity: 0.8;
    display: inline-block;
}

@keyframes slide-up-fade {
    0% {
        transform: translateY(10px);
        opacity: 0;
    }

    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Ensure Table Visibility in Dark Mode */
.table-dark {
    --bs-table-bg: transparent;
    --bs-table-color: #e0e0e0;
}

.table-dark td,
.table-dark th {
    color: #e0e0e0 !important;
}

/* SPECIFIC OVERRIDE FOR WIN TEXT IN TABLE */
.table-dark td.text-win {
    color: #10b981 !important;
}

.table-dark td.text-loss {
    color: #f12c4c !important;
}

.text-muted {
    color: #a0a0a0 !important;
}

#robotModal {
    z-index: 10000 !important;
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.7);
    align-items: center;
    justify-content: center;
}

#robotModal {
    display: none;
    pointer-events: none;
}

#robotModal.show {
    display: flex;
    pointer-events: auto;
}

#robotModal .modal-dialog {
    z-index: 10001 !important;
    position: relative;
    margin: 0 auto !important;
    width: 100%;
    max-width: 100%;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

#robotModal .modal-content {
    background-color: var(--bg-panel) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: 0 0 40px rgba(0, 0, 0, 1) !important;
    max-height: 96vh !important;
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    border-radius: 8px;
}

#robotModal .modal-header {
    background-color: var(--bg-panel) !important;
    border-bottom: 1px solid var(--border-color) !important;
}

#robotModal .modal-body {
    overflow-y: auto !important;
    flex: 1 !important;
    padding: 16px 20px !important;
}

#robotModal .modal-header {
    padding: 16px 20px !important;
}

#robotModal .modal-footer {
    padding: 12px 20px !important;
}

@media (min-width: 576px) {
    #robotModal .modal-dialog {
        max-width: 520px;
    }
}

@media (min-width: 768px) {
    #robotModal .modal-dialog {
        max-width: 720px;
    }
}

@media (min-width: 992px) {
    #robotModal .modal-dialog {
        max-width: 960px;
    }
}

@media (min-width: 1200px) {
    #robotModal .modal-dialog {
        max-width: 1100px;
    }
}

@media (min-width: 1400px) {
    #robotModal .modal-dialog {
        max-width: 1240px;
    }
}

@media (min-width: 1600px) {
    #robotModal .modal-dialog {
        max-width: 1320px;
    }
}

.modal-backdrop {
    z-index: 9999 !important;
    /* Just below the modal */
    opacity: 0.8 !important;
    /* Ensure backdrop is visible */
}

/* Ensure tabs are visible */
#playerTabs .nav-link {
    color: var(--text-secondary) !important;
}

#playerTabs .nav-link.active {
    color: var(--text-primary) !important;
    background-color: rgba(255, 255, 255, 0.1) !important;
    border-color: var(--border-color) !important;
}

/* Force Tab Pane Visibility */
.tab-content>.tab-pane {
    display: none;
}

.tab-content>.active {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Interactive Elements */
.player-clickable:hover {
    text-decoration: underline;
    opacity: 0.8;
}

/* --- SIDEBAR COLLAPSED STATE --- */
.app-container.no-sidebar .app-sidebar {
    width: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    overflow: hidden !important;
    border-left: 0 !important;
    transition: width 0.3s ease, opacity 0.3s ease;
}

/* Ajuste de layout para empurrar o gráfico para a esquerda quando o sidebar for escondido (botão desmarcado) */
.app-container.no-sidebar .chart-view {
    transform: translateX(-50px);
    transition: transform 0.3s ease;
}

.app-container:not(.no-sidebar) .chart-view {
    transform: translateX(0);
    transition: transform 0.3s ease;
}

/* Hide Content Bodies */
.app-container.no-sidebar .app-sidebar>div>div:not(.panel-head) {
    display: none !important;
}

/* Header Adjustments */
.app-container.no-sidebar .app-sidebar .panel-head {
    justify-content: center !important;
    padding: 10px 0 !important;
    height: auto !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
}

/* Hide extra elements in headers */
.app-container.no-sidebar .app-sidebar .status-pill,
.app-container.no-sidebar .app-sidebar .btn-group,
.app-container.no-sidebar .app-sidebar .panel-head>div:not(:first-child) {
    display: none !important;
}

/* Special handling for Ranking Header inner structure */
.app-container.no-sidebar .app-sidebar .panel-head>div:first-child {
    justify-content: center !important;
    width: 100% !important;
    padding: 0 !important;
    display: flex !important;
}

/* Hide text in titles but keep icons */
.app-container.no-sidebar .app-sidebar .panel-title {
    font-size: 0 !important;
    justify-content: center;
    width: 100%;
    display: flex !important;
    align-items: center;
}

/* Icon Styling */
.app-container.no-sidebar .app-sidebar .panel-title i {
    font-size: 14px !important;
    margin: 0 !important;
}

/* --- BOTTOM PANEL TOGGLE --- */
.app-container.no-bottom .app-bottom {
    max-height: 0 !important;
    opacity: 0 !important;
    overflow: hidden !important;
    border-top: 0 !important;
    transform-origin: bottom;
    transform: translateY(20px);
}

/* --- ZEN MODE --- */
.app-container.zen-mode .app-sidebar {
    width: 0 !important;
    opacity: 0 !important;
    overflow: hidden !important;
    border-left: 0 !important;
}
.app-container.zen-mode .app-bottom {
    height: 0 !important;
    opacity: 0 !important;
    overflow: hidden !important;
    border-top: 0 !important;
}
.app-container.zen-mode .chart-view {
    transform: scale(1.01);
}

/* Smooth chart perception de expansão vertical ao colapsar o bottom */
.app-container.no-bottom .chart-view {
    transform: scaleY(1.03);
    transform-origin: top;
}



/* Modern Tab Buttons Refactoring */
.modern-tab-container {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: rgba(26, 36, 45, 0.5);
    /* Subtle container bg matches --bg-panel with opacity */
    border-radius: 12px;
    margin-bottom: 1rem;
    border: 1px solid rgba(44, 62, 80, 0.5);
    /* Subtle border */
}

.modern-tab-btn {
    flex: 1;
    border: none !important;
    outline: none !important;
    background: linear-gradient(145deg, #212b36, #1a232c);
    /* Dark gradient based on theme */
    color: #9ca3af !important;
    /* text-secondary */
    padding: 12px 24px;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.2),
        -1px -1px 2px rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modern-tab-btn:hover {
    color: #ffffff !important;
    background: linear-gradient(145deg, #2c3845, #212b36);
    transform: translateY(-2px);
    box-shadow: 6px 6px 12px rgba(0, 0, 0, 0.3),
        -1px -1px 2px rgba(255, 255, 255, 0.08);
}

.modern-tab-btn.active {
    background: linear-gradient(135deg, #f12c4c 0%, #c0233c 100%);
    /* Blaze Red Gradient */
    color: #ffffff !important;
    box-shadow: 0 4px 15px rgba(241, 44, 76, 0.3);
    transform: translateY(-1px);
}

.modern-tab-btn.active:hover {
    background: linear-gradient(135deg, #ff3f5f 0%, #d12845 100%);
    box-shadow: 0 6px 20px rgba(241, 44, 76, 0.4);
}

.modern-tab-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    background: #1a232c;
}

.modern-tab-btn:focus-visible {
    box-shadow: 0 0 0 3px rgba(241, 44, 76, 0.5);
    z-index: 1;
}

/* Ripple effect for extra polish */
.modern-tab-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.modern-tab-btn:active::after {
    width: 200%;
    height: 200%;
    opacity: 0;
    transition: 0s;
}

/* Export report button: white background */
#btn-export-report {
    background: #ffffff !important;
    color: #0f1114 !important;
    border: 1px solid var(--border-color) !important;
}
#btn-export-report:hover {
    background: #f8f9fa !important;
    color: #0f1114 !important;
}

/* Status Board Refactoring */
.status-board {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    /* 24px */
    padding: 0 1.5rem;
    /* 24px horizontal */
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    height: 100%;
    margin-left: 1rem;
}

.status-item {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
    cursor: default;
}

.status-item:hover {
    transform: translateY(-1px);
    opacity: 0.9;
}

.status-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    /* ~11px */
    color: #94a3b8;
    /* Neutral Slate */
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.status-value {
    font-family: 'JetBrains Mono', monospace;
    /* Monospace for values usually looks better for data */
    font-size: 0.8125rem;
    /* 13px */
    font-weight: 700;
    color: #e2e8f0;
    line-height: 1.2;
}

/* Responsiveness */
@media (max-width: 768px) {
    .status-board {
        padding: 0 1rem;
        gap: 1rem;
        margin-left: 0.5rem;
    }

    .status-label {
        font-size: 0.65rem;
    }
}

/* Player Details Modal Standardization */
.player-modal-content {
    min-height: 520px;
    /* Matches the typical height of the History tab (Filters + 400px Table + Load More) */
}

/* Chart Transition Animation */
#candleChart {
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), filter 0.3s ease;
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
    will-change: opacity, transform, filter;
}

#candleChart.chart-loading {
    opacity: 0.4;
    transform: scale(0.98);
    filter: blur(4px);
}

/* --- ROBOT CHANNEL CARD STYLES --- */
.robot-channel-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.robot-channel-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--text-secondary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.robot-channel-card.active {
    background: rgba(0, 136, 204, 0.15);
    /* Telegram Blue tint */
    border-color: #0088cc;
    box-shadow: 0 0 0 1px rgba(0, 136, 204, 0.3);
}

.robot-channel-card.active:hover {
    background: rgba(0, 136, 204, 0.2);
}

.channel-icon-box {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #0088cc, #005f8f);
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.1rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.channel-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.2;
}

.channel-id {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
    opacity: 0.8;
}

/* Optional: Add a subtle checkmark background for active cards */
.robot-channel-card.active::before {
    content: '\F26B';
    /* Bootstrap Icons check-lg */
    font-family: 'bootstrap-icons';
    position: absolute;
    right: -10px;
    bottom: -10px;
    font-size: 4rem;
    color: rgba(0, 136, 204, 0.1);
    transform: rotate(-15deg);
    pointer-events: none;
}

/* Custom Green Switch */
.form-check-input:checked {
    background-color: #39ff14 !important;
    border-color: #39ff14 !important;
    box-shadow: 0 0 8px rgba(57, 255, 20, 0.4) !important;
}

.form-switch .form-check-input:checked {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e") !important;
}
