/* ==========================================================================
   1. COLOR PALETTE & DESIGN SYSTEM
   ========================================================================== */
:root {
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Consolas, monospace;

    /* Base Colors */
    --bg-base: #0a0d14;
    --bg-card: #111622;
    --bg-input: #171f30;
    --border-color: rgba(255, 255, 255, 0.08);

    /* Interface Highlights */
    --blue-accent: #3b82f6;
    --purple-accent: #8b5cf6;
    --yellow-accent: #eab308;
    --emerald-accent: #10b981;
    --rose-accent: #f43f5e;
    --amber-accent: #f59e0b;

    /* Feedback Glow Values */
    --glow-emerald: 0 0 15px rgba(16, 185, 129, 0.35);
    --glow-rose: 0 0 15px rgba(244, 63, 94, 0.35);

    /* Typography Colors */
    --text-main: #f3f4f6;
    --text-sub: #9ca3af;
    --text-muted: #4b5563;

    --transition-speed: 0.2s;
}

/* Base Styles */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-base);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

[hidden] {
    display: none !important;
}

/* ==========================================================================
   2. SITE HEADINGS & CONTAINERS
   ========================================================================== */
.page-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.hero {
    background: radial-gradient(circle at top right, rgba(59, 130, 246, 0.08), transparent 45%),
                linear-gradient(180deg, #0f1422 0%, var(--bg-base) 100%);
    border-bottom: 1px solid var(--border-color);
    padding: 2.5rem 1.5rem;
}

.hero > div {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.eyebrow {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.075em;
    color: var(--blue-accent);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pulse-blue {
    animation: bluePulse 2s infinite ease-in-out;
}

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

.hero h1 {
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: #ffffff;
    margin-bottom: 0.5rem;
}

.hero-text {
    font-size: 0.9375rem;
    color: var(--text-sub);
    max-width: 650px;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* ==========================================================================
   3. STATUS GRID & DYNAMIC GLOW STATES
   ========================================================================== */
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}

.status-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 108px;
    transition: var(--transition-speed) ease;
}

.status-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.15);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.card-header span {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-sub);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-card strong {
    font-size: 1.625rem;
    font-weight: 700;
    color: #ffffff;
    font-family: var(--font-mono);
    transition: color 0.15s ease;
}

/* Status Colors for Status Labels */
.status-running { color: var(--emerald-accent); }
.status-paused { color: var(--amber-accent); }
.status-stopped { color: var(--text-sub); }
.status-active { color: var(--blue-accent); }
.status-inactive { color: var(--text-muted); }

/* Dynamic Glow Configurations for Day P&L */
.pnl-profit {
    border-color: rgba(16, 185, 129, 0.3) !important;
    box-shadow: var(--glow-emerald) !important;
    background-image: linear-gradient(135deg, rgba(16, 185, 129, 0.01) 0%, transparent 100%);
}
.pnl-profit strong, .pnl-profit .icon-pnl {
    color: var(--emerald-accent) !important;
}

.pnl-loss {
    border-color: rgba(244, 63, 94, 0.3) !important;
    box-shadow: var(--glow-rose) !important;
    background-image: linear-gradient(135deg, rgba(244, 63, 94, 0.01) 0%, transparent 100%);
}
.pnl-loss strong, .pnl-loss .icon-pnl {
    color: var(--rose-accent) !important;
}

/* LTP Flash Visual Elements */
.flash-up {
    color: var(--emerald-accent) !important;
    text-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}
.flash-down {
    color: var(--rose-accent) !important;
    text-shadow: 0 0 10px rgba(244, 63, 94, 0.5);
}

/* Metric Icon Colors */
.metric-icon { font-size: 1.1rem; transition: color 0.15s ease; }
.icon-cyan { color: #06b6d4; }
.icon-purple { color: var(--purple-accent); }
.icon-yellow { color: var(--yellow-accent); }
.icon-pnl { color: var(--text-muted); }

/* ==========================================================================
   4. FORM LAYOUT & COMPONENT DESIGNS
   ========================================================================== */
.panel {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1.5rem;
}

.panel h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 1.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.accent-blue { color: var(--blue-accent); }
.accent-purple { color: var(--purple-accent); }

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-sub);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.form-group input,
.form-group select {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: #ffffff;
    padding: 0.55rem 0.75rem;
    font-size: 0.875rem;
    font-family: var(--font-sans);
    transition: var(--transition-speed) ease;
    width: 100%;
}

.credential-panel input:focus {
    border-color: var(--blue-accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    outline: none;
}

.algo-panel input:focus,
.algo-panel select:focus {
    border-color: var(--purple-accent);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
    outline: none;
}

/* Manual Level Drawer Panel animation */
.manual-panel {
    border-color: rgba(59, 130, 246, 0.2);
    background-image: linear-gradient(180deg, rgba(59, 130, 246, 0.01) 0%, transparent 100%);
    animation: drawerDown var(--transition-speed) ease-out;
}

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

/* ==========================================================================
   5. BUTTON & ACTIONS COMPONENT
   ========================================================================== */
.top-actions {
    display: flex;
    justify-content: flex-end;
}

button, .btn {
    font-family: var(--font-sans);
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 0.55rem 1rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: var(--transition-speed) ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.secondary-btn {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.secondary-btn:hover {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: var(--text-sub);
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

/* Control Buttons design colors */
.btn-emerald {
    background-color: var(--emerald-accent);
    color: #ffffff;
}
.btn-emerald:hover:not(:disabled) {
    background-color: #059669;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.25);
}

.btn-amber {
    background-color: var(--amber-accent);
    color: #ffffff;
}
.btn-amber:hover:not(:disabled) {
    background-color: var(--warning-hover);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.25);
}

.btn-rose {
    background-color: var(--rose-accent);
    color: #ffffff;
}
.btn-rose:hover:not(:disabled) {
    background-color: #e11d48;
    box-shadow: 0 0 10px rgba(244, 63, 94, 0.25);
}

/* Manual Controls inside drawers */
.manual-controls {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.cancel-btn {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-sub);
}

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

.submit-btn {
    background-color: var(--blue-accent);
    color: #ffffff;
}

.submit-btn:hover:not(:disabled) {
    background-color: var(--primary-hover);
}

/* Disabled Interactions styling */
button:disabled, .btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background-color: rgba(255, 255, 255, 0.02) !important;
    color: var(--text-muted) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: none !important;
}

/* ==========================================================================
   6. MONOSPACED CONSOLE SYSTEM
   ========================================================================== */
.log-panel {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.note {
    font-size: 0.75rem;
    color: #93c5fd;
    background-color: rgba(59, 130, 246, 0.06);
    border: 1px solid rgba(59, 130, 246, 0.15);
    padding: 0.625rem 0.875rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.log-container {
    background-color: #04060c;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1rem;
}

#logs {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: #94a3b8;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 240px;
    overflow-y: auto;
    line-height: 1.5;
}

/* Custom Mini Scrollbars */
.log-container pre::-webkit-scrollbar,
select::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.log-container pre::-webkit-scrollbar-thumb,
select::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 10px;
}

.log-container pre::-webkit-scrollbar-thumb:hover,
select::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ==========================================================================
   7. RESPONSIVENESS RULES
   ========================================================================== */
@media (max-width: 768px) {
    .hero { padding: 2rem 1rem; }
    .hero h1 { font-size: 1.75rem; }
    .container { padding: 1rem; gap: 1rem; }
    .form-grid { grid-template-columns: 1fr; }
    .controls { flex-direction: column; }
    .controls button { width: 100%; }
}