/* ============================================================
   FILE: static/css/investobots.ui.css
   PURPOSE: InvestoBots shared UI components (Cryptocurrency Trading Terminal Inspired – FINAL)
   ============================================================ */

/* STEP 1 — Base */
* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background: var(--ib-bg);
    color: var(--ib-text);
    font-family: var(--ib-font-main);
}

body {
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select {
    font-family: inherit;
}

.ib-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at 0% 0%, rgba(34, 197, 94, 0.14), transparent 28%),
        radial-gradient(circle at 100% 0%, rgba(56, 189, 248, 0.08), transparent 28%),
        linear-gradient(180deg, #050812 0%, #07101a 100%);
}

.ib-container {
    width: 100%;
    max-width: 1480px;
    margin: 0 auto;
    padding: 18px 20px 34px;
}

/* STEP 2 — Navbar */
.ib-navbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 18px;
    min-height: 72px;
    padding: 0 20px;
    background: rgba(5, 8, 18, 0.94);
    border-bottom: 1px solid var(--ib-border);
    backdrop-filter: blur(16px);
}

.ib-brand {
    font-size: 18px;
    font-weight: 900;
    letter-spacing: -0.05em;
    color: var(--ib-text);
    white-space: nowrap;
}

.ib-nav-left,
.ib-nav-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.ib-nav-left {
    flex: 1;
}

.ib-nav-link {
    color: var(--ib-text-muted);
    font-size: 14px;
    font-weight: 800;
}

.ib-nav-link:hover,
.ib-nav-link.active {
    color: var(--ib-text);
}

.ib-search {
    flex: 1;
    max-width: 460px;
}

.ib-search input {
    width: 100%;
    height: 42px;
    padding: 0 14px;
    color: var(--ib-text);
    background: var(--ib-surface);
    border: 1px solid var(--ib-border);
    border-radius: var(--ib-radius-md);
    outline: none;
}

.ib-search input:focus {
    border-color: var(--ib-primary);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.10);
}

/* STEP 3 — Cards */
.ib-card {
    background: linear-gradient(180deg, rgba(16, 24, 39, 0.98), rgba(11, 16, 32, 0.98));
    border: 1px solid var(--ib-border);
    border-radius: var(--ib-radius-lg);
    box-shadow: var(--ib-shadow-soft);
}

.ib-card-pad {
    padding: 18px;
}

.ib-card-title {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: 900;
}

.ib-section-title {
    margin: 0;
    font-size: 26px;
    font-weight: 900;
    letter-spacing: -0.04em;
}

.ib-section-subtitle {
    margin-top: 6px;
    color: var(--ib-text-muted);
}

/* STEP 4 — Hero */
.ib-hero {
    padding: 44px 24px;
}

.ib-hero h1 {
    max-width: 850px;
    margin: 18px 0 14px;
    font-size: clamp(36px, 5vw, 58px);
    line-height: 1.02;
    letter-spacing: -0.06em;
}

.ib-hero p {
    max-width: 820px;
    color: #9eb6d9;
    font-size: 18px;
    line-height: 1.45;
}

/* STEP 5 — Grids */
.ib-grid {
    display: grid;
    gap: 16px;
}

.ib-grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ib-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ib-grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.ib-grid-8 {
    grid-template-columns: repeat(8, minmax(0, 1fr));
}

.ib-layout-rail {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 16px;
}

.ib-layout-detail {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 16px;
}

/* STEP 6 — Tables */
.ib-table-wrap {
    width: 100%;
    overflow-x: auto;
    background: var(--ib-surface);
    border: 1px solid var(--ib-border);
    border-radius: var(--ib-radius-lg);
}

.ib-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 980px;
}

.ib-table th,
.ib-table td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--ib-border);
    text-align: left;
    vertical-align: middle;
    font-size: 13px;
}

.ib-table th {
    color: var(--ib-text-muted);
    background: rgba(5, 8, 18, 0.5);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.ib-table tr:hover td {
    background: rgba(255, 255, 255, 0.025);
}

.ib-table tr:last-child td {
    border-bottom: 0;
}

.ib-row-link {
    display: block;
}

.ib-token-main {
    font-weight: 900;
    color: var(--ib-text);
}

.ib-token-sub {
    margin-top: 4px;
    color: var(--ib-text-muted);
    font-family: var(--ib-font-mono);
    font-size: 11px;
    max-width: 360px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* STEP 7 — Forms */
.ib-form-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(150px, 1fr));
    gap: 12px;
    align-items: end;
}

.ib-form-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.ib-label {
    display: block;
    margin-bottom: 7px;
    color: var(--ib-text-muted);
    font-size: 12px;
    font-weight: 900;
}

.ib-form-control,
.ib-select {
    width: 100%;
    min-height: 40px;
    padding: 0 12px;
    color: var(--ib-text);
    background: var(--ib-surface);
    border: 1px solid var(--ib-border);
    border-radius: var(--ib-radius-md);
    outline: none;
}

.ib-form-control:focus,
.ib-select:focus {
    border-color: var(--ib-primary);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.10);
}

/* STEP 8 — Buttons */
.ib-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid var(--ib-border);
    border-radius: var(--ib-radius-md);
    color: var(--ib-text);
    background: var(--ib-surface-2);
    cursor: pointer;
    font-size: 13px;
    font-weight: 900;
}

.ib-btn:hover {
    border-color: var(--ib-primary);
}

.ib-btn-primary {
    color: #03120a;
    background: var(--ib-primary);
    border-color: var(--ib-primary);
}

.ib-btn-danger {
    color: var(--ib-danger);
    background: var(--ib-danger-soft);
    border-color: rgba(239, 68, 68, 0.35);
}

.ib-btn-disabled,
.ib-btn.disabled {
    opacity: 0.45;
    pointer-events: none;
}

/* STEP 9 — Badges */
.ib-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 24px;
    padding: 3px 9px;
    border-radius: 999px;
    border: 1px solid var(--ib-border);
    color: var(--ib-text-soft);
    background: var(--ib-surface-2);
    font-size: 12px;
    font-weight: 900;
}

.ib-badge-success {
    color: var(--ib-primary);
    background: var(--ib-primary-soft);
    border-color: rgba(34, 197, 94, 0.35);
}

.ib-badge-danger {
    color: var(--ib-danger);
    background: var(--ib-danger-soft);
    border-color: rgba(239, 68, 68, 0.35);
}

.ib-badge-warning {
    color: var(--ib-warning);
    background: var(--ib-warning-soft);
    border-color: rgba(245, 158, 11, 0.35);
}

/* STEP 10 — Pagination */
.ib-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin: 14px 0;
}

.ib-pagination-links {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

/* STEP 11 — Modal */
.ib-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(8px);
}

.ib-modal {
    width: 480px;
    max-width: calc(100vw - 24px);
    background: var(--ib-surface);
    border: 1px solid var(--ib-border);
    border-radius: var(--ib-radius-lg);
    padding: 18px;
    box-shadow: var(--ib-shadow-soft);
}

.ib-modal h3 {
    margin: 0 0 12px;
}

/* STEP 12 — Alerts */
.ib-banner {
    display: none;
    margin-bottom: 14px;
    padding: 12px 14px;
    color: var(--ib-warning);
    background: var(--ib-warning-soft);
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: var(--ib-radius-md);
}

.ib-banner-title {
    font-weight: 900;
}

.ib-banner-text {
    margin-top: 4px;
    font-size: 13px;
}

.ib-alert-btn {
    min-height: 30px;
    padding: 0 10px;
    border: 1px solid var(--ib-border);
    border-radius: 999px;
    color: var(--ib-text-muted);
    background: var(--ib-surface-2);
    cursor: pointer;
    font-size: 12px;
    font-weight: 900;
}

.ib-alert-btn.on {
    color: var(--ib-primary);
    border-color: rgba(34, 197, 94, 0.35);
    background: var(--ib-primary-soft);
}

.ib-alert-btn.off {
    color: var(--ib-text-muted);
}

.ib-alert-btn.blink {
    animation: ib-blink 1s linear infinite;
    border-color: var(--ib-danger);
}

@keyframes ib-blink {
    50% { opacity: 0.35; }
}

/* STEP 13 — Chart */
.ib-chart-box {
    height: 420px;
    background: #070b15;
    border: 1px solid var(--ib-border);
    border-radius: var(--ib-radius-lg);
}

/* STEP 14 — Utilities */
.ib-muted {
    color: var(--ib-text-muted);
}

.ib-soft {
    color: var(--ib-text-soft);
}

.ib-mono {
    font-family: var(--ib-font-mono);
}

.ib-small {
    font-size: 12px;
}

.ib-positive {
    color: var(--ib-primary);
}

.ib-negative {
    color: var(--ib-danger);
}

.ib-break {
    word-break: break-all;
}

.ib-mb-16 {
    margin-bottom: 16px;
}

.ib-mt-16 {
    margin-top: 16px;
}

/* STEP 15 — Responsive */
@media (max-width: 1100px) {
    .ib-form-grid {
        grid-template-columns: repeat(2, minmax(150px, 1fr));
    }

    .ib-layout-rail,
    .ib-layout-detail {
        grid-template-columns: 1fr;
    }

    .ib-grid-3,
    .ib-grid-4,
    .ib-grid-8 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .ib-navbar {
        flex-wrap: wrap;
        padding: 12px;
    }

    .ib-search {
        order: 3;
        max-width: none;
        width: 100%;
    }

    .ib-grid-2,
    .ib-grid-3,
    .ib-grid-4,
    .ib-grid-8,
    .ib-form-grid {
        grid-template-columns: 1fr;
    }

    .ib-container {
        padding: 14px;
    }
}
/* ============================================================
   STEP — Auth / Account Pages Terminal UI
   ============================================================ */

.ib-auth-shell {
    min-height: calc(100vh - 180px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 0;
}

.ib-auth-card {
    width: 100%;
    max-width: 460px;
    padding: 28px;
    background: linear-gradient(180deg, var(--ib-surface), var(--ib-bg-soft));
    border: 1px solid var(--ib-border);
    border-radius: var(--ib-radius-lg);
    box-shadow: var(--ib-shadow-soft);
}

.ib-auth-head {
    margin-bottom: 20px;
}

.ib-auth-form {
    display: grid;
    gap: 14px;
}

.ib-field {
    display: grid;
    gap: 6px;
}

.ib-field input,
.ib-field select,
.ib-field textarea,
.ib-django-form input,
.ib-django-form select,
.ib-django-form textarea {
    width: 100%;
    min-height: 40px;
    padding: 0 12px;
    color: var(--ib-text);
    background: var(--ib-surface-2);
    border: 1px solid var(--ib-border);
    border-radius: var(--ib-radius-md);
    outline: none;
}

.ib-field textarea,
.ib-django-form textarea {
    min-height: 90px;
    padding: 10px 12px;
}

.ib-field input:focus,
.ib-field select:focus,
.ib-field textarea:focus,
.ib-django-form input:focus,
.ib-django-form select:focus,
.ib-django-form textarea:focus {
    border-color: var(--ib-primary);
}

.ib-django-form p {
    margin: 0 0 14px 0;
}

.ib-django-form label {
    display: block;
    margin-bottom: 6px;
    color: var(--ib-text-muted);
    font-size: 12px;
    font-weight: 800;
}

.ib-error {
    color: var(--ib-danger);
    font-size: 12px;
}

.ib-btn-full {
    width: 100%;
}

.ib-auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
    color: var(--ib-text-muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.ib-auth-divider::before,
.ib-auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--ib-border);
}

.ib-auth-links {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 18px;
    flex-wrap: wrap;
}

.ib-profile-form {
    display: block;
}
