/* ===== JUSTMARKETS BROKER PORTAL — CSS ===== */
/* Dark mode as default (site convention), light mode via body.light-mode */

:root {
    /* Dark mode (default) */
    --jm-bg: #1C1E26;
    --jm-bg-secondary: #252830;
    --jm-bg-card: #252830;
    --jm-text-primary: #E8EAED;
    --jm-text-secondary: #8B929A;
    --jm-text-tertiary: #5F6671;
    --jm-border: #363940;
    --jm-accent: #6366F1;
    --jm-accent-light: rgba(99,102,241,0.12);
    --jm-green: #66BB6A;
    --jm-red: #EF5350;
    --jm-orange: #FFB74D;
    --jm-gray-badge: #4B5563;
    --jm-shadow: 0 1px 3px rgba(0,0,0,0.3);
    --jm-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --jm-mono: 'Roboto Mono', 'SF Mono', monospace;
}

body.light-mode {
    --jm-bg: #FFFFFF;
    --jm-bg-secondary: #F5F5F7;
    --jm-bg-card: #FFFFFF;
    --jm-text-primary: #1A1A2E;
    --jm-text-secondary: #6B7280;
    --jm-text-tertiary: #9CA3AF;
    --jm-border: #E5E7EB;
    --jm-accent: #4F46E5;
    --jm-accent-light: rgba(79,70,229,0.08);
    --jm-green: #10B981;
    --jm-red: #EF4444;
    --jm-orange: #F59E0B;
    --jm-gray-badge: #6B7280;
    --jm-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* ===== FULLSCREEN TAKEOVER ===== */
.jm-active .adminuiux-sidebar,
.jm-active .adminuiux-footer,
.jm-active .mobile-footer,
.jm-active footer,
.jm-active #footer,
.jm-active .o_footer { display: none !important; }
.jm-active .adminuiux-content { margin-left: 0 !important; padding: 0 !important; }

/* ===== CONTAINER ===== */
.jm-container {
    display: flex; flex-direction: column;
    height: calc(100vh - var(--header-height, 60px));
    background: var(--jm-bg); font-family: var(--jm-font);
    overflow: hidden; color: var(--jm-text-primary);
}

/* ===== TOP TOOLBAR ===== */
.jm-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 16px; background: var(--jm-bg);
    border-bottom: 1px solid var(--jm-border); flex-shrink: 0; min-height: 52px;
}
.jm-toolbar-left, .jm-toolbar-right { display: flex; align-items: center; gap: 12px; }
.jm-toolbar-center { display: flex; align-items: center; gap: 6px; }
.jm-menu-btn {
    width: 36px; height: 36px; border-radius: 8px; background: none;
    border: none; color: var(--jm-text-secondary); cursor: pointer;
    display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.jm-menu-btn:hover { background: var(--jm-bg-secondary); }
.jm-acct-pill {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 14px; border-radius: 20px;
    background: var(--jm-bg-secondary); border: 1px solid var(--jm-border);
    cursor: pointer; font-size: 13px; font-weight: 600; color: var(--jm-text-primary);
}
.jm-acct-pill:hover { border-color: var(--jm-accent); }
.jm-demo-badge {
    padding: 2px 8px; border-radius: 4px; font-size: 10px; font-weight: 700;
    background: var(--jm-gray-badge); color: #fff; text-transform: uppercase;
}
.jm-icon-btn {
    width: 36px; height: 36px; border-radius: 50%; background: none;
    border: none; color: var(--jm-text-secondary); cursor: pointer;
    display: flex; align-items: center; justify-content: center; font-size: 16px;
    position: relative;
}
.jm-icon-btn:hover { background: var(--jm-bg-secondary); }
.jm-notif-dot {
    position: absolute; top: 4px; right: 4px; width: 8px; height: 8px;
    border-radius: 50%; background: var(--jm-red);
}

/* ===== CONTENT AREA ===== */
.jm-content { flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }
.jm-tab-pane { display: none; }
.jm-tab-pane.active { display: block; }

/* ===== BOTTOM NAV ===== */
.jm-bottom-nav {
    display: flex; align-items: stretch; background: var(--jm-bg);
    border-top: 1px solid var(--jm-border); flex-shrink: 0; height: 56px;
    padding-bottom: env(safe-area-inset-bottom, 0);
}
.jm-nav-item {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 3px; cursor: pointer; border: none;
    background: none; position: relative; padding: 6px 0; text-decoration: none;
}
.jm-nav-item:hover { text-decoration: none; }
.jm-nav-icon { font-size: 20px; color: var(--jm-text-tertiary); transition: color 0.15s; }
.jm-nav-label { font-size: 10px; font-weight: 600; color: var(--jm-text-tertiary); transition: color 0.15s; }
.jm-nav-item.active .jm-nav-icon { color: var(--jm-accent); }
.jm-nav-item.active .jm-nav-label { color: var(--jm-accent); }
.jm-nav-item.active::before {
    content: ''; position: absolute; top: 0; left: 20%; right: 20%;
    height: 2px; background: var(--jm-accent); border-radius: 0 0 2px 2px;
}

/* ===== HERO BALANCE CARD ===== */
.jm-hero { padding: 20px 16px 16px; text-align: left; }
.jm-hero-label { font-size: 12px; font-weight: 500; color: var(--jm-text-secondary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.jm-hero-balance { font-size: 32px; font-weight: 700; color: var(--jm-text-primary); font-family: var(--jm-mono); letter-spacing: -0.5px; }
.jm-hero-type { font-size: 13px; color: var(--jm-text-secondary); margin-top: 4px; }

/* ===== ACTION CIRCLES ===== */
.jm-actions { display: flex; justify-content: center; gap: 32px; padding: 16px 0 8px; }
.jm-action { display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; }
.jm-action-icon {
    width: 48px; height: 48px; border-radius: 50%; display: flex;
    align-items: center; justify-content: center; font-size: 18px;
    transition: transform 0.15s;
}
.jm-action-icon:hover { transform: scale(1.05); }
.jm-action-icon.primary { background: var(--jm-accent); color: #fff; }
.jm-action-icon.secondary { background: var(--jm-bg-secondary); color: var(--jm-text-secondary); border: 1px solid var(--jm-border); }
.jm-action-label { font-size: 11px; color: var(--jm-text-secondary); font-weight: 500; }

/* ===== PAGE DOTS ===== */
.jm-dots { display: flex; justify-content: center; gap: 6px; padding: 8px 0 16px; }
.jm-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--jm-border); }
.jm-dot.active { background: var(--jm-text-secondary); }

/* ===== SUB-TABS (Open/Pending/Closed) ===== */
.jm-subtabs {
    display: flex; border-bottom: 1px solid var(--jm-border);
    padding: 0 16px; background: var(--jm-bg);
}
.jm-subtab {
    padding: 12px 16px; font-size: 14px; font-weight: 500;
    color: var(--jm-text-secondary); cursor: pointer;
    border-bottom: 2px solid transparent; transition: all 0.15s;
    background: none; border-top: none; border-left: none; border-right: none;
}
.jm-subtab:hover { color: var(--jm-text-primary); }
.jm-subtab.active { color: var(--jm-text-primary); font-weight: 600; border-bottom-color: var(--jm-text-primary); }

/* ===== POSITION ROWS ===== */
.jm-pos-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px; border-bottom: 1px solid var(--jm-border); cursor: pointer;
}
.jm-pos-row:hover { background: var(--jm-accent-light); }
.jm-pos-left { display: flex; align-items: center; gap: 12px; }
.jm-pos-flag { width: 32px; height: 32px; border-radius: 50%; background: var(--jm-bg-secondary); display: flex; align-items: center; justify-content: center; font-size: 16px; overflow: hidden; }
.jm-pos-flag img { width: 100%; height: 100%; object-fit: cover; }
.jm-pos-symbol { font-size: 15px; font-weight: 600; color: var(--jm-text-primary); }
.jm-pos-details { font-size: 12px; color: var(--jm-text-secondary); margin-top: 2px; }
.jm-pos-right { text-align: right; }
.jm-pos-profit { font-size: 15px; font-weight: 600; font-family: var(--jm-mono); }
.jm-pos-profit.green { color: var(--jm-green); }
.jm-pos-profit.red { color: var(--jm-red); }
.jm-pos-price { font-size: 12px; color: var(--jm-text-secondary); font-family: var(--jm-mono); margin-top: 2px; }

/* ===== DATE HEADER ===== */
.jm-date-header {
    display: flex; justify-content: space-between; padding: 10px 16px;
    background: var(--jm-bg-secondary); font-size: 13px; font-weight: 500;
}

/* ===== EMPTY STATE ===== */
.jm-empty { text-align: center; padding: 60px 20px; }
.jm-empty-title { font-size: 16px; font-weight: 600; color: var(--jm-text-primary); margin-bottom: 8px; }
.jm-empty-text { font-size: 13px; color: var(--jm-text-secondary); line-height: 1.5; margin-bottom: 16px; }
.jm-empty-link { font-size: 14px; font-weight: 600; color: var(--jm-accent); cursor: pointer; text-decoration: none; }

/* ===== MARKETS TAB ===== */
.jm-search {
    padding: 8px 16px; background: var(--jm-bg);
}
.jm-search input {
    width: 100%; padding: 10px 14px 10px 40px; border-radius: 10px;
    background: var(--jm-bg-secondary); border: 1px solid var(--jm-border);
    color: var(--jm-text-primary); font-size: 14px;
}
.jm-search input:focus { outline: none; border-color: var(--jm-accent); }
.jm-search i { position: absolute; left: 28px; top: 50%; transform: translateY(-50%); color: var(--jm-text-tertiary); }
.jm-cat-tabs {
    display: flex; gap: 4px; overflow-x: auto; padding: 8px 16px;
    scrollbar-width: none; border-bottom: 1px solid var(--jm-border);
}
.jm-cat-tabs::-webkit-scrollbar { display: none; }
.jm-cat-tab {
    padding: 6px 14px; border-radius: 16px; font-size: 13px; font-weight: 500;
    white-space: nowrap; cursor: pointer; transition: all 0.15s;
    background: none; border: 1px solid var(--jm-border); color: var(--jm-text-secondary);
}
.jm-cat-tab:hover { border-color: var(--jm-accent); color: var(--jm-accent); }
.jm-cat-tab.active { background: var(--jm-accent); color: #fff; border-color: var(--jm-accent); }
.jm-market-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; border-bottom: 1px solid var(--jm-border);
}
.jm-market-left { display: flex; align-items: center; gap: 12px; flex: 1; }
.jm-market-spark { width: 60px; height: 24px; flex-shrink: 0; }
.jm-market-right { text-align: right; min-width: 90px; }
.jm-market-price { font-size: 15px; font-weight: 600; font-family: var(--jm-mono); color: var(--jm-text-primary); }
.jm-market-change { font-size: 12px; font-weight: 500; margin-top: 2px; }
.jm-market-change.up { color: var(--jm-green); }
.jm-market-change.down { color: var(--jm-red); }

/* ===== INSIGHTS TAB ===== */
.jm-section-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 16px 8px; font-size: 14px; font-weight: 600; color: var(--jm-text-primary);
}
.jm-section-header a { font-size: 13px; color: var(--jm-accent); text-decoration: none; font-weight: 500; }
.jm-event-row {
    display: flex; align-items: center; gap: 12px; padding: 12px 16px;
    border-bottom: 1px solid var(--jm-border);
}
.jm-event-flag { width: 36px; height: 36px; border-radius: 50%; overflow: hidden; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.jm-event-cur { font-size: 9px; font-weight: 700; color: var(--jm-accent); text-transform: uppercase; margin-top: 2px; text-align: center; }
.jm-event-info { flex: 1; }
.jm-event-name { font-size: 14px; font-weight: 500; color: var(--jm-text-primary); }
.jm-event-meta { font-size: 12px; color: var(--jm-text-secondary); margin-top: 2px; display: flex; align-items: center; gap: 6px; }
.jm-impact-dot { width: 8px; height: 8px; border-radius: 50%; }
.jm-impact-dot.high { background: var(--jm-red); }
.jm-impact-dot.medium { background: var(--jm-orange); }
.jm-impact-dot.low { background: var(--jm-green); }
.jm-news-row { padding: 12px 16px; border-bottom: 1px solid var(--jm-border); }
.jm-news-title { font-size: 14px; font-weight: 500; color: var(--jm-text-primary); line-height: 1.4; }
.jm-news-time { font-size: 12px; color: var(--jm-text-secondary); margin-top: 4px; }

/* ===== BOTTOM SHEET ===== */
.jm-sheet-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 1000;
    display: none; align-items: flex-end; justify-content: center;
}
.jm-sheet-overlay.show { display: flex; }
.jm-sheet {
    background: var(--jm-bg-card); border-radius: 16px 16px 0 0;
    width: 100%; max-width: 500px; max-height: 80vh; overflow-y: auto;
    padding-bottom: env(safe-area-inset-bottom, 16px);
    animation: jmSheetUp 0.3s ease;
}
@keyframes jmSheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.jm-sheet-handle {
    width: 40px; height: 4px; border-radius: 2px; background: var(--jm-border);
    margin: 8px auto 16px;
}
.jm-sheet-title { font-size: 16px; font-weight: 600; padding: 0 16px 12px; color: var(--jm-text-primary); }
.jm-sheet-row {
    display: flex; justify-content: space-between; padding: 12px 16px;
    border-bottom: 1px solid var(--jm-border); font-size: 14px;
}
.jm-sheet-row-label { color: var(--jm-text-secondary); }
.jm-sheet-row-value { font-weight: 600; font-family: var(--jm-mono); color: var(--jm-text-primary); }

/* ===== PILL BUTTONS ===== */
.jm-btn-primary {
    display: block; width: 100%; padding: 14px; border-radius: 26px;
    background: var(--jm-accent); color: #fff; border: none;
    font-size: 15px; font-weight: 600; cursor: pointer; text-align: center;
    transition: opacity 0.15s; text-decoration: none;
}
.jm-btn-primary:hover { opacity: 0.9; text-decoration: none; color: #fff; }
.jm-btn-outline {
    display: block; width: 100%; padding: 14px; border-radius: 26px;
    background: none; color: var(--jm-accent); border: 1px solid var(--jm-accent);
    font-size: 15px; font-weight: 600; cursor: pointer; text-align: center;
    transition: background 0.15s; text-decoration: none;
}
.jm-btn-outline:hover { background: var(--jm-accent-light); text-decoration: none; }

/* ===== BADGES ===== */
.jm-badge { padding: 2px 8px; border-radius: 4px; font-size: 10px; font-weight: 700; display: inline-block; }
.jm-badge-demo { background: var(--jm-gray-badge); color: #fff; }
.jm-badge-real { background: var(--jm-accent); color: #fff; }
.jm-badge-verified { background: rgba(16,185,129,0.12); color: var(--jm-green); }
.jm-badge-completed { background: rgba(16,185,129,0.08); color: var(--jm-green); font-size: 12px; }

/* ===== NOTIFICATION LIST ===== */
.jm-notif-row { display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--jm-border); cursor: pointer; }
.jm-notif-icon { width: 40px; height: 40px; border-radius: 50%; background: var(--jm-orange); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.jm-notif-content { flex: 1; }
.jm-notif-title { font-size: 14px; font-weight: 600; color: var(--jm-text-primary); }
.jm-notif-text { font-size: 13px; color: var(--jm-text-secondary); margin-top: 2px; line-height: 1.4; }
.jm-notif-time { font-size: 11px; color: var(--jm-text-tertiary); margin-top: 4px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
    .jm-hero-balance { font-size: 26px; }
    .jm-actions { gap: 24px; }
}

/* ===== MOBILE FULL-WIDTH FIX ===== */
.jm-active #wrapwrap,
.jm-active #wrapwrap > main,
.jm-active #wrapwrap .container,
.jm-active #wrapwrap .container-fluid,
.jm-active #wrap {
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
}
