/* Trading Bot Dashboard Styles */

:root {
    --primary: #667eea;
    --primary-dark: #5a67d8;
    --success: #48bb78;
    --danger: #f56565;
    --warning: #ed8936;
    --info: #4299e1;
    --dark: #1a202c;
    --dark-secondary: #2d3748;
    --dark-tertiary: #4a5568;
    --light: #f7fafc;
    --text: #e2e8f0;
    --text-secondary: #cbd5e0;
    --border: #4a5568;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--dark-secondary) 0%, #1a202c 100%);
    padding: 20px 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5),
                0 0 50px rgba(102, 126, 234, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    border: 1px solid rgba(102, 126, 234, 0.2);
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -50%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.05), transparent);
    animation: header-shine 8s ease-in-out infinite;
}

@keyframes header-shine {
    0%, 100% { left: -50%; }
    50% { left: 100%; }
}

.header h1 {
    font-size: 28px;
    background: linear-gradient(135deg, var(--primary), var(--info));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
    z-index: 1;
    text-shadow: 0 0 30px rgba(102, 126, 234, 0.3);
    filter: drop-shadow(0 0 10px rgba(102, 126, 234, 0.5));
}

.header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mode-badge {
    position: relative;
    background: linear-gradient(135deg, #feca57 0%, #ff9f43 100%);
    color: var(--dark);
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 14px;
    border: none;
    cursor: default;
    box-shadow: 0 4px 15px rgba(254, 202, 87, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    overflow: hidden;
}

.mode-badge::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s;
}

.mode-badge.mode-toggle {
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.mode-badge.mode-toggle:hover::before {
    left: 100%;
}

.mode-badge.mode-toggle:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 20px rgba(254, 202, 87, 0.5),
                0 0 25px rgba(254, 202, 87, 0.2);
    background: linear-gradient(135deg, #fed330 0%, #ffb142 100%);
}

.mode-badge.real-mode {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(72, 187, 120, 0.3);
}

.mode-badge.real-mode:hover {
    box-shadow: 0 6px 20px rgba(72, 187, 120, 0.5),
                0 0 25px rgba(72, 187, 120, 0.2);
    background: linear-gradient(135deg, #51cf85 0%, #3cb371 100%);
}

.mode-badge:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.balance-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.balance {
    font-weight: 700;
    color: var(--success);
    font-size: 16px;
    padding: 10px 18px;
    background: rgba(72, 187, 120, 0.1);
    border-radius: 10px;
    border: 2px solid rgba(72, 187, 120, 0.3);
    text-shadow: 0 0 10px rgba(72, 187, 120, 0.3);
    letter-spacing: 0.5px;
}

.btn-reset-capital {
    position: relative;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 15px rgba(245, 87, 108, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    overflow: hidden;
}

.btn-reset-capital::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s;
}

.btn-reset-capital:hover::before {
    left: 100%;
}

.btn-reset-capital:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(245, 87, 108, 0.6),
                0 0 30px rgba(245, 87, 108, 0.3);
    background: linear-gradient(135deg, #f5a3fd 0%, #f7677c 100%);
}

.btn-logout {
    position: relative;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 15px rgba(245, 101, 101, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    overflow: hidden;
}

.btn-logout::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s;
}

.btn-logout:hover::before {
    left: 100%;
}

.btn-logout:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(245, 101, 101, 0.6),
                0 0 30px rgba(245, 101, 101, 0.3);
    background: linear-gradient(135deg, #ff7b7b 0%, #f06a7f 100%);
}

/* Main Content */
.main-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

/* Cards */
.card {
    background: var(--dark-secondary);
    border-radius: 15px;
    padding: 25px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.card h2 {
    margin-bottom: 20px;
    color: var(--primary);
    font-size: 20px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 10px;
}

/* Status Card */
.status-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.status-item {
    background: var(--dark);
    padding: 15px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
}

.status-label {
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.status-value {
    color: var(--text);
    font-size: 18px;
    font-weight: 600;
}

/* Control Panel */
.config-form {
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
}

.form-group input[type="text"],
.form-group input[type="number"] {
    width: 100%;
    padding: 12px;
    background: var(--dark);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    transition: all 0.3s;
}

/* Symbol autocomplete styling */
#symbol {
    background: var(--dark);
    color: var(--text);
    padding-left: 12px;
}

#symbol::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.control-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
}

.btn-start {
    background: var(--success);
    color: white;
}

.btn-start:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(72, 187, 120, 0.4);
}

.btn-stop {
    background: var(--danger);
    color: white;
}

.btn-stop:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(245, 101, 101, 0.4);
}

.btn-pause,
.btn-resume {
    background: var(--warning);
    color: white;
}

.btn-pause:hover,
.btn-resume:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(237, 137, 54, 0.4);
}

/* Stats Card */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.stat-item {
    background: var(--dark);
    padding: 15px;
    border-radius: 10px;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 12px;
    display: block;
    margin-bottom: 5px;
}

.stat-value {
    color: var(--text);
    font-size: 18px;
    font-weight: 600;
}

.stat-value.profit {
    color: var(--success);
}

/* Trades Card */
.trades-container {
    max-height: 400px;
    overflow-y: auto;
}

.trade-item {
    background: var(--dark);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 10px;
    border-left: 4px solid var(--primary);
}

.trade-item.buy {
    border-left-color: var(--success);
}

.trade-item.sell {
    border-left-color: var(--danger);
}

.trade-item.dca-order {
    border-left-width: 6px;
    background: linear-gradient(135deg, var(--dark) 0%, rgba(102, 126, 234, 0.1) 100%);
}

.trade-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.trade-side {
    font-weight: 600;
    font-size: 16px;
}

.trade-side.buy {
    color: var(--success);
}

.trade-side.sell {
    color: var(--danger);
}

.trade-details {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Feed Card */
.feed-container {
    max-height: 300px;
    overflow-y: auto;
}

.feed-item {
    background: var(--dark);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 13px;
    border-left: 3px solid var(--info);
}

.feed-item.success {
    border-left-color: var(--success);
}

.feed-item.error {
    border-left-color: var(--danger);
}

.feed-item.warning {
    border-left-color: var(--warning);
}

.feed-time {
    color: var(--text-secondary);
    font-size: 11px;
    margin-bottom: 4px;
}

.no-data {
    text-align: center;
    color: var(--text-secondary);
    padding: 20px;
}

/* Connection Status */
.connection-status {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--dark-secondary);
    padding: 10px 20px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--danger);
    animation: pulse 2s infinite;
}

.connection-status.connected .status-dot {
    background: var(--success);
}

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

.status-text {
    font-size: 12px;
    font-weight: 600;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--dark);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--dark-tertiary);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border);
}

/* Responsive */
@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

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

/* Active Bots List */
.bots-list-card {
    grid-column: 1 / -1;
}

.bots-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.bot-item {
    background: var(--dark-tertiary);
    padding: 15px;
    border-radius: 10px;
    border: 2px solid var(--border);
    transition: all 0.3s ease;
}

.bot-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.bot-item.running {
    border-color: var(--success);
}

.bot-item.paused {
    border-color: var(--warning);
}

.bot-item.stopped {
    border-color: var(--danger);
}

.bot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.bot-symbol {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

.bot-status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.bot-status-badge.running {
    background: var(--success);
    color: white;
}

.bot-status-badge.paused {
    background: var(--warning);
    color: white;
}

.bot-status-badge.stopped {
    background: var(--danger);
    color: white;
}

.bot-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 10px 0;
    font-size: 13px;
}

.bot-stat {
    display: flex;
    flex-direction: column;
}

.bot-stat-label {
    color: var(--text-secondary);
    font-size: 11px;
    text-transform: uppercase;
}

.bot-stat-value {
    color: var(--text);
    font-weight: 600;
}

/* Trading Fees Section - Bot Card */
.bot-fees-section {
    margin-top: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.bot-fees-header {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 10px;
    text-align: center;
}

.bot-fees-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.bot-fee-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.bot-fee-item.total {
    grid-column: 1 / -1;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    margin-top: 4px;
}

.fee-label {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.fee-value {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
}

/* Trading Fees Breakdown - Modal */
.fees-breakdown {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.fee-breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.fee-breakdown-item.total-fees {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(255, 193, 7, 0.1) 100%);
    border-color: var(--warning);
}

.fee-breakdown-item.fee-percentage {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(33, 150, 243, 0.1) 100%);
    border-color: var(--info);
}

.fee-breakdown-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text);
}

.fee-icon {
    font-size: 18px;
}

.fee-breakdown-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.bot-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.bot-btn {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.bot-btn:hover {
    transform: translateY(-1px);
    opacity: 0.9;
}

.bot-btn.stop {
    background: var(--danger);
    color: white;
}

.bot-btn.pause {
    background: var(--warning);
    color: white;
}

.bot-btn.resume {
    background: var(--success);
    color: white;
}

.bot-btn.close-position {
    background: #ff6b35;
    color: white;
}

.bot-btn.close-position:hover {
    background: #e55a2b;
}

.bot-btn.delete {
    background: #dc3545;
    color: white;
}

.bot-btn.delete:hover {
    background: #c82333;
}

.bot-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}


/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal.show {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: var(--dark-secondary);
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

.modal-header h2 {
    color: var(--text);
    font-size: 24px;
    margin: 0;
}

#modal-symbol {
    color: var(--primary);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text);
    font-size: 32px;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: var(--danger);
    transform: rotate(90deg);
}

.modal-body {
    padding: 30px;
}

#config-form .form-group {
    margin-bottom: 20px;
}

#config-form .form-group label {
    display: block;
    color: var(--text);
    font-weight: 600;
    margin-bottom: 8px;
}

#config-form .form-group input[type="number"],
#config-form .form-group input[type="text"] {
    width: 100%;
    padding: 12px;
    background: var(--dark-tertiary);
    border: 2px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    transition: all 0.3s ease;
}

#config-form .form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#config-form .form-group input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
    cursor: pointer;
}

.form-hint {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 5px;
}

.modal-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid var(--border);
}

.modal-actions .btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-cancel {
    background: var(--dark-tertiary);
    color: var(--text);
}

.btn-cancel:hover {
    background: var(--border);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* Add Configure button to bot actions */
.bot-btn.configure {
    background: var(--info);
    color: white;
}

#trailing-stop-group {
    display: none;
}

#trailing-stop-group.show {
    display: block;
}

/* Bots Header with Emergency Button */
.bots-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.bots-header h2 {
    margin: 0;
}

.btn-emergency {
    background: linear-gradient(135deg, #f56565 0%, #c53030 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(245, 101, 101, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-emergency:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 101, 101, 0.5);
    background: linear-gradient(135deg, #c53030 0%, #9b2c2c 100%);
}

.btn-emergency:active {
    transform: translateY(0);
}

.btn-emergency:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Emergency Confirmation Modal */
#emergency-modal .modal-header {
    background: var(--danger);
    color: white;
}

#emergency-modal .warning-icon {
    font-size: 48px;
    text-align: center;
    margin: 20px 0;
}

#emergency-modal .warning-text {
    text-align: center;
    font-size: 18px;
    color: var(--text);
    margin-bottom: 20px;
}

#emergency-modal .bot-count {
    background: var(--dark-tertiary);
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    margin: 20px 0;
    border: 2px solid var(--danger);
}

#emergency-modal .bot-count strong {
    color: var(--danger);
    font-size: 24px;
}

/* Bots Actions Group */
.bots-actions {
    display: flex;
    gap: 15px;
}

.btn-pause-all {
    background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(237, 137, 54, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-pause-all:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(237, 137, 54, 0.5);
    background: linear-gradient(135deg, #dd6b20 0%, #c05621 100%);
}

.btn-pause-all.paused {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    box-shadow: 0 4px 15px rgba(72, 187, 120, 0.3);
}

.btn-pause-all.paused:hover {
    box-shadow: 0 6px 20px rgba(72, 187, 120, 0.5);
    background: linear-gradient(135deg, #38a169 0%, #2f855a 100%);
}

.btn-pause-all:active {
    transform: translateY(0);
}

.btn-pause-all:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ============================================================================
   Settings Button
   ============================================================================ */

.btn-guide {
    position: relative;
    background: linear-gradient(135deg, #00d4aa 0%, #00a8cc 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 15px rgba(0, 212, 170, 0.4),
                0 0 20px rgba(0, 212, 170, 0.1);
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-guide::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s;
}

.btn-guide:hover::before {
    left: 100%;
}

.btn-guide:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 212, 170, 0.6),
                0 0 30px rgba(0, 212, 170, 0.3),
                inset 0 0 20px rgba(255, 255, 255, 0.1);
    background: linear-gradient(135deg, #00e6c0 0%, #00c4e0 100%);
}

.btn-guide:active {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 4px 15px rgba(0, 212, 170, 0.5);
}

@keyframes pulse-guide {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(0, 212, 170, 0.4),
                    0 0 20px rgba(0, 212, 170, 0.1);
    }
    50% {
        box-shadow: 0 4px 15px rgba(0, 212, 170, 0.6),
                    0 0 30px rgba(0, 212, 170, 0.3);
    }
}

.btn-guide {
    animation: pulse-guide 3s ease-in-out infinite;
}

.btn-settings {
    position: relative;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    overflow: hidden;
}

.btn-settings::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s;
}

.btn-settings:hover::before {
    left: 100%;
}

.btn-settings:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6),
                0 0 30px rgba(102, 126, 234, 0.3);
    background: linear-gradient(135deg, #768fec 0%, #865bb4 100%);
}

.btn-settings:active {
    transform: translateY(-1px) scale(1.02);
}

/* ============================================================================
   Settings Modal
   ============================================================================ */

.settings-modal-content {
    max-width: 800px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
}

.settings-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0;
    flex-wrap: wrap;
}

.settings-tab {
    background: none;
    border: none;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}

.settings-tab:hover {
    color: var(--primary);
    background: rgba(102, 126, 234, 0.05);
}

.settings-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.settings-panel {
    display: none;
    animation: fadeIn 0.3s ease;
}

.settings-panel.active {
    display: block;
}

.settings-panel h3 {
    color: var(--text-primary);
    margin-bottom: 10px;
    font-size: 20px;
}

.settings-description {
    color: var(--text-secondary);
    margin-bottom: 25px;
    padding: 15px;
    background: var(--background-light);
    border-radius: 8px;
    border-left: 4px solid var(--primary);
}

.settings-description strong {
    color: var(--primary);
}

.settings-panel .form-group {
    margin-bottom: 20px;
}

.settings-panel label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.settings-panel input[type="text"],
.settings-panel input[type="email"],
.settings-panel input[type="password"],
.settings-panel input[type="number"] {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
    background: var(--card-bg);
    color: var(--text-primary);
}

.settings-panel input[type="text"]:focus,
.settings-panel input[type="email"]:focus,
.settings-panel input[type="password"]:focus,
.settings-panel input[type="number"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.settings-panel input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    cursor: pointer;
    vertical-align: middle;
}

.settings-panel small {
    display: block;
    margin-top: 5px;
    color: var(--text-secondary);
    font-size: 12px;
}

.settings-panel small a {
    color: var(--primary);
    text-decoration: none;
}

.settings-panel small a:hover {
    text-decoration: underline;
}

.settings-actions {
    display: flex;
    gap: 10px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.btn-test {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(72, 187, 120, 0.3);
}

.btn-test:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.5);
}

.btn-test:active {
    transform: translateY(0);
}

.btn-test:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Responsive */
@media (max-width: 768px) {
    .settings-tabs {
        flex-direction: column;
        gap: 5px;
    }

    .settings-tab {
        text-align: left;
        border-left: 3px solid transparent;
        border-bottom: none;
        margin-bottom: 0;
        margin-left: -2px;
    }

    .settings-tab.active {
        border-left-color: var(--primary);
        border-bottom-color: transparent;
    }

    .settings-actions {
        flex-direction: column;
    }

    .settings-actions button {
        width: 100%;
    }
}

/* ============================================================================
   Trade History Modal
   ============================================================================ */

.trades-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.trades-header h2 {
    margin: 0;
}

.btn-view-history {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(245, 87, 108, 0.3);
}

.btn-view-history:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 87, 108, 0.5);
}

.history-modal-content {
    max-width: 1400px;
    width: 95%;
    max-height: 95vh;
    overflow-y: auto;
}

/* History Filters */
.history-filters {
    background: var(--background-light);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    border: 2px solid var(--border);
}

.filter-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.filter-row:last-child {
    margin-bottom: 0;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-size: 14px;
}

.filter-group select,
.filter-group input[type="date"],
.filter-group input[type="number"] {
    padding: 10px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
    background: var(--card-bg);
    color: var(--text-primary);
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.filter-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
}

/* History Stats */
.history-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.history-stat-item {
    background: var(--background-light);
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid var(--primary);
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.history-stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 600;
}

.history-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.history-stat-value.profit {
    color: var(--success);
}

.history-stat-value.loss {
    color: var(--danger);
}

/* History Table */
.history-table-container {
    overflow-x: auto;
    margin-bottom: 20px;
    border-radius: 12px;
    border: 2px solid var(--border);
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
}

.history-table thead {
    background: var(--background-light);
    position: sticky;
    top: 0;
    z-index: 10;
}

.history-table th {
    padding: 15px;
    text-align: left;
    font-weight: 700;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border);
    cursor: pointer;
    user-select: none;
    transition: background 0.3s ease;
}

.history-table th:hover {
    background: rgba(102, 126, 234, 0.1);
}

.history-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

.history-table tbody tr {
    transition: background 0.3s ease;
}

.history-table tbody tr:hover {
    background: var(--background-light);
}

.history-table .trade-buy {
    color: var(--success);
    font-weight: 600;
}

.history-table .trade-sell {
    color: var(--danger);
    font-weight: 600;
}

.history-table .profit-positive {
    color: var(--success);
    font-weight: 600;
}

.history-table .profit-negative {
    color: var(--danger);
    font-weight: 600;
}

.history-table .mode-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.history-table .mode-paper {
    background: var(--warning);
    color: var(--dark);
}

.history-table .mode-real {
    background: var(--success);
    color: white;
}

/* Pagination */
.history-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
}

.pagination-info {
    font-weight: 600;
    color: var(--text-primary);
}

/* Responsive */
@media (max-width: 768px) {
    .history-modal-content {
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .filter-row {
        grid-template-columns: 1fr;
    }

    .filter-actions {
        flex-direction: column;
    }

    .filter-actions button {
        width: 100%;
    }

    .history-stats {
        grid-template-columns: 1fr;
    }

    .history-table-container {
        overflow-x: scroll;
    }

    .history-table {
        min-width: 800px;
    }

    .history-pagination {
        flex-direction: column;
        gap: 10px;
    }

    .trades-header {
        flex-direction: column;
        gap: 10px;
    }

    .btn-view-history {
        width: 100%;
    }
}

/* ============================================================================
   Reset Capital Modal
   ============================================================================ */

.modal-description {
    background: var(--background-light);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid var(--primary);
    color: var(--text-primary);
}

.warning-box {
    background: rgba(245, 87, 108, 0.1);
    border-left: 4px solid var(--danger);
    padding: 15px;
    border-radius: 8px;
    margin: 20px 0;
}

.warning-box strong {
    color: var(--danger);
    display: block;
    margin-bottom: 10px;
}

.warning-box ul {
    margin: 0;
    padding-left: 20px;
    color: var(--text-primary);
}

.warning-box li {
    margin: 5px 0;
}

/* Bot Info Modal Styles */
.bot-info-section {
    margin-bottom: 30px;
}

.bot-info-section h3 {
    color: var(--primary);
    margin-bottom: 15px;
    font-size: 1.2em;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 8px;
}

.bot-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.info-item {
    background: var(--dark-secondary);
    padding: 12px 15px;
    border-radius: 8px;
    border-left: 3px solid var(--primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.info-label {
    color: var(--text-secondary);
    font-size: 0.9em;
    font-weight: 500;
}

.info-value {
    color: var(--text);
    font-weight: 600;
    font-size: 1.1em;
}

.info-value.success {
    color: var(--success);
}

.info-value.danger {
    color: var(--danger);
}

.info-value.warning {
    color: var(--warning);
}

/* Trades List in Modal */
.trades-list-modal {
    max-height: 500px;
    overflow-y: auto;
    padding-right: 10px;
}

.trade-item-modal {
    background: var(--dark-secondary);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    border-left: 4px solid var(--primary);
    transition: transform 0.2s, box-shadow 0.2s;
}

.trade-item-modal:hover {
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.trade-item-modal.buy {
    border-left-color: var(--success);
}

.trade-item-modal.sell {
    border-left-color: var(--danger);
}

.trade-item-modal.dca-order {
    border-left-width: 6px;
    background: linear-gradient(135deg, var(--dark-secondary) 0%, rgba(102, 126, 234, 0.1) 100%);
}

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

.trade-side-modal {
    font-weight: 700;
    font-size: 1.1em;
    padding: 4px 12px;
    border-radius: 5px;
}

.trade-side-modal.buy {
    background: rgba(72, 187, 120, 0.2);
    color: var(--success);
}

.trade-side-modal.sell {
    background: rgba(245, 101, 101, 0.2);
    color: var(--danger);
}

.trade-time {
    color: var(--text-secondary);
    font-size: 0.85em;
}

.trade-details-modal {
    display: grid;
    gap: 8px;
}

.trade-details-modal > div {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
}

.trade-details-modal strong {
    color: var(--text-secondary);
    font-weight: 500;
}

/* Info Button Styling */
.bot-btn.info {
    background: var(--info);
    color: white;
}

.bot-btn.info:hover {
    background: #3182ce;
    transform: translateY(-2px);
}

/* Scrollbar for modal */
.trades-list-modal::-webkit-scrollbar {
    width: 8px;
}

.trades-list-modal::-webkit-scrollbar-track {
    background: var(--dark);
    border-radius: 10px;
}

.trades-list-modal::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

.trades-list-modal::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* Error message styling */
.error-msg {
    color: var(--danger);
    padding: 20px;
    text-align: center;
    background: rgba(245, 101, 101, 0.1);
    border-radius: 8px;
    border: 1px solid var(--danger);
}

/* DCA Progress Bar Styles */
.dca-progress-container {
    margin-top: 20px;
    padding: 15px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 10px;
    border: 1px solid rgba(102, 126, 234, 0.3);
}

.dca-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.dca-progress-label {
    font-weight: 600;
    color: var(--primary);
    font-size: 0.95em;
}

.dca-progress-text {
    font-weight: 700;
    color: var(--text);
    font-size: 1.1em;
    background: var(--dark-secondary);
    padding: 4px 12px;
    border-radius: 5px;
}

.dca-progress-bar {
    height: 30px;
    background: var(--dark-secondary);
    border-radius: 15px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.dca-progress-fill {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: width 0.5s ease, background 0.3s ease;
    border-radius: 15px;
    position: relative;
    background: linear-gradient(90deg, var(--success) 0%, var(--success) 100%);
    box-shadow: 0 2px 8px rgba(72, 187, 120, 0.5);
}

.dca-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 100%
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.dca-progress-percentage {
    font-size: 0.75em;
    font-weight: 700;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    position: relative;
    z-index: 1;
}

.dca-progress-info {
    margin-top: 8px;
    font-size: 0.85em;
    color: var(--text-secondary);
    text-align: center;
    font-weight: 500;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .dca-progress-bar {
        height: 25px;
    }
    
    .dca-progress-text {
        font-size: 1em;
    }
}

/* Animation for progress bar when it updates */
.dca-progress-fill.updated {
    animation: pulse 0.5s ease;
}

@keyframes pulse {
    0%, 100% {
        transform: scaleY(1);
    }
    50% {
        transform: scaleY(1.1);
    }
}

/* Cycles Badge Styles */
.bot-header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.cycles-badge {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 50%;
    padding: 8px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    border: 3px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: help;
}

.cycles-badge:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.6);
}

.cycles-number {
    font-size: 1.5em;
    font-weight: 700;
    color: white;
    line-height: 1;
}

.cycles-label {
    font-size: 0.65em;
    color: rgba(255, 255, 255, 0.9);
    text-transform: uppercase;
    font-weight: 600;
    margin-top: 2px;
}

/* Responsive adjustments for cycles badge */
@media (max-width: 768px) {
    .cycles-badge {
        min-width: 50px;
        height: 50px;
    }

    .cycles-number {
        font-size: 1.2em;
    }

    .cycles-label {
        font-size: 0.6em;
    }
}
