/* ================================
    1. GENERAL STYLES
================================ */

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #0c1426 0%, #1a2332 50%, #2d3748 100%);
    color: #ffffff;
    min-height: 100vh;
    padding: 20px;
    overflow-x: hidden;
}

/* Keyframe Animations */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* ================================
    2. LAYOUT & CONTAINER
================================ */
.main-container {
    max-width: 1800px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 32px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: visibility 0s, opacity 0.5s ease;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 32px;
    margin-bottom: 32px;
}

.bottom-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
}

/* ================================
    3. MAJOR COMPONENTS
================================ */

/* Loading & Disabled Overlays */
.loading-overlay, .disabled-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0c1426;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

.loading-overlay.hide, .disabled-overlay.hide {
    opacity: 0;
    pointer-events: none;
}

.disabled-overlay {
    cursor: pointer;
}

.loading-spinner {
    border: 5px solid rgba(255, 255, 255, 0.2);
    border-top: 5px solid #00ff88;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

.loading-overlay p, .disabled-overlay p {
    color: #a0aec0;
    font-size: 1.2rem;
    font-weight: 500;
    text-align: center;
    padding: 0 20px;
}

/* Header */
.system-header {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
}

.system-header::before {
    content: '';
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 150px;
    height: 4px;
    background: linear-gradient(90deg, #00ff88, #00ccff, #ff6b9d);
    border-radius: 2px;
}

.system-header h1 {
    font-size: 3rem;
    font-weight: 900;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #00ff88 0%, #00ccff 50%, #ff6b9d 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -1px;
}

.system-tagline {
    font-size: 1.2rem;
    opacity: 0.9;
    color: #a0aec0;
    margin-bottom: 20px;
}

/* Panels */
.panel {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 20px;
    padding: 28px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #00ff88, #00ccff, #ff6b9d);
    border-radius: 20px 20px 0 0;
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.panel-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #e2e8f0;
}

.panel-subtitle {
    margin-bottom: 16px;
    color: #cbd5e0;
    font-size: 1.1rem;
    font-weight: 600;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
}

.modal-content {
    background: linear-gradient(135deg, #1a2332, #2d3748);
    margin: 5% auto;
    padding: 32px;
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: modalSlideIn 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h2 {
    color: #e2e8f0;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.close {
    color: #a0aec0;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover {
    color: #ff4757;
}

/* ================================
    4. SUB-COMPONENTS & ELEMENTS
================================ */

/* Forms & Controls */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: #e2e8f0;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-group {
    display: flex;
    gap: 8px;
}

.form-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    font-size: 0.9rem;
    font-family: 'Consolas', monospace;
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: #00ccff;
    box-shadow: 0 0 15px rgba(0, 204, 255, 0.3);
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-label {
    font-weight: 600;
    font-size: 0.8rem;
    color: #cbd5e0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.control-input {
    padding: 10px 14px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    min-width: 150px; /* Prevents layout shift on load */
}

.control-input:focus {
    outline: none;
    border-color: #00ccff;
    box-shadow: 0 0 15px rgba(0, 204, 255, 0.3);
}

.form-help {
    display: block;
    margin-top: 6px;
    font-size: 0.8rem;
    color: #a0aec0;
    line-height: 1.4;
}

.form-help a {
    color: #00ccff;
    text-decoration: none;
}

.form-help a:hover {
    text-decoration: underline;
}

/* Buttons */
.settings-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 16px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.settings-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.toggle-btn {
    padding: 12px 16px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.4);
    color: #a0aec0;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #00ccff;
}

.action-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.action-btn {
    padding: 14px 16px;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.action-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.action-btn:hover::before {
    left: 100%;
}

.action-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-long {
    background: linear-gradient(135deg, #00ff88, #00d4aa);
    color: #000;
}

.btn-short {
    background: linear-gradient(135deg, #ff4757, #ff3742);
    color: #fff;
}

.btn-close {
    background: linear-gradient(135deg, #ffa502, #ff6348);
    color: #fff;
}

.form-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 20px;
}

.btn-test {
    background: linear-gradient(135deg, #ffa502, #ff6348);
    color: #fff;
}

.btn-save {
    background: linear-gradient(135deg, #00ff88, #00d4aa);
    color: #000;
}

.btn-clear {
    background: linear-gradient(135deg, #ff4757, #ff3742);
    color: #fff;
}

/* Success Stats Bar */
.success-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 32px;
    padding: 24px;
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.1), rgba(0, 204, 255, 0.1));
    border: 2px solid rgba(0, 255, 136, 0.3);
    border-radius: 20px;
}

.stat-item {
    text-align: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #00ff88, #00ccff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Indicators Section */
.indicators-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.indicator-card {
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
}

.indicator-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: currentColor;
    border-radius: 12px 12px 0 0;
}

.indicator-card.bullish {
    border-color: #00ff88;
    background: rgba(0, 255, 136, 0.1);
    color: #00ff88;
}

.indicator-card.bearish {
    border-color: #ff4757;
    background: rgba(255, 71, 87, 0.1);
    color: #ff4757;
}

.indicator-card.neutral {
    border-color: #ffa502;
    background: rgba(255, 165, 2, 0.1);
    color: #ffa502;
}

.indicator-name {
    font-size: 0.75rem;
    opacity: 0.8;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.indicator-signal {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.indicator-details {
    font-size: 0.7rem;
    opacity: 0.8;
    font-weight: 600;
}

/* Consensus Section */
.consensus-section {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
}

.consensus-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.consensus-label {
    font-size: 1rem;
    font-weight: 600;
    color: #cbd5e0;
}

.consensus-strength {
    font-size: 1.2rem;
    font-weight: 800;
}

.strength-bar {
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    margin-bottom: 12px;
}

.strength-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff4757 0%, #ffa502 50%, #00ff88 100%);
    border-radius: 6px;
    transition: width 0.8s ease;
    position: relative;
}

.strength-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: shimmer 2s infinite;
}

.consensus-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    font-size: 0.85rem;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Trade Execution */
.execution-section {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 16px;
}

.execution-status {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #00ff88;
    animation: pulse 2s infinite;
}

.status-text {
    font-size: 0.9rem;
    font-weight: 600;
}

.trade-params {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 16px;
    font-size: 0.8rem;
}

.param-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.param-label {
    opacity: 0.8;
}

.param-value {
    font-weight: 700;
    font-family: 'Consolas', monospace;
}

/* Session Monitor */
.session-monitor {
    text-align: center;
}

.london-clock {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 20px;
    font-family: 'Consolas', 'Monaco', monospace;
    background: linear-gradient(45deg, #00ccff, #00ff88);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.session-status {
    display: grid;
    gap: 12px;
    margin-bottom: 20px;
}

.session-item {
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.session-info {
    text-align: left;
}

.session-name {
    font-size: 0.8rem;
    opacity: 0.8;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.session-time {
    font-size: 0.85rem;
    font-weight: 600;
}

.session-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #4a5568;
    transition: all 0.3s ease;
}

.session-dot.active {
    background: #00ff88;
    box-shadow: 0 0 12px rgba(0, 255, 136, 0.6);
}

.vpoc-levels-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 8px;
}

.vpoc-level-item {
    text-align: center;
    padding: 8px;
    background: rgba(0,0,0,0.2);
    border-radius: 6px;
}

.vpoc-level-label {
    font-size: 0.7rem;
    opacity: 0.7;
}

.vpoc-level-value {
    font-size: 0.8rem;
    font-weight: 700;
}

/* Protection Panel */
.protection-grid {
    display: grid;
    gap: 12px;
    margin-bottom: 20px;
}

.protection-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.protection-label {
    font-size: 0.85rem;
    opacity: 0.8;
}

.protection-value {
    font-size: 0.9rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(0, 255, 136, 0.2);
    color: #00ff88;
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.protection-status-box {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 16px;
}

.protection-status-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: #cbd5e0;
}

.protection-status-text {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 12px;
    font-size: 0.75rem;
    line-height: 1.4;
    min-height: 100px;
}

/* Analytics Panels */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.analytics-stat {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
}

.analytics-value {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 4px;
}

.analytics-label {
    font-size: 0.7rem;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.system-insights {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 16px;
    margin-top: 12px;
}

.insight-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: #00ff88;
}

.insight-text {
    font-size: 0.8rem;
    opacity: 0.8;
    line-height: 1.4;
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 24px;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    z-index: 1000;
    max-width: 400px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: slideIn 0.4s ease;
}

.notification.success {
    background: rgba(0, 255, 136, 0.9);
    color: #000;
}

.notification.warning {
    background: rgba(255, 165, 2, 0.9);
    color: #000;
}

.notification.error {
    background: rgba(255, 71, 87, 0.9);
}

.notification.info {
    background: rgba(72, 219, 251, 0.9);
    color: #000;
}

/* API Status in Modal */
.api-status {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.status-item:last-child {
    border-bottom: none;
}

.status-label {
    font-size: 0.9rem;
    color: #a0aec0;
}

.status-value {
    font-weight: 600;
    font-size: 0.9rem;
}

/* ================================
    5. UTILITY & STATE CLASSES
================================ */
.positive { color: #00ff88; }
.negative { color: #ff4757; }
.neutral { color: #ffa502; }

.status-connected { color: #00ff88; }
.status-disconnected { color: #ff4757; }
.status-testing { color: #ffa502; }

/* ================================
    6. RESPONSIVE DESIGN
================================ */
@media (max-width: 1400px) {
    .dashboard-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .bottom-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .main-container {
        padding: 20px;
    }
    
    .success-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .bottom-grid {
        grid-template-columns: 1fr;
    }
    
    .controls-grid {
        grid-template-columns: 1fr;
    }
    
    .indicators-grid {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        grid-template-columns: 1fr;
    }
}
