/* ==========================================================================
   CrownFX upgrade additions.
   The original theme (main.css) is untouched; this file only adds styles for
   new features (KYC, bot key, simulated labels, admin responsiveness) and
   fixes mobile layout issues. It uses the same design tokens.
   ========================================================================== */

/* ---------- Admin layout (original used inline margin-left: 280px) ---------- */
.admin-main {
    margin-left: 280px;
    padding: 1.5rem;
    min-height: 100vh;
    min-width: 0;
    background: var(--bg-primary);
}
.admin-sidebar { overflow-y: auto; height: 100vh; }
.admin-sidebar .sidebar-nav { overflow-y: visible; }
.sidebar-section-label {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0.9rem 1rem 0.35rem;
}
.admin-mobile-bar {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: -1.5rem -1.5rem 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1030;
}
@media (max-width: 991.98px) {
    .admin-main { margin-left: 0; padding: 1rem; padding-bottom: 2rem; }
    .admin-mobile-bar { display: flex; margin: -1rem -1rem 1rem; }
}

/* ---------- Locked nav items when KYC is required ---------- */
.sidebar-nav-item.is-locked { opacity: 0.55; }

/* ---------- Generic helpers ---------- */
.text-muted { color: var(--text-muted) !important; }
.min-w-0 { min-width: 0; }
.break-all { word-break: break-all; }
.table-apex td, .table-apex th { vertical-align: middle; }
.table-responsive { -webkit-overflow-scrolling: touch; }
textarea.form-control-apex { min-height: 90px; }
.form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; }
.inline-form { display: inline; }
.card-apex + .card-apex { margin-top: 0; }

/* ---------- Pagination ---------- */
.pager-link {
    min-width: 30px; height: 30px; padding: 0 8px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm); color: var(--text-secondary);
    text-decoration: none; font-size: 0.75rem; border: 1px solid var(--border);
}
.pager-link:hover { background: var(--bg-card); color: var(--text-primary); }
.pager-link.active { background: var(--accent-green-dim); color: var(--accent-green); border-color: var(--border-green); }
.pager-link.disabled { opacity: 0.35; pointer-events: none; }

/* ---------- LIVE MARKET DATA vs SIMULATED labels ---------- */
.label-live, .label-sim {
    display: inline-flex; align-items: center; gap: 0.35rem;
    font-size: 0.65rem; font-weight: 700; letter-spacing: 0.06em;
    text-transform: uppercase; padding: 0.2rem 0.55rem; border-radius: 999px;
    white-space: nowrap;
}
.label-live { color: var(--info); background: var(--info-dim); border: 1px solid rgba(59,130,246,.35); }
.label-live::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--info); }
.label-sim { color: var(--warning); background: var(--warning-dim); border: 1px solid rgba(245,158,11,.35); }
.sim-disclaimer {
    font-size: 0.75rem; color: var(--text-secondary);
    background: var(--warning-dim); border: 1px solid rgba(245,158,11,.25);
    border-radius: var(--radius-md); padding: 0.6rem 0.8rem;
}

/* ---------- Universal Bot Key ---------- */
.bot-key-box {
    display: flex; align-items: center; gap: 0.5rem; justify-content: space-between;
    background: var(--bg-secondary); border: 1px dashed var(--border-light);
    border-radius: var(--radius-md); padding: 0.75rem 1rem;
    font-family: var(--font-mono); font-size: 0.95rem; letter-spacing: 0.04em;
    word-break: break-all;
}

/* ---------- Bot live state line ---------- */
.bot-state {
    display: flex; gap: 0.6rem; align-items: flex-start;
    background: var(--bg-secondary); border-radius: var(--radius-md);
    padding: 0.65rem 0.8rem; font-size: 0.8rem;
}
.bot-state .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 0.35rem; flex-shrink: 0; background: var(--text-muted); }
.bot-state.is-active .dot { background: var(--accent-green); box-shadow: 0 0 8px var(--accent-green); }
.bot-state.is-paused .dot { background: var(--warning); }

/* ---------- KYC ---------- */
.kyc-status-card { display: flex; gap: 1rem; align-items: center; }
.kyc-status-icon {
    width: 52px; height: 52px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 1.4rem;
}
.kyc-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.5rem; }
.kyc-step {
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: var(--radius-md); padding: 0.6rem 0.75rem; font-size: 0.75rem; color: var(--text-secondary);
}
.kyc-step.done { border-color: var(--border-green); color: var(--accent-green); }
.kyc-upload {
    border: 1px dashed var(--border-light); border-radius: var(--radius-md);
    padding: 0.75rem; background: var(--bg-secondary);
}
.kyc-upload input[type=file] { width: 100%; color: var(--text-secondary); font-size: 0.8rem; }
.kyc-doc-thumb {
    display: block; width: 100%; max-height: 260px; object-fit: contain;
    background: #000; border-radius: var(--radius-md); border: 1px solid var(--border);
}
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 0.9rem 1.2rem; border-left: 1px solid var(--border); margin-left: 0.3rem; font-size: 0.8rem; }
.timeline li::before { content: ''; position: absolute; left: -5px; top: 0.3rem; width: 9px; height: 9px; border-radius: 50%; background: var(--accent-green); }

/* ---------- Support thread ---------- */
.msg { border-radius: var(--radius-md); padding: 0.75rem 0.9rem; margin-bottom: 0.75rem; font-size: 0.875rem; max-width: 85%; }
.msg.from-user { background: var(--bg-secondary); border: 1px solid var(--border); }
.msg.from-admin { background: var(--accent-green-dim); border: 1px solid var(--border-green); margin-left: auto; }
.msg-meta { font-size: 0.7rem; color: var(--text-muted); margin-bottom: 0.25rem; }
.msg-body { white-space: pre-wrap; word-break: break-word; }

/* ---------- Status tabs scroll on mobile ---------- */
.nav-tabs-apex { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.nav-tabs-apex::-webkit-scrollbar { display: none; }
.nav-tabs-apex .nav-link { white-space: nowrap; }

/* ---------- Mobile fixes ---------- */
@media (max-width: 991.98px) {
    /* The fixed mobile header covered the first line of every page. */
    .main-content { padding-top: 72px; }
}
@media (max-width: 575.98px) {
    .table-apex { font-size: 0.8rem; }
    .table-apex th, .table-apex td { padding: 0.55rem 0.5rem; white-space: nowrap; }
    .bot-stats-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .msg { max-width: 100%; }
    .top-navbar { flex-wrap: wrap; }
    .modal-box { width: 100% !important; }
    .swal2-popup { width: 92vw !important; }
}
