:root {
    --bg-main: #0f172a;
    --bg-card: #1e293b;
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --primary: #3b82f6;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #eab308;
    --indices-seletion: #e2e8f0; 
    --astro: #a855f7; 
    --signal: #003fee; 
    --bot-engine: #1eff00; 
    --live-monitoring: #f800ec; 
    --growth-curve: #41fda5; 
    --risk-config: #ff0800; 
    --full-moon-ssl: #eeff00; 
    --border: #334155;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-main);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    box-sizing: border-box;
}

/* 🚀 TOP MAIN HEADER */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    background: #111827;
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0px 5px 6px -4px;
    margin-bottom: 20px;
}

.main-header h3 {
    margin: 0;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 📦 MAIN CONTENT CONTAINER */
.dashboard-container {
    max-width: 1920px;
    width: 100%;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
    flex: 1;
    border-left: 1px solid #1e293b;
    border-right: 1px solid #1e293b;
}

/* 🎛️ SYSTEM LAYOUT ENGINE (DESKTOP) */
.main-section {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    width: 100%;
}

.left-section, .right-section {
    width: 50%;
    display: flex;
    flex-direction: column;
}

.bottom-section {
    width: 100%;
}

.bottom-panel-grid {
    display: flex;
    gap: 20px;
}

.bottom-panel-grid .card {
    width: 50%;
    margin-bottom: 0;
}

/* 🎴 CORE GLASSMOPRHIC CARDS */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.3);
    box-sizing: border-box;
}

h2, h3 {
    margin-top: 0;
    color: #ffffff;
}

.bot-engine {
    border-left: 4px solid var(--bot-engine);
}

.astro-timing-engine {
    border-left: 4px solid var(--astro);
}

.on-off-btn {
    display: flex;
    gap: 10px;
    align-items: center;
}

.execution {
    border-left: 4px solid var(--signal);
}

.full-day-moon-SSL {
    height: 635px;
    border-left: 4px solid var(--full-moon-ssl);
}

.table-panel {
    overflow-x: auto;
    max-height: 485px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.table-details {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 14px;
}

.table-header {
    position: sticky;
    top: 0;
    background: #1e293b;
    border-bottom: 2px solid var(--border);
    color: var(--text-muted);
    z-index: 10;
}

.tbody-rows {
    border-bottom: 1px solid var(--border);
    transition: all 0.3s;
}

.select-indexes {
    border-left: 4px solid var(--indices-seletion);
}

.apply-selection-of-index {
    background: var(--primary);
    color: white;
    width: 100%;
    margin-top: 5px;
    cursor: pointer;
}

.risk-configure {
    border-left: 4px solid var(--risk-config);
}

.risk-config-value {
    width:100%;
    padding:8px;
    background:var(--bg-main);
    color:white;
    border:1px solid var(--border);
    border-radius:6px;
    box-sizing: border-box;
}

.apply-risk-config-btn {
    background: var(--primary);
    color: white;
    width: 100%;
    margin-top: 5px;
}

.live-monitoring {
    border-left: 4px solid var(--live-monitoring);
}

.growth-curve {
    border-left: 4px solid var(--growth-curve);
}

.astro-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0; 
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.astro-modal-section {
    background: #1e293b;
    padding: 25px;
    border-radius: 12px;
    max-width: 450px;
    width: 90%;
    border: 1px solid #334155;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.5);
    box-sizing: border-box;
}

.modal-title {
    margin-top: 0;
    color: #fff;
    font-size: 18px;
    border-bottom: 1px solid #334155;
    padding-bottom: 10px;
}

.modal-body {
    color: #cbd5e1;
    font-size: 14px;
    line-height: 1.6;
    margin: 15px 0;
}

.close-modal {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    float: right;
    font-weight: bold;
    min-height: auto;
}

/* ⚙️ FORM UI & INDICES SELECTION */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

select {
    width: 100%;
    background: var(--bg-main);
    color: var(--text-main);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 16px;
    outline: none;
    padding: 5px;
}

option {
    padding: 8px;
}

/* 🖱️ UNIVERSAL CONTROLS */
button {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 15px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
}

button:active {
    transform: scale(0.98);
}

/* BUTTON GRIDS */
.btn-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 10px;
}

.start, #yesBtn { background: var(--success); color: white; }
.stop, #noBtn { background: var(--danger); color: white; }

button:disabled {
    background: #475569 !important;
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.6;
}

/* 🚨 DYNAMIC DISPLAY BOXES */
#signalBox, #astroAlertBox {
    background: var(--bg-main);
    border: 2px dashed var(--border);
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    letter-spacing: 0.5px;
    margin: 10px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

#alertTriggerTime {
    color: #c3c3c3;
    font-size: 14px;
    font-style: italic;
}

/* 📊 METRICS GRID ROUTER */
.metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.metric-box {
    background: var(--bg-main);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border);
    text-align: center;
}

.metric-box p {
    margin: 0;
    font-size: 14px;
    color: var(--text-muted);
}

.metric-box span {
    font-size: 22px;
    font-weight: bold;
    display: block;
    margin-top: 5px;
}

.astro-text {
    color: var(--astro);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.chart-container {
    position: relative;
    width: 100%;
    margin-top: 15px;
}

.emergency-exit {
    background: #f97316;
    color: white;
    width: 100%;
    margin-top: 15px;
    font-size: 16px;
    letter-spacing: 0.5px;
}

/* ⚙️ EXECUTION CARD & TOGGLE FLEX BUFFER */
.signal-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #0f172a;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 15px;
}

.signal-section h3 { margin: 0; }

.risk-config-fields {
    display: flex;
    gap: 10px;
}

.risk-config-fields label {
    width: 50%;
}

/* 🔄 INTERACTIVE TOGGLE KEY */
.auto-trade-container {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(42, 46, 57, 0.6);
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid #2a2e39;
}

.auto-trade-label {
    color: #b2b5be;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-text {
    font-size: 0.85rem;
    font-weight: bold;
    min-width: 30px;
}
.status-text.on { color: #00e676; text-shadow: 0 0 8px rgba(0, 230, 118, 0.4); }
.status-text.off { color: #ff5252; text-shadow: 0 0 8px rgba(255, 82, 82, 0.4); }

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 22px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #454954;
    transition: .3s;
    border-radius: 22px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}
input:checked + .slider { background-color: #00e676; }
input:checked + .slider:before { transform: translateX(22px); }

.astro-header-flex {
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 15px; 
    flex-wrap: wrap; 
    gap: 10px;
}

.astro-header-flex h3 {
    width: 100%;
}
.calendar-container {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #0f172a;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid var(--border);
}
.calendar-input {
    background: #1e293b;
    color: #ffffff;
    border: 1px solid #475569;
    border-radius: 4px;
    padding: 4px 6px;
    font-size: 13px;
    outline: none;
}
.calendar-btn {
    background: #3b82f6;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    padding: 5px 12px;
    font-size: 13px;
    font-weight: bold;
    min-height: auto;
}

/* 🛡️ BOTTOM PERSISTENT FOOTER */
.main-footer {
    background: #111827;
    border-top: 1px solid var(--border);
    padding: 15px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 20px;
}

/* Trailing SL css */
/* 1. Main container ko Grid banayenge */
#positions {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2 columns banayega (50% - 50%) */
    gap: 15px; /* Cards ke beech ka space */
}

/* 2. 3rd card ko 100% width dene ka magic */
#positions .position-card:nth-child(3) {
    grid-column: 1 / span 2; 
}

/* 3. Bonus: Mobile screen par sab kuch 100% ho jaye (Responsive) */
@media (max-width: 768px) {
    #positions {
        grid-template-columns: 1fr; /* Mobile me single column */
    }
    #positions .position-card:nth-child(3) {
        grid-column: auto;
    }
}
.position-card {
    border: 1px solid #ccc;
    padding: 12px;
    margin-bottom: 10px;
    border-radius: 6px;
}
.position-card h4, .position-card p {
    color:#ffffff;
}
.position-card h4 {
    margin:0 0 5px 0;
}
.position-card h4 span {
    font-size:14px;
    color:#c7c7c7;
}
.position-card p  {
    margin:2px 0;
}
.toggle-trailing-btn {
    margin-top:5px;
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    width: 100%;
}

 .nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: #38bdf8 !important; /* Soft glowing blue text */
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid #0284c7;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.25s ease-in-out;
}

/* Hover Effects */
.nav-btn:hover {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff !important;
    border-color: #38bdf8;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.4);
    transform: translateY(-1px);
}

.nav-btn .btn-arrow {
    font-size: 0.9rem;
    transition: transform 0.25s ease;
}

.nav-btn:hover .btn-arrow {
    transform: translateX(4px); /* Subtle arrow move effect */
}

/* ========================================================
    📱 RESPONSIVE INTERFACE MATRIX (MEDIA QUERIES)
    ======================================================== */

/* 💻 TABLET PORTRAIT & SMALL LAPTOPS (Max 1024px) */
@media (max-width: 1024px) {
    .main-section {
        flex-direction: column;
        gap: 0;
    }
    .left-section, .right-section {
        width: 100%;
    }
    .bottom-panel-grid {
        flex-direction: column;
        gap: 0;
    }
    .bottom-panel-grid .card {
        width: 100%;
        margin-bottom: 20px;
    }
}

/* 📱 MOBILE VIEW PORTS (Max 600px) */
@media (max-width: 600px) {
    body {
        padding: 0;
    }
    .dashboard-container {
        padding: 12px;
    }
    .main-header {
        padding: 12px 15px;
    }
    .main-header h3 {
        font-size: 1.1rem;
    }
    .card {
        padding: 15px;
        border-radius: 8px;
    }
    .metrics-grid {
        grid-template-columns: 1fr; /* Stack metrics blocks on micro screens */
        gap: 10px;
    }
    .metric-box span {
        font-size: 18px;
    }
    .signal-section {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 10px;
    }
    .auto-trade-container {
        width: 100%;
        justify-content: space-between;
        box-sizing: border-box;
    }
    .astro-header-flex {
        flex-direction: column;
        align-items: flex-start;
    }
    .calendar-container {
        width: 100%;
        justify-content: space-between;
        box-sizing: border-box;
    }
    .calendar-input {
        flex: 1;
    }
    table th, table td {
        font-size: 12px;
        padding: 8px 4px !important;
    }
}

@media (max-width: 361px) {
    .risk-config-fields label, .main-header h3 {
        font-size: 0.9rem;
    }
    .bot-engine h3, .astro-timing-engine h3, .execution h3, .astro-header-flex h3, .select-indexes h3, .rish-configure h3, .live-monitoring h3, .growth-curve h3 {
        font-size: 1rem;
    }
}