/* ============================================================
   RESET & BASE – पूरी तरह स्थिर, कोई गैप नहीं
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  overflow: hidden;
  background: #05070c;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #e5e7eb;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
/* ============================================================
   2.  TERMINAL CONTAINER (Fixed Overflow)
   ============================================================ */
.terminal-container {
    height: 100vh !important;
    max-height: 100vh !important;
    width: 100%;
    max-width: 100vw;
    padding-top: 15px;
    padding-left: 5px;
    padding-right: 5px;
    padding-bottom: 15px; /* यहाँ से नीचे की पैडिंग मिल जाएगी */
    background: linear-gradient(180deg, #05070c 0%, #0b0f19 50%, #05070c 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden !important;
    box-sizing: border-box;
}

/* ============================================================
   3.  TERMINAL MAIN — FORCE ROW, NO WRAP
   ============================================================ */
.terminal-main {
    display: flex;
    flex-direction: row;      /* LEFT + RIGHT side-by-side */
    flex-wrap: nowrap;        /* ABSOLUTELY NO WRAPPING */
    align-items: stretch;
    height: 100%;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    gap: 10px;
    overflow: hidden;         /* Prevents any scrollbar on the main wrapper */
    box-sizing: border-box;
}

/* ============================================================
   4.  LEFT COLUMN — FIXED WIDTH, NEVER SHRINKS
   ============================================================ */
.terminal-left {
    display: flex;
    flex-direction: column;
    flex: 0 0 280px;          /* flex-basis 280px hai */
    width: 280px;
    min-width: 280px;
    max-width: 280px;
}

/* Watchlist — 60% of left height */
.left-watchlist {
    flex: 1.4;               /* 1.5 part out of 2.5 = 60% */
    min-height: 0;
    overflow: hidden;
    background: linear-gradient(180deg, #05070c 0%, #0b0f19 50%, #05070c 100%);
    border-radius: 10px;
    border: 1px solid #1e293b;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* Orderbook — 40% of left height */
.left-orderbook {
    flex: 1.1;                 /* 1 part out of 2.5 = 40% */
    min-height: 0;
    overflow: hidden;
    background: #111827;
    border-radius: 10px;
    border: 1px solid #1e293b;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* ============================================================
   5.  RIGHT AREA — TAKES REMAINING WIDTH, VERTICAL FLEX
   ============================================================ */
.terminal-right-area {
    display: flex;
    flex-direction: column;
    flex: 1;                    /* Takes all leftover horizontal space */
    min-width: 0;               /* Crucial: allows child to shrink below auto */
    height: 100%;
    gap: 10px;
    overflow: hidden;
}

/* ============================================================
   6.  TOP ROW (Chart + Right Sidebar Wrapper)
   ============================================================ */
.right-top-row {
    display: flex;
    flex-direction: row;      /* CHART + SIDEBAR side-by-side */
    flex-wrap: nowrap;        /* ABSOLUTELY NO WRAPPING */
    flex: 2;                    /* Takes 2/3 of right area height */
    gap: 10px;
    min-height: 0;
    overflow: hidden;
}

/* Chart — Takes all remaining space */
.center-chart {
    flex: 1;                    /* Eats up the free space */
    min-width: 0;               /* Allows it to shrink if needed */
    background: #111827;
    border-radius: 10px;
    border: 1px solid #1e293b;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* --- RIGHT SIDEBAR WRAPPER (Buttons + Trade Panel) --- */
.right-sidebar-wrapper {
    display: flex;
    flex-direction: column;
    flex: 0 0 290px;          /* Thoda chhota kar diya hai width ko */
    width: 290px;
    min-width: 290px;
    max-width: 290px;
    gap: 8px;                   /* Buttons aur trade panel ke beech ki gap */
    height: 100%;
    overflow: hidden;
}

.user-top-bar {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    background: #111827;
    padding: 6px;
    border-radius: 8px;
    border: 1px solid #1e293b;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.user-top-bar a, 
.user-top-bar button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 5px 8px;
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 4px;
    transition: 0.2s;
    border: none;
    cursor: pointer;
}

/* Pehli row ke 3 items (har ek 2 columns lega: 2 + 2 + 2 = 6) */
.user-top-bar > *:nth-child(1),
.user-top-bar > *:nth-child(2),
.user-top-bar > *:nth-child(3) {
    grid-column: span 2;
}

/* Doosri row ke 2 items jo center me rahenge (har ek 3 columns lega: 3 + 3 = 6) */
.user-top-bar > *:nth-child(4),
.user-top-bar > *:nth-child(5) {
    grid-column: span 3;
}

/* Button variants styling */
.profile-btn {
    background: #1e293b;
    color: #cbd5e1;
}
.profile-btn:hover {
    background: #334155;
    color: #fff;
}

.logout-btn {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}
.logout-btn:hover {
    background: #ef4444;
    color: #fff;
}

.news-btn {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}
.news-btn:hover {
    background: #3b82f6;
    color: #fff;
}

.journal-btn {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}
.journal-btn:hover {
    background: #10b981;
    color: #fff;
}

.mailbox-btn {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}
.mailbox-btn:hover {
    background: #f59e0b;
    color: #fff;
}

/* Trade Panel — FIXED WIDTH, NEAT & COMPACT */
.right-trade {
    flex: 1;                    /* Bachi hui height trade panel le lega */
    background: #111827;
    border-radius: 10px;
    border: 1px solid #1e293b;
    overflow-y: auto;           /* Agar content zyada ho toh scroll ho sake */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* ============================================================
   7.  BOTTOM ROW (Positions) — FULL WIDTH UNDER TOP ROW
   ============================================================ */
.right-bottom-row {
    flex: 1;                    /* Takes 1/3 of right area height */
    min-height: 0;
    background: #111827;
    border-radius: 10px;
    border: 1px solid #1e293b;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.bottom-positions {
    height: 100%;
    width: 100%;
    overflow: auto;             /* Scrolls only this panel if content overflows */
}

/* ============================================================
   8.  SCROLLBARS (Dark themed)
   ============================================================ */
.bottom-positions::-webkit-scrollbar,
.left-watchlist::-webkit-scrollbar,
.left-orderbook::-webkit-scrollbar,
.center-chart::-webkit-scrollbar,
.right-trade::-webkit-scrollbar,
.right-sidebar-wrapper::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}
.bottom-positions::-webkit-scrollbar-track,
.left-watchlist::-webkit-scrollbar-track,
.left-orderbook::-webkit-scrollbar-track,
.center-chart::-webkit-scrollbar-track,
.right-trade::-webkit-scrollbar-track {
    background: transparent;
}
.bottom-positions::-webkit-scrollbar-thumb,
.left-watchlist::-webkit-scrollbar-thumb,
.left-orderbook::-webkit-scrollbar-thumb,
.center-chart::-webkit-scrollbar-thumb,
.right-trade::-webkit-scrollbar-thumb {
    background: #2d3a4f;
    border-radius: 10px;
}
.bottom-positions::-webkit-scrollbar-thumb:hover,
.left-watchlist::-webkit-scrollbar-thumb:hover,
.left-orderbook::-webkit-scrollbar-thumb:hover,
.center-chart::-webkit-scrollbar-thumb:hover,
.right-trade::-webkit-scrollbar-thumb:hover {
    background: #3b4a63;
}

@keyframes pulse-dot {
    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.4;
        transform: scale(0.8);
    }
}