/* ===========================
   Modal Overlay & Containers
   =========================== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: rgba(6, 11, 25, 0.82);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    overflow-y: auto;
}

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

.modal-content {
    position: relative;
    width: min(880px, 100%);
    max-height: 90vh;
    overflow-y: auto;
    background: var(--card1-bg, var(--background-color));
    border-radius: 20px;
    border: var(--card1-border-width, 1px) solid var(--card1-border-color, var(--border-color));
    box-shadow: 0 24px 60px rgba(2, 6, 23, 0.6);
    padding: 2rem;
    color: var(--cor-texto, #f9fafb);
}

.modal-content.create-trader-modal {
    width: min(860px, 100%);
}

.modal-content::-webkit-scrollbar {
    width: 6px;
}

.modal-content::-webkit-scrollbar-track {
    background: transparent;
}

.modal-content::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.35);
    border-radius: 999px;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    color: var(--cor-texto, #f3f4f6);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s ease;
}

.modal-close:hover {
    background: rgba(93, 217, 45, 0.15);
    color: var(--primary-color, #5dd92d);
    transform: rotate(90deg);
}

.modal-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--cor-texto, #f9fafb);
}

.modal-description {
    font-size: 1rem;
    color: rgba(226, 232, 240, 0.75);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(148, 163, 184, 0.15);
}

.modal-actions .btn {
    min-width: 140px;
}

/* ===========================
   Form Elements
   =========================== */
.form-group {
    margin-bottom: 0.9rem;
}

.form-label {
    display: block;
    margin-bottom: 0.45rem;
    font-weight: 600;
    font-size: 0.95rem;
    color: rgba(226, 232, 240, 0.85);
}

.form-input,
.form-select {
    width: 100%;
    padding: 0.75rem;
    background: var(--card2-bg, var(--card-bg, rgba(17, 24, 39, 0.85)));
    border: var(--card2-border-width, 1px) solid var(--card2-border-color, rgba(148, 163, 184, 0.25));
    border-radius: 10px;
    color: var(--cor-texto, #f9fafb);
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary-color, #5dd92d);
    box-shadow: 0 0 0 2px rgba(93, 217, 45, 0.18);
}

.form-select option {
    background: var(--card-bg, #0f172a);
    color: var(--cor-texto, #f9fafb);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    color: rgba(226, 232, 240, 0.9);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color, #5dd92d);
}

.form-range {
    width: 100%;
    height: 6px;
    background: rgba(15, 23, 42, 0.85);
    border-radius: 999px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary-color, #5dd92d);
    border-radius: 50%;
    cursor: pointer;
}

.form-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--primary-color, #5dd92d);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.form-range-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.35rem;
    font-size: 0.8rem;
    color: rgba(148, 163, 184, 0.75);
}

.form-help-text {
    font-size: 0.85rem;
    color: rgba(96, 165, 250, 0.9);
    margin-top: 0.25rem;
}

/* ===========================
   Collections (Assets, Timeframes)
   =========================== */
.assets-container,
.timeframes-container {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 12px;
    padding: 1rem;
    max-height: 220px;
    overflow-y: auto;
}

.assets-grid,
.timeframes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.4rem 0.55rem;
}

.asset-checkbox,
.timeframe-checkbox {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    color: rgba(226, 232, 240, 0.82);
}

.asset-checkbox input,
.timeframe-checkbox input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary-color, #5dd92d);
}

.asset-message {
    grid-column: 1 / -1;
    text-align: center;
    color: rgba(148, 163, 184, 0.7);
    font-size: 0.9rem;
    padding: 1.25rem 0;
}

/* ===========================
   Alerts & Feedback
   =========================== */
.alert {
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1.2rem;
}

.alert-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #f87171;
}

.loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-left: 0.5rem;
}

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

/* ===========================
   Strategy Selection Modal
   =========================== */
.strategy-modal .modal-content {
    max-width: 640px;
    padding: 2.5rem;
}

.strategy-modal .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.strategy-modal .modal-description {
    text-align: center;
    margin-bottom: 2.5rem;
}

.estrategia-buttons {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
}

.strategy-modal .modal-content button.btn-estrategia {
    width: 100%;
}

.btn-estrategia {
    position: relative;
    overflow: hidden;
    border: 2px solid rgba(148, 163, 184, 0.25);
    border-radius: 18px;
    padding: 2.25rem 1.5rem;
    background: var(--fundo-geral, rgba(15, 23, 42, 0.8));
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--cor-texto, rgba(226, 232, 240, 0.92));
    animation: pulse 2.8s infinite;
    box-shadow: 0 20px 35px rgba(93, 217, 45, 0.12);
}

.btn-estrategia::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--btn-destaque-bg, linear-gradient(135deg, var(--cor-primaria, #667eea), var(--cor-secundaria, #764ba2)));

    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

.btn-estrategia:hover {
    transform: translateY(-6px);
    border-color: transparent;
    box-shadow: 0 24px 45px rgba(93, 217, 45, 0.28);
    background: var(--btn-destaque-bg, linear-gradient(135deg, var(--cor-primaria, #667eea), var(--cor-secundaria, #764ba2)));
}

.btn-estrategia:hover::before {
    opacity: 0.75;
}

.estrategia-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--cor-primaria, var(--primary-color, #5dd92d));
    transition: filter 0.3s ease;
    z-index: 1;
}

.btn-estrategia:hover .estrategia-icon {
    color: var(--cor-primaria, var(--primary-color, #5dd92d));
    animation: rotateIcon 0.6s ease;
    filter: drop-shadow(0 8px 18px rgba(93, 217, 45, 0.45));
}

.estrategia-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: inherit;
    z-index: 1;
}

.estrategia-description {
    font-size: 0.9rem;
    color: rgba(226, 232, 240, 0.7);
    z-index: 1;
}

@keyframes rotateIcon {
    0% {
        transform: rotateY(0deg) scale(1);
    }
    50% {
        transform: rotateY(180deg) scale(1.08);
    }
    100% {
        transform: rotateY(360deg) scale(1);
    }
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.35);
    }
    50% {
        box-shadow: 0 0 0 16px rgba(102, 126, 234, 0);
    }
}

/* ===========================
   Config Tabs (Trader Config Modal)
   =========================== */
.config-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid rgba(148, 163, 184, 0.15);
}

.config-tab {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: rgba(148, 163, 184, 0.75);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.config-tab:hover,
.config-tab.active {
    color: var(--primary-color, #5dd92d);
}

.config-tab.active {
    border-bottom-color: var(--primary-color, #5dd92d);
}

.config-tab-content {
    display: none;
}

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

/* ===========================
   Responsive Adjustments
   =========================== */
@media (max-width: 768px) {
    .modal-content {
        padding: 1.75rem 1.5rem;
        width: min(640px, 100%);
    }

    .modal-title {
        font-size: 1.6rem;
    }

    .estrategia-buttons {
        grid-template-columns: 1fr;
    }

    .assets-grid,
    .timeframes-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 639px) {
    .modal-overlay {
        height: calc(100% - 60px);
        bottom: 60px;
        align-items: flex-start;
        padding-top: 1rem;
    }

    .modal-content {
        max-height: calc(100vh - 80px);
        margin-bottom: 60px;
    }
}

@media (max-width: 480px) {
    .modal-content {
        padding: 1.5rem 1.25rem;
        border-radius: 18px;
    }

    .modal-close {
        top: 0.75rem;
        right: 0.75rem;
    }

    .modal-actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .assets-grid,
    .timeframes-grid {
        grid-template-columns: 1fr;
    }
}

