/* ===================================
   GHOST_TRADES - GHOST AI BOT
   Bot Interface, Controls, Logs, and History
   =================================== */

/* --- Ghost AI Interface --- */
.ghostai-interface {
    display: none;
    animation: fadeInUp 0.5s ease;
}

.bot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-lg) 0;
    margin-bottom: var(--spacing-xl);
    border-bottom: 2px solid var(--glass-border);
}

.bot-title-section {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.bot-title-section h2 {
    font-size: 1.75rem;
}

.bot-strategy-badge {
    background: var(--primary-color);
    color: white;
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bot-profit-display {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md) var(--spacing-lg);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.profit-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: var(--spacing-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.profit-value {
    font-size: 1.75rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-secondary);
    transition: color var(--transition-base);
}

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

.profit-value.pl-loss {
    color: var(--error-color);
}

.bot-grid {
    display: grid;
    grid-template-columns: 320px 1fr 1fr;
    grid-template-areas: "controls status history";
    gap: var(--spacing-lg);
    min-height: 600px;
}

.bot-controls {
    grid-area: controls;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.bot-controls h4 {
    margin-bottom: var(--spacing-sm);
}

.btn-bot {
    padding: var(--spacing-md);
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    margin-top: auto;
}

.btn-start {
    background: linear-gradient(135deg, var(--success-color), var(--success-light));
    color: white;
}

.btn-start:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(16, 185, 129, 0.3);
}

.btn-stop {
    background: linear-gradient(135deg, var(--error-color), var(--error-light));
    color: white;
}

.btn-stop:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(239, 68, 68, 0.3);
}

.bot-status-container {
    grid-area: status;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.bot-status {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-md);
}

.bot-log {
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
    height: 400px;
    max-height: 400px;
    min-height: 200px;
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    overflow-y: auto;
    font-size: 0.8125rem;
    line-height: 1.8;
}

.log-win {
    color: var(--success-color);
    font-weight: 600;
}

.log-loss {
    color: var(--error-color);
    font-weight: 600;
}

.log-trade {
    color: #3b82f6;
}

.bot-history {
    grid-area: history;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

/* --- Bot Control Panel (Deriv Style) --- */
.bot-control-panel {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 15px;
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bot-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
}

.indicator-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #666;
}

.bot-running .indicator-dot {
    background: var(--success-color);
    box-shadow: 0 0 10px var(--success-glow);
}

/* --- Bot Interface Responsive --- */
@media (max-width: 1400px) {
    .bot-grid {
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "controls status"
            "controls history";
    }
}

@media (max-width: 1024px) {
    .bot-grid {
        grid-template-columns: 1fr;
        grid-template-areas:
            "controls"
            "status"
            "history";
    }
}

@media (max-width: 768px) {
    .bot-header-section {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .bot-profit-display {
        width: 100%;
        justify-content: space-between;
    }

    .bot-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

@media (max-width: 640px) {
    .bot-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-md);
    }

    .bot-controls,
    .bot-status,
    .bot-history {
        padding: var(--spacing-lg);
    }
}

/* --- Live Contract Monitor --- */
#live-contracts-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    padding: var(--spacing-sm);
}

.no-contracts {
    color: var(--text-muted);
    font-size: 0.875rem;
    text-align: center;
    padding: var(--spacing-xl) 0;
    font-style: italic;
}

@media (max-width: 480px) {
    .live-contract-card {
        padding: 8px;
        margin-bottom: 6px;
    }

    .contract-header {
        font-size: 0.8rem;
    }

    .ticks-visual {
        gap: 2px;
    }

    .tick-circle {
        width: 18px;
        height: 18px;
        font-size: 10px;
    }

    .contract-footer {
        font-size: 0.75rem;
    }
}

.live-contract-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    transition: all var(--transition-base);
}

.live-contract-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--primary-color);
}

.contract-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.contract-header .symbol {
    font-weight: 700;
    color: var(--text-primary);
}

.contract-header .type {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

.contract-header .type.over {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success-color);
}

.contract-header .type.under {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error-color);
}

.ticks-visual {
    display: flex;
    gap: 8px;
    align-items: center;
    overflow-x: auto;
    padding-bottom: 4px;
    margin: var(--spacing-sm) 0;
}

.tick-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    flex-shrink: 0;
}

.tick-circle.entry-tick {
    border: 2px solid var(--primary-color);
    box-shadow: 0 0 10px var(--primary-glow);
}

.tick-circle.win-tick {
    border-color: var(--success-color);
    color: var(--success-color);
}

.tick-circle.loss-tick {
    border-color: var(--error-color);
    color: var(--error-color);
}

.contract-footer {
    display: flex;
    justify-content: flex-end;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: var(--spacing-xs);
}

/* --- Trade Progress Tracker --- */
.progress-tracker-container {
    transition: all 0.3s ease;
}

.progress-timeline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    padding: 10px 0;
}

.timeline-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 2;
    flex: 1;
}

.step-circle {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #455a64;
    border: 2px solid #546e7a;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.step-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
    transition: color 0.3s ease;
}

.timeline-line {
    height: 3px;
    background: #455a64;
    flex-grow: 1;
    margin: 0 -10px;
    position: relative;
    top: -14px;
    /* Align with circles */
    transition: background 0.4s ease;
}

/* --- Active & Completed States --- */
.timeline-step.active .step-circle {
    background: #00bcd4;
    border-color: #00e5ff;
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.6);
    transform: scale(1.2);
}

.timeline-step.active .step-label {
    color: #00e5ff;
    text-shadow: 0 0 8px rgba(0, 229, 255, 0.3);
}

.timeline-step.completed .step-circle {
    background: #00bcd4;
    border-color: #00bcd4;
}

.timeline-step.completed .step-label {
    color: var(--text-primary);
}

.timeline-line.active {
    background: #00bcd4;
}

/* Pulse animation for active step */
@keyframes stepPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 229, 255, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(0, 229, 255, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(0, 229, 255, 0);
    }
}

.timeline-step.active .step-circle {
    animation: stepPulse 2s infinite;
}