﻿:root {
    --bg-color: #0b0e11;
    --sidebar-bg: #1e2329;
    --card-bg: #1e2329;
    --border-color: #2b3139;
    --text-primary: #eaecef;
    --text-secondary: #848e9c;
    --accent-color: #fcd535;
    --positive: #0ecb81;
    --negative: #f6465d;
    --hover-bg: #2b3139;
    --premium-gradient: linear-gradient(135deg, #fcd535 0%, #f0b90b 100%);
    --up-color: #0ecb81;
    --down-color: #f6465d;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

button,
.tf-btn,
.mobile-menu-btn {
    -webkit-user-select: none;
    user-select: none;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

.dashboard-container {
    display: none;
    flex-direction: row;
    height: 100vh;
}

/* Main Layout */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    /* Critical for nested flex scrolling */
}

.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: 70px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    gap: 15px;
}

.symbol-info {
    flex: 1;
    min-width: 0;
}

.symbol-info h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media screen and (max-width: 768px) {
    .top-bar {
        flex-direction: column;
        align-items: stretch;
        height: auto;
        padding: 10px 15px;
        gap: 10px;
    }

    .symbol-info {
        order: 1;
        text-align: center;
    }

    .symbol-info h1 {
        font-size: 18px;
    }

    .market-stats {
        order: 2;
        display: flex !important;
        justify-content: space-around;
        gap: 10px;
    }

    .stat-box {
        align-items: center;
        text-align: center;
    }

    .stat-label {
        font-size: 10px;
    }

    .stat-value {
        font-size: 12px;
    }

    .mobile-menu-btn {
        order: 0;
        align-self: flex-start;
    }
}

/* Sidebar */
.sidebar {
    width: 300px;
    background: linear-gradient(180deg, #1e2329 0%, #161a1e 100%);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 15px;
    overflow-y: auto;
    overflow-x: hidden;
    gap: 15px;
    height: 100vh;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
    position: relative;
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.3);
}

.sidebar.active {
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
}

.sidebar>* {
    flex-shrink: 0;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--hover-bg);
}

.logo {
    position: relative;
}

.logo h2 {
    color: var(--accent-color);
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 5px;
}

.search-box {
    display: flex;
    gap: 8px;
}

@media screen and (max-width: 1024px) {
    .search-box {
        gap: 0;
    }

    .search-wrapper {
        width: 100%;
    }

    #searchBtn {
        display: none;
    }
}

.search-wrapper {
    position: relative;
    flex: 1;
}

input {
    width: 100%;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 4px;
    outline: none;
    font-size: 13px;
    -webkit-user-select: text !important;
    user-select: text !important;
}

input:focus {
    border-color: var(--accent-color);
}

button {
    background: var(--accent-color);
    color: #000;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s;
}

button:hover {
    background: #ffd93d;
    transform: translateY(-1px);
}

.symbol-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-top: 4px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.symbol-dropdown.active {
    display: block;
}

.symbol-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}

.symbol-item:hover {
    background: var(--hover-bg);
}

.symbol-item:last-child {
    border-bottom: none;
}

.timeframe-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.tf-btn {
    background: var(--card-bg);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.tf-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.tf-btn.active {
    background: var(--accent-color);
    color: #000;
    border-color: var(--accent-color);
}

/* Panels */
.info-panel,
.ratio-panel,
.toggles-panel {
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    margin-top: 10px;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.info-panel h3,
.ratio-panel h3,
.toggles-panel h3 {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
    font-weight: 700;
}

#orderFlowPanel {
    display: none;
    /* Hidden by default */
}

.info-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 14px;
}

.positive {
    color: var(--up-color);
}

.negative {
    color: var(--down-color);
}

.ratio-bars {
    display: flex;
    height: 28px;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}

.ratio-item {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    transition: width 0.3s;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.ratio-item.long {
    background: var(--up-color);
}

.ratio-item.short {
    background: var(--down-color);
}

.ratio-label {
    margin-right: 6px;
    opacity: 0.9;
}

.toggle-group {
    margin-bottom: 18px;
}

.toggle-group:last-child {
    margin-bottom: 0;
}

.toggle-group h4 {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    opacity: 0.9;
    font-weight: 600;
}

.toggle-item {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    margin-right: 10px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #363a45;
    transition: .4s;
    border-radius: 20px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.toggle-slider {
    background-color: var(--accent-color);
}

input:checked+.toggle-slider:before {
    transform: translateX(16px);
}

.toggle-label {
    font-size: 13px;
    color: var(--text-primary);
}

.market-stats {
    display: flex;
    gap: 20px;
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.stat-label {
    font-size: 11px;
    color: var(--text-secondary);
}

.stat-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.chart-container {
    flex: 1;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 0;
    /* Important for flex containers */
    min-width: 0;
}

@media screen and (max-width: 1366px) {
    .sidebar {
        width: 260px;
    }
}

@media screen and (max-width: 1024px) {
    .sidebar {
        width: 220px;
        /* Compress further */
    }

    .top-bar {
        padding: 0 10px;
    }
}

.chart-legend {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 20;
    font-size: 12px;
    font-family: 'Roboto Mono', monospace;
    color: #fff;
    pointer-events: none;
    background: rgba(11, 14, 17, 0.7);
    padding: 8px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.legend-row {
    display: flex;
    gap: 10px;
}

.legend-label {
    color: var(--text-secondary);
}

.legend-value {
    font-weight: 700;
}

/* AI Panel Styles */
.ai-panel-container {
    background: linear-gradient(145deg, #1e2329 0%, #161a1e 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.ai-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.ai-header h3 {
    font-size: 15px;
    color: var(--accent-color);
    text-transform: uppercase;
    text-shadow: 0 0 10px rgba(252, 213, 53, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
}

.ai-header h3::before {
    content: '●';
    color: var(--accent-color);
    animation: blink-dot 1s infinite;
}

@keyframes blink-dot {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

.bias-badge {
    padding: 5px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.bias-badge.bullish {
    background: rgba(14, 203, 129, 0.2);
    color: var(--up-color);
}

.bias-badge.bearish {
    background: rgba(246, 70, 93, 0.2);
    color: var(--down-color);
}

.bias-badge.neutral {
    background: rgba(132, 142, 156, 0.2);
    color: var(--text-secondary);
}

.bias-badge.loading {
    background: rgba(252, 213, 53, 0.2);
    color: var(--accent-color);
}

.ai-content {
    font-size: 14px;
}

.ai-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 15px;
}

.metric-box {
    background: var(--bg-color);
    padding: 10px;
    border-radius: 6px;
    text-align: center;
}

.metric-label {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 5px;
    text-transform: uppercase;
}

.metric-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.ai-section {
    margin-bottom: 15px;
}

.ai-section h4 {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
}

.factor-list,
.level-list {
    list-style: none;
    padding: 0;
    margin-top: 8px;
}

.factor-list li {
    font-size: 13px;
    margin-bottom: 8px;
    padding: 8px 10px;
    position: relative;
    line-height: 1.5;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 4px;
    border-left: 3px solid var(--text-secondary);
    transition: all 0.3s ease;
}

.factor-list li:hover {
    background: rgba(255, 255, 255, 0.07);
    transform: translateX(2px);
}

#bullishFactors li {
    border-left-color: var(--up-color);
    background: linear-gradient(90deg, rgba(14, 203, 129, 0.1) 0%, transparent 100%);
}

#bearishFactors li {
    border-left-color: var(--down-color);
    background: linear-gradient(90deg, rgba(246, 70, 93, 0.1) 0%, transparent 100%);
}

.level-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    padding: 8px 10px;
    margin-bottom: 4px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.level-type {
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.level-price {
    font-family: 'Roboto Mono', monospace;
    color: var(--accent-color);
    font-weight: 700;
}

.ai-verdict {
    margin-top: 20px;
    padding: 20px;
    border-radius: 8px;
    font-size: 15px;
    line-height: 1.6;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.01) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.ai-verdict::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-color), transparent);
}

.verdict-label {
    display: block;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 10px;
    letter-spacing: 1px;
    font-weight: 700;
}

#aiVerdict {
    font-weight: 800;
    font-size: 18px;
    color: #fff;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.4);
    display: block;
    animation: pulse-verdict 2s infinite ease-in-out;
}

@keyframes pulse-verdict {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.02);
        opacity: 0.9;
        text-shadow: 0 0 20px rgba(255, 255, 255, 0.6);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* MODAL */
.modal {
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-color);
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 25px;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
}

.modal-header h2 {
    color: var(--text-primary);
    font-size: 22px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.modal-header p {
    color: var(--text-secondary);
    font-size: 13px;
}

.modal-body {
    padding: 30px 25px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    color: var(--text-secondary);
    font-size: 12px;
    margin-bottom: 8px;
    font-weight: 500;
}

.input-group input {
    width: 100%;
    padding: 14px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s;
}

.input-group input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(252, 213, 53, 0.1);
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 25px;
    color: var(--text-secondary);
    font-size: 13px;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.login-btn {
    width: 100%;
    padding: 14px;
    background: var(--accent-color);
    color: #000;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.login-btn:hover {
    background: #ffd93d;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(252, 213, 53, 0.3);
}

.login-btn:active {
    transform: translateY(0);
}

.login-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.modal-footer {
    padding: 20px 25px;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid var(--border-color);
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

.server-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 12px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #848e9c;
}

.status-text {
    color: var(--text-secondary);
    font-weight: 500;
}

.error-message {
    color: var(--down-color);
    font-size: 13px;
    margin-bottom: 15px;
    text-align: center;
    min-height: 18px;
    font-weight: 500;
}

/* Home Button */
.home-btn {
    position: sticky !important;
    bottom: 0;
    z-index: 99;
    margin-top: auto !important;
    background: linear-gradient(135deg, #ff6b35 0%, #ff8c42 50%, #ffa600 100%);
    width: 100%;
    justify-content: center;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    color: #ffffff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 140, 66, 0.5);
    overflow: hidden;
}

.home-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.3) 50%, transparent 100%);
    transition: left 0.5s ease;
}

.home-btn:hover::before {
    left: 100%;
}

.home-btn:hover {
    background: linear-gradient(135deg, #ff8c42 0%, #ffa600 50%, #ffb732 100%);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 25px rgba(255, 107, 53, 0.6), 0 0 20px rgba(255, 140, 66, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 166, 0, 0.8);
    animation: none;
}

.home-btn:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 10px rgba(255, 107, 53, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

@keyframes glow-pulse {

    0%,
    100% {
        box-shadow: 0 4px 15px rgba(255, 107, 53, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    }

    50% {
        box-shadow: 0 4px 20px rgba(255, 107, 53, 0.6), 0 0 15px rgba(255, 140, 66, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    }
}

.home-btn {
    animation: glow-pulse 3s ease-in-out infinite;
}

/* Close Sidebar Button */
.close-sidebar-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 28px;
    cursor: pointer;
    padding: 5px;
    transition: color 0.3s;
}

.close-sidebar-btn:hover {
    color: var(--accent-color);
}

/* Mobile Menu Button - Premium Style */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #ff6b35 0%, #ff8c42 50%, #ffa600 100%);
    border: 1px solid rgba(255, 140, 66, 0.5);
    border-radius: 8px;
    cursor: pointer;
    padding: 10px;
    z-index: 10;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-menu-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.6);
}

.mobile-menu-btn:active {
    transform: translateY(0);
}

.mobile-menu-btn span {
    width: 100%;
    height: 3px;
    background: #fff;
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-menu-btn.active {
    background: var(--card-bg);
    border-color: var(--border-color);
}

.mobile-menu-btn.active span {
    background: var(--accent-color);
}

.mobile-menu-btn.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* Efeito de Pulso para Alerta Forte */
@keyframes neon-pulse-red {
    0% {
        box-shadow: 0 0 5px rgba(246, 70, 93, 0.2), inset 0 0 10px rgba(246, 70, 93, 0.1);
        border-color: rgba(246, 70, 93, 0.5);
    }

    50% {
        box-shadow: 0 0 20px rgba(246, 70, 93, 0.6), inset 0 0 20px rgba(246, 70, 93, 0.2);
        border-color: #f6465d;
    }

    100% {
        box-shadow: 0 0 5px rgba(246, 70, 93, 0.2), inset 0 0 10px rgba(246, 70, 93, 0.1);
        border-color: rgba(246, 70, 93, 0.5);
    }
}

@keyframes neon-pulse-green {
    0% {
        box-shadow: 0 0 5px rgba(14, 203, 129, 0.2), inset 0 0 10px rgba(14, 203, 129, 0.1);
        border-color: rgba(14, 203, 129, 0.5);
    }

    50% {
        box-shadow: 0 0 20px rgba(14, 203, 129, 0.6), inset 0 0 20px rgba(14, 203, 129, 0.2);
        border-color: #0ecb81;
    }

    100% {
        box-shadow: 0 0 5px rgba(14, 203, 129, 0.2), inset 0 0 10px rgba(14, 203, 129, 0.1);
        border-color: rgba(14, 203, 129, 0.5);
    }
}

.ai-panel-container.alert-bullish {
    animation: neon-pulse-green 2s infinite;
}

.ai-panel-container.alert-bearish {
    animation: neon-pulse-red 2s infinite;
}

/* Blink Text Effect */
.blink-alert {
    animation: blink-text 0.8s infinite alternate;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 8px;
    border-radius: 4px;
    text-align: center;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid currentColor;
    box-shadow: 0 0 10px currentColor;
}

@keyframes blink-text {
    0% {
        opacity: 0.5;
        transform: scale(0.98);
    }

    100% {
        opacity: 1;
        transform: scale(1.02);
    }
}

/* Mobile Responsive Styles - REWORKED (Expanded Breakpoint) */
@media screen and (max-width: 1024px) {
    .mobile-menu-btn {
        display: flex;
    }

    .sidebar {
        position: fixed;
        left: -100% !important;
        top: 0;
        width: 85%;
        max-width: 340px;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 5px 0 25px rgba(0, 0, 0, 0.8);
        padding: 0 0 20px 0;
        display: flex;
        flex-direction: column;
        background-color: var(--sidebar-bg);
        visibility: hidden;
    }

    .sidebar.active {
        left: 0 !important;
        visibility: visible;
    }

    .logo {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 20px 15px;
        background: var(--card-bg);
        border-bottom: 1px solid var(--border-color);
        margin-bottom: 15px;
        position: sticky;
        top: 0;
        z-index: 10;
    }

    .logo h2 {
        margin: 0;
        font-size: 20px;
    }

    .close-sidebar-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        position: relative;
        top: auto;
        right: auto;
        width: 44px;
        height: 44px;
        background-color: rgba(246, 70, 93, 0.15);
        border: 1px solid var(--down-color);
        border-radius: 8px;
        color: var(--down-color);
        font-size: 28px;
        font-weight: bold;
        cursor: pointer;
        flex-shrink: 0;
    }

    .close-sidebar-btn:active {
        background-color: var(--down-color);
        color: white;
    }

    .sidebar>*:not(.logo) {
        padding: 0 15px;
    }

    .dashboard-container {
        flex-direction: column;
        display: flex;
    }

    .main-content {
        width: 100%;
        flex: 1;
        margin-left: 0 !important;
        z-index: 1;
    }

    .chart-container {
        flex: 1;
        min-height: 300px;
        /* Garante um tamanho mínimo no mobile */
        height: 100%;
        touch-action: pan-x pan-y;
    }

    .modal {
        align-items: flex-start;
        padding-top: 20px;
        overflow-y: auto;
    }

    .modal-content {
        width: 95%;
        margin: 0 auto 20px auto;
        max-height: none;
        border-radius: 8px;
        display: flex;
        flex-direction: column;
    }

    .modal-body {
        padding: 20px 15px;
    }

    .input-group input {
        padding: 15px;
        font-size: 16px;
    }

    .login-btn {
        padding: 16px;
        font-size: 16px;
    }

    .sidebar.active::before {
        content: '';
        position: fixed;
        top: 0;
        left: 340px;
        right: 0;
        height: 100vh;
        background: rgba(0, 0, 0, 0.7);
        backdrop-filter: blur(2px);
        z-index: -1;
        pointer-events: auto;
    }
}

/* Chart Tooltip */
.chart-tooltip {
    position: absolute;
    display: none;
    padding: 10px;
    box-sizing: border-box;
    font-size: 12px;
    text-align: left;
    z-index: 1000;
    top: 60px;
    left: 10px;
    pointer-events: none;
    border-radius: 6px;
    background: rgba(20, 24, 30, 0.95);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    color: var(--text-primary);
    max-width: 280px;
    backdrop-filter: blur(4px);
    border-left: 3px solid var(--accent-color);
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tooltip-title {
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 4px;
    color: var(--accent-color);
    display: flex;
    align-items: center;
    gap: 6px;
}

.tooltip-row {
    margin-bottom: 3px;
    line-height: 1.4;
}

.tooltip-label {
    color: var(--text-secondary);
}

.tooltip-value {
    font-weight: 600;
    color: #fff;
}

/* Small Screen Optimization */
@media screen and (max-width: 380px) {
    .sidebar {
        width: 100%;
        max-width: none;
    }

    .timeframe-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .home-btn span {
        display: none;
    }

    .home-btn {
        padding: 8px;
    }

    .modal-content {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
        border: none;
    }
}

/* Otimizações Finais para Mobile */
@media screen and (max-width: 768px) {

    /* Ajuste do Painel de Order Flow para ganhar espaço */
    #orderFlowPanel {
        margin: 10px 0 !important;
        border-radius: 0 !important;
        padding: 10px !important;
    }

    #orderFlowPanel h3 {
        font-size: 13px !important;
    }

    /* Grid mais compacto para estatísticas */
    #orderFlowPanel>div {
        grid-template-columns: repeat(2, 1fr) !important;
        /* Força 2 colunas */
        gap: 8px !important;
    }

    #orderFlowPanel>div>div {
        padding: 8px !important;
    }

    #orderFlowPanel .stat-value,
    #orderFlowPanel .of-value {
        font-size: 14px !important;
    }

    /* Legenda do Gráfico menor */
    .chart-legend {
        font-size: 10px !important;
        padding: 5px !important;
        top: 5px !important;
        left: 5px !important;
        background: rgba(11, 14, 17, 0.85) !important;
        /* Mais contraste */
    }

    .legend-row {
        gap: 8px !important;
    }

    /* Ajuste dos botões de timeframe */
    .timeframe-grid {
        gap: 4px;
    }

    .tf-btn {
        padding: 6px 4px;
        font-size: 11px;
    }

    /* Ajuste da Top Bar Compacta */
    .top-bar {
        padding: 5px 10px;
        min-height: 50px;
        height: auto;
    }

    .symbol-info {
        order: 1;
        text-align: left;
    }

    .symbol-info h1 {
        font-size: 15px;
    }

    .top-widgets {
        order: 2;
        margin-left: auto !important;
    }

    .rsi-multi-box {
        padding: 2px 8px !important;
        gap: 8px !important;
        background: rgba(30, 35, 41, 0.8) !important;
        backdrop-filter: blur(4px);
    }

    .rsi-mini {
        font-size: 10px !important;
        min-width: 35px !important;
    }

    .market-stats {
        order: 3;
        width: 100%;
        margin-top: 5px;
        border-top: 1px solid rgba(255, 255, 255, 0.05);
        padding-top: 5px;
        justify-content: space-between !important;
    }

    .stat-box {
        flex-direction: row;
        gap: 4px;
        align-items: center;
    }
}

/* Telas muito pequenas (iPhone SE, etc) - Reforço */
@media screen and (max-width: 380px) {
    #orderFlowPanel>div {
        grid-template-columns: 1fr !important;
        /* 1 coluna para telas minúsculas */
    }
}

/* Multi-RSI Widget */
.rsi-multi-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #161a1e;
    padding: 6px 12px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.rsi-mini {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 50px;
}

/* Risk Calculator Button */
.sidebar-btn:hover {
    background: var(--hover-bg) !important;
}

/* Close Modal Button */
.close-modal-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

.close-modal-btn:hover {
    color: var(--text-primary);
}

/* Risk Results Highlight */
.risk-results {
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.order-flow-panel {
    background: #1e2329;
    border-radius: 8px;
    padding: 15px;
    margin: 10px;
    color: #eaecef;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
    /* Smooth transition for toggling */
    max-height: 1000px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
    overflow: hidden;
}

.order-flow-panel[style*="display: none"] {
    display: block !important;
    max-height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    opacity: 0 !important;
    border-width: 0 !important;
}

.order-flow-panel h3 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #f0b90b;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.of-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}

.of-card {
    padding: 10px;
    border-radius: 6px;
    transition: transform 0.2s;
}

.of-card:hover {
    transform: translateY(-2px);
}

.of-label {
    font-size: 11px;
    color: #848e9c;
    margin-bottom: 4px;
    font-weight: 600;
    text-transform: uppercase;
}

.of-value {
    font-size: 16px;
    font-weight: 700;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Tooltip System */
[data-tooltip] {
    position: relative;
    cursor: help;
    /* Indicate info available */
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
    pointer-events: none;
    z-index: 100;
    margin-bottom: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    font-weight: 500;
}

[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-2px);
}

/* Specific Toggles adjustment for Tooltips */
.sidebar-group-item {
    position: relative;
    /* Context for tooltip */
}

/* === MOBILE OPTIMIZATIONS FINAL === */
@media (max-width: 1024px) {
    .dashboard-container {
        flex-direction: column;
        overflow-x: hidden;
    }

    /* Fixed Sidebar Off-Canvas */
    .sidebar {
        position: fixed;
        width: 280px;
        height: 100vh;
        left: -280px;
        top: 0;
        z-index: 9999;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 4px 0 15px rgba(0, 0, 0, 0.5);
    }

    .sidebar.active {
        left: 0;
    }

    .sidebar.active~.main-content::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9998;
        backdrop-filter: blur(2px);
    }

    .main-content {
        width: 100%;
        margin-left: 0;
        height: auto;
        min-height: 100vh;
    }

    .top-bar {
        position: sticky;
        top: 0;
        z-index: 100;
        background: var(--bg-secondary);
        padding: 5px 10px;
        border-bottom: 1px solid var(--border-color);
        flex-wrap: wrap;
    }

    .mobile-menu-btn {
        display: flex !important;
        flex-direction: column;
        justify-content: space-around;
        width: 24px;
        height: 18px;
        background: transparent;
        border: none;
        cursor: pointer;
        padding: 0;
        z-index: 101;
    }

    .mobile-menu-btn span {
        width: 100%;
        height: 2px;
        background: var(--text-primary);
        border-radius: 2px;
        transition: 0.3s;
    }

    .mobile-menu-btn.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .mobile-menu-btn.active span:nth-child(2) {
        opacity: 0;
    }

    .mobile-menu-btn.active span:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -5px);
    }

    .symbol-info h1 {
        font-size: 16px;
        margin: 0;
    }

    .market-stats {
        display: none !important;
        /* Hide stats on mobile to save space */
    }

    /* Adjust Chart Height */
    .chart-container {
        height: 60vh;
        /* Default height for mobile */
        min-height: 400px;
    }

    .order-flow-panel {
        height: auto;
        max-height: 200px;
        padding-bottom: 60px;
        /* Space for bottom navigation if any */
    }

    .of-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 5px;
    }

    .of-card {
        padding: 5px;
    }

    .of-label {
        font-size: 8px;
    }

    .of-value {
        font-size: 10px;
    }
}

@media (min-width: 1025px) {
    .mobile-menu-btn {
        display: none !important;
    }
}