/*
 * trade6ix overrides on top of Keen — floating sidebar.
 *
 * Keen's layout writes every offset (wrapper margin, fixed header left) in
 * terms of --bs-app-sidebar-width and swaps that variable when the sidebar
 * is minimized, so every calc() below tracks the minimize animation.
 */

:root {
    --t6-sidebar-gap: 14px;
    --t6-sidebar-radius: 1.25rem;
}

/* Deep navy gradient instead of Keen's flat dark */
.app-sidebar {
    background: linear-gradient(180deg, #111a2e 0%, #0b1120 100%) !important;
}

.app-sidebar .app-sidebar-logo {
    border-bottom: 1px dashed rgba(255, 255, 255, 0.08) !important;
}

/* Modern pill menu links with a blue gradient active state */
.app-sidebar .menu > .menu-item > .menu-link {
    border-radius: 0.85rem;
    margin: 2px 0;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.app-sidebar .menu > .menu-item > .menu-link:hover:not(.active) {
    background-color: rgba(255, 255, 255, 0.06) !important;
}

.app-sidebar .menu > .menu-item > .menu-link.active {
    background: linear-gradient(90deg, #3e97ff 0%, #2170cf 100%) !important;
    box-shadow: 0 6px 16px rgba(62, 151, 255, 0.35);
}

.app-sidebar .menu > .menu-item > .menu-link.active .menu-title,
.app-sidebar .menu > .menu-item > .menu-link.active .menu-icon .svg-icon {
    color: #ffffff !important;
}

@media (min-width: 992px) {
    /* Float: inset the fixed sidebar from the viewport edges */
    [data-kt-app-sidebar-fixed="true"] .app-sidebar {
        top: var(--t6-sidebar-gap) !important;
        bottom: var(--t6-sidebar-gap) !important;
        left: var(--t6-sidebar-gap) !important;
        border-radius: var(--t6-sidebar-radius);
        border-right: 0 !important;
        box-shadow: 0 12px 40px rgba(8, 14, 33, 0.35);
    }

    /* Make room for the gap on both sides of the sidebar */
    [data-kt-app-sidebar-fixed="true"] .app-wrapper {
        margin-left: calc(var(--bs-app-sidebar-width) + var(--t6-sidebar-gap) * 2) !important;
    }

    [data-kt-app-header-fixed="true"][data-kt-app-sidebar-fixed="true"][data-kt-app-sidebar-push-header="true"] .app-header {
        left: calc(var(--bs-app-sidebar-width) + var(--t6-sidebar-gap) * 2) !important;
    }
}

/* Mobile drawer keeps a rounded outer edge */
@media (max-width: 991.98px) {
    .app-sidebar {
        border-radius: 0 var(--t6-sidebar-radius) var(--t6-sidebar-radius) 0;
    }
}

/* ------------------------------------------------------------------ */
/* Collapsed (minimized) sidebar rail — clean icon bar, no hover magic */
/* The menu's inner content keeps its expanded width, so everything    */
/* here positions elements inside the visible 75px strip explicitly.   */
/* ------------------------------------------------------------------ */

/* Swap the full logo for the mini badge. !important needed because the
   markup uses Bootstrap's d-flex (which is itself !important). */
.app-sidebar .app-sidebar-logo-minimize {
    display: none;
}

[data-kt-app-sidebar-minimize="on"] .app-sidebar:not(:hover) .app-sidebar-logo-default {
    display: none !important;
}

[data-kt-app-sidebar-minimize="on"] .app-sidebar:not(:hover) .app-sidebar-logo-minimize {
    display: inline-flex !important;
}

[data-kt-app-sidebar-minimize="on"] .app-sidebar:not(:hover) .app-sidebar-logo {
    justify-content: center;
    padding: 0 !important;
}

[data-kt-app-sidebar-minimize="on"] .app-sidebar:not(:hover) .app-sidebar-logo > a {
    display: flex;
    justify-content: center;
    width: 100%;
    margin: 0;
}

/* Section headings become short dividers that fit the rail */
[data-kt-app-sidebar-minimize="on"] .app-sidebar:not(:hover) .menu-heading {
    display: none;
}

[data-kt-app-sidebar-minimize="on"] .app-sidebar:not(:hover) .menu-item.pt-5 .menu-content {
    height: 0;
    padding: 0 !important;
    margin: 0.7rem 0 0.7rem 6px;
    width: 40px;
    border-top: 1px dashed rgba(255, 255, 255, 0.14);
}

/* Square icon pills sized to the rail; titles gone */
[data-kt-app-sidebar-minimize="on"] .app-sidebar:not(:hover) .menu > .menu-item > .menu-link {
    width: 51px;
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

[data-kt-app-sidebar-minimize="on"] .app-sidebar:not(:hover) .menu > .menu-item > .menu-link .menu-icon {
    margin-right: 0;
    justify-content: center;
}

[data-kt-app-sidebar-minimize="on"] .app-sidebar:not(:hover) .menu > .menu-item > .menu-link .menu-title {
    display: none;
}

[data-kt-app-sidebar-minimize="on"] .app-sidebar:not(:hover) .menu .menu-icon .svg-icon svg {
    width: 22px;
    height: 22px;
}

/* ------------------------------------------------------------------ */
/* Header: translucent with blur, blends with the floating theme       */
/* ------------------------------------------------------------------ */

.app-header {
    background-color: color-mix(in srgb, var(--bs-body-bg) 82%, transparent) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(153, 161, 183, 0.14) !important;
    box-shadow: none !important;
}

/* ------------------------------------------------------------------ */
/* Small polish                                                        */
/* ------------------------------------------------------------------ */

/* Table rows respond to hover */
.table.table-row-dashed tbody tr:hover td {
    background-color: rgba(62, 151, 255, 0.045);
    transition: background-color 0.12s ease;
}

/* Page heading breathes a little more */
.page-heading {
    letter-spacing: -0.01em;
}

/* Cards lift subtly on hover — makes the dashboard feel alive */
.card:not(.card-flush):hover,
.card.card-flush:hover {
    box-shadow: 0 6px 24px rgba(15, 25, 45, 0.08);
    transition: box-shadow 0.18s ease;
}

[data-bs-theme="dark"] .card:hover {
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

/* Metric tiles (dashed boxes used across backtests/scanner/profile) */
.border-gray-300.border-dashed {
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.border-gray-300.border-dashed:hover {
    border-color: rgba(62, 151, 255, 0.45) !important;
    background-color: rgba(62, 151, 255, 0.03);
}

/* Tabs: thicker, smoother active indicator */
.nav-line-tabs .nav-item .nav-link.active {
    border-bottom-width: 2px;
}

.nav-line-tabs .nav-item .nav-link {
    transition: color 0.15s ease, border-color 0.15s ease;
}

/* Status dot animation used on running bots / online engine */
.animation-blink {
    animation: t6-blink 1.6s ease-in-out infinite;
}

@keyframes t6-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

/* Monospace, readable code chips (recovery codes, api keys) */
code {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
    letter-spacing: 0.02em;
}

/* Buttons inside table rows shouldn't jump on hover */
.table .btn:hover:not(:disabled) {
    transform: none;
}

@media (prefers-reduced-motion: reduce) {
    .animation-blink {
        animation: none;
    }
}

/* ------------------------------------------------------------------ */
/* Modern forms, buttons, cards, modals                                */
/* ------------------------------------------------------------------ */

.form-control,
.form-select {
    border-radius: 0.75rem !important;
    transition: box-shadow 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: #3e97ff;
    box-shadow: 0 0 0 0.25rem rgba(62, 151, 255, 0.12) !important;
}

.form-control.form-control-solid:focus,
.form-select.form-select-solid:focus {
    box-shadow: 0 0 0 0.25rem rgba(62, 151, 255, 0.12) !important;
}

.form-control.is-invalid:focus,
.form-select.is-invalid:focus {
    box-shadow: 0 0 0 0.25rem rgba(241, 65, 108, 0.12) !important;
}

.btn {
    border-radius: 0.75rem;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease;
}

.btn-primary {
    background: linear-gradient(90deg, #3e97ff 0%, #2170cf 100%) !important;
    border: 0;
}

.btn-primary:hover:not(:disabled),
.btn-success:hover:not(:disabled),
.btn-danger:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(30, 45, 80, 0.18);
}

.btn:active {
    transform: translateY(0);
}

.card {
    border-radius: 1rem;
    box-shadow: 0 2px 14px rgba(15, 25, 45, 0.045);
}

[data-bs-theme="dark"] .card {
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.25);
}

.modal-content {
    border-radius: 1.15rem;
    border: 0;
    box-shadow: 0 18px 60px rgba(10, 16, 35, 0.3);
}

.modal-header,
.modal-footer {
    border-color: rgba(153, 161, 183, 0.18);
}

.table thead th {
    letter-spacing: 0.06em;
}

.badge {
    border-radius: 0.55rem;
}

.alert {
    border-radius: 0.85rem;
    border: 0;
}

/* Auth pages: give the form column a touch more presence */
.app-blank .w-lg-500px.p-10 {
    background: var(--bs-body-bg);
    border-radius: 1.25rem;
    box-shadow: 0 10px 40px rgba(15, 25, 45, 0.07);
    animation: t6-rise 0.45s ease-out both;
}

@keyframes t6-rise {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .app-blank .w-lg-500px.p-10 {
        animation: none;
    }
}

@media (min-width: 992px) {
    .app-blank .w-lg-500px.p-10 {
        padding: 3.5rem !important;
    }
}

/* Input icon tints blue while its field is focused */
.app-blank .position-relative:focus-within > span.position-absolute {
    color: #3e97ff !important;
    transition: color 0.15s ease;
}

.app-blank .form-control:hover:not(:focus) {
    border-color: rgba(62, 151, 255, 0.35);
}

/* Submit arrow nudges right on hover */
.t6-btn-arrow .t6-arrow {
    transition: transform 0.15s ease;
    vertical-align: -2px;
}

.t6-btn-arrow:hover .t6-arrow {
    transform: translateX(4px);
}

/* Form dims while a submit is in flight */
.t6-form-busy {
    opacity: 0.65;
    filter: saturate(0.85);
    pointer-events: none;
    transition: opacity 0.2s ease, filter 0.2s ease;
}

/* Error banner shakes in on every failed attempt */
.t6-shake {
    animation: t6-shake 0.45s ease both;
}

@keyframes t6-shake {
    0% { opacity: 0; transform: translateX(0); }
    20% { opacity: 1; transform: translateX(-7px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(3px); }
    100% { transform: translateX(0); }
}

/* Success overlay shown while redirecting after login/register */
.t6-redirect-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, #111a2e 0%, #0b1120 55%, #10203c 100%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}

.t6-redirect-overlay.show {
    opacity: 1;
    pointer-events: all;
}

.t6-success-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background: linear-gradient(135deg, #50cd89, #2bb673);
    box-shadow: 0 0 0 12px rgba(80, 205, 137, 0.15), 0 12px 35px rgba(80, 205, 137, 0.35);
}

.t6-redirect-overlay.show .t6-success-check {
    animation: t6-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes t6-pop {
    from { transform: scale(0.4); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .t6-shake,
    .t6-redirect-overlay.show .t6-success-check {
        animation: none;
    }
}

.app-blank .form-control,
.app-blank .form-select {
    padding-top: 0.9rem;
    padding-bottom: 0.9rem;
}

.app-blank .btn-primary {
    padding-top: 0.85rem;
    padding-bottom: 0.85rem;
    font-size: 1.05rem;
}

/* Branded auth aside: navy gradient with soft blue glows */
.t6-auth-aside {
    background: linear-gradient(160deg, #111a2e 0%, #0b1120 55%, #10203c 100%);
}

.t6-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    pointer-events: none;
}

.t6-glow-1 {
    width: 440px;
    height: 440px;
    background: #3e97ff;
    opacity: 0.32;
    top: -130px;
    right: -110px;
}

.t6-glow-2 {
    width: 400px;
    height: 400px;
    background: #2170cf;
    opacity: 0.22;
    bottom: -150px;
    left: -130px;
}

.t6-feature-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 0.9rem;
    background: rgba(62, 151, 255, 0.16);
    border: 1px solid rgba(62, 151, 255, 0.25);
    flex-shrink: 0;
}
