:root {
    --transition-fast: 0.25s ease-in-out;
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s ease-in-out;
    --dashboard-header-height: 3.5rem;
    --dashboard-sidebar-width: 17.5rem;
    --dashboard-sidebar-width-collapsed: 4.5rem;

    --spacing-xl: 2rem;
    --border-radius-md: 0.375rem;

    --bs-border-radius: 0.5rem;
    --bs-border-radius-lg: 0.75rem;
    --bs-border-radius-sm: 0.25rem;
    --bs-box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .15);
}

h2 {
    margin-top: var(--spacing-xl);
    line-height: 1.3;
}

h3 {
    line-height: 1.4;
}

.card-body {
    padding: var(--spacing-xl);
}

.dropdown-toggle::after {
    display: none;
}

.nav-link.dropdown-toggle:hover,
.nav-link[data-bs-toggle="collapse"]:hover {
    transition: var(--transition-fast);
}

.dropdown-item:hover {
    transition: var(--transition-fast);
}

.navbar-toggler__burger {
    background-color: transparent;
    border: none;
    padding: 0;
    width: 20px;
    height: 15px;
    position: relative;
    transform: rotate(0deg);
    transition: transform var(--transition-slow);
    cursor: pointer;
}

.navbar-toggler__burger:focus {
    box-shadow: none;
}

.navbar-toggler__burger:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
    box-shadow: 0 0 0 2px rgba(var(--bs-primary-rgb), 0.25);
}

.navbar-toggler__burger span {
    cursor: pointer;
    margin: 0;
    padding: 0;
    display: block;
    position: absolute;
    height: 3px;
    width: 100%;
    background: var(--bs-primary);
    border-radius: var(--border-radius-md);
    opacity: 1;
    left: 0;
    transform: rotate(0deg);
    transition: var(--transition-fast);
}

.navbar-toggler__burger span:nth-child(1) {
    top: 0;
}

.navbar-toggler__burger span:nth-child(2),
.navbar-toggler__burger span:nth-child(3) {
    top: 6px;
}

.navbar-toggler__burger span:nth-child(4) {
    top: 12px;
}

.navbar-toggler__burger[aria-expanded="true"] span:nth-child(1) {
    top: 6px;
    width: 0%;
    left: 50%;
}

.navbar-toggler__burger[aria-expanded="true"] span:nth-child(2) {
    transform: rotate(45deg);
}

.navbar-toggler__burger[aria-expanded="true"] span:nth-child(3) {
    transform: rotate(-45deg);
}

.navbar-toggler__burger[aria-expanded="true"] span:nth-child(4) {
    top: 12px;
    width: 0%;
    left: 50%;
}

.ve-search-dropdown {
    z-index: 1050;
    max-height: 400px;
    overflow-y: auto;
}

.ve-search-dropdown .ve-search-item {
    cursor: pointer;
}

/* === Dashboard Shell Layout === */

body.dashboard-layout {
    height: 100vh;
    overflow: hidden;
}

.dashboard-shell {
    display: grid;
    grid-template-columns: var(--dashboard-sidebar-width) 1fr;
    height: 100vh;
    transition: grid-template-columns var(--transition-normal);
}

.dashboard-shell.is-collapsed {
    grid-template-columns: var(--dashboard-sidebar-width-collapsed) 1fr;
}

.dashboard-shell__sidebar {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    border-right: 1px solid var(--bs-border-color);
    background: var(--bs-tertiary-bg);
}

.dashboard-shell__sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 1.25rem;
    height: var(--dashboard-header-height);
    flex-shrink: 0;
    border-bottom: 1px solid var(--bs-border-color);
    overflow: hidden;
}

.dashboard-shell__sidebar-header .sidebar-logo {
    flex-shrink: 0;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity var(--transition-normal), width var(--transition-normal);
}

.is-collapsed .dashboard-shell__sidebar-header {
    justify-content: center;
    padding: 0;
}

.is-collapsed .dashboard-shell__sidebar-header .sidebar-logo {
    display: none;
}

.dashboard-shell__sidebar-body {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.dashboard-sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--bs-body-color);
    font-size: 1.375rem;
    padding: 0.375rem;
    cursor: pointer;
    border-radius: var(--bs-border-radius-sm);
    line-height: 1;
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
}

.dashboard-sidebar-toggle:hover {
    background-color: rgba(var(--bs-body-color-rgb), 0.08);
}

.dashboard-shell__right {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
}

.dashboard-topbar {
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    height: var(--dashboard-header-height);
    flex-shrink: 0;
    border-bottom: 1px solid var(--bs-border-color);
    background: var(--bs-body-bg);
    gap: 1rem;
}

.dashboard-topbar-search {
    width: min(100%, 600px);
}

.dashboard-topbar-search__bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    background: var(--bs-tertiary-bg);
    border-radius: var(--bs-border-radius-lg);
    padding: 0.25rem 0.25rem 0.25rem 0.75rem;
    transition: background var(--transition-fast);
}

.dashboard-topbar-search__bar:focus-within {
    background: var(--bs-secondary-bg);
}

.dashboard-topbar-search__icon {
    color: var(--bs-secondary-color);
    font-size: 0.875rem;
    flex-shrink: 0;
}

.dashboard-topbar-search__input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 0.875rem;
    color: var(--bs-body-color);
    min-width: 0;
    padding: 0.25rem 0;
}

.dashboard-topbar-search__input::placeholder {
    color: var(--bs-secondary-color);
}

.dashboard-topbar-search__clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    color: var(--bs-secondary-color);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 50%;
    font-size: 0.75rem;
    line-height: 1;
    flex-shrink: 0;
}

.dashboard-topbar-search__clear:hover {
    color: var(--bs-body-color);
    background: rgba(var(--bs-body-color-rgb), 0.1);
}

.dashboard-topbar-search__btn {
    border-radius: var(--bs-border-radius) !important;
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 0.8125rem;
    padding: 0.3rem 0.875rem;
}

.dashboard-topbar-search .ve-search-dropdown {
    top: 100%;
    margin-top: 0.25rem;
    z-index: 1060;
}

.dashboard-layout .dashboard-main {
    flex: 0 0 auto;
    overflow: visible;
    min-height: calc(100vh - var(--dashboard-header-height));
    display: block;
}

.dashboard-layout .dashboard-footer {
    flex-shrink: 0;
}

.dashboard-layout .dashboard-main > #historical-dashboard-app,
.dashboard-layout .dashboard-main > #download-area-app,
.dashboard-layout .dashboard-main > #comparison-dashboard-app,
.dashboard-layout .dashboard-main > #simulation-dashboard-app {
    min-height: calc(100vh - var(--dashboard-header-height));
}

body.dashboard-layout .dashboard-main .historical-dashboard__content,
body.dashboard-layout .dashboard-main .download-area__content,
body.dashboard-layout .dashboard-main .comparison-dashboard__content,
body.dashboard-layout .dashboard-main .simulation-dashboard__content {
    height: auto;
    overflow-y: visible;
}

.dashboard-layout .dashboard-messages {
    padding: 0.75rem 1.5rem 0;
}

.dashboard-layout .dashboard-messages:empty {
    display: none;
}

.dashboard-layout #feedbackModal {
    z-index: 1060;
}

/* Dashboard content sections: elevated cards */
.historical-dashboard__content .card {
    box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.06),
                0 0.25rem 1rem rgba(0, 0, 0, 0.04);
}

.historical-dashboard__content h2 {
    margin-top: 0;
}

/* Mobile dashboard */
@media (max-width: 767.98px) {
    body.dashboard-layout {
        height: auto;
        overflow: auto;
    }

    .dashboard-shell {
        display: flex;
        flex-direction: column;
        height: auto;
    }

    .dashboard-shell__sidebar {
        display: none;
    }

    .dashboard-topbar {
        height: auto;
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .dashboard-layout .dashboard-main {
        display: block;
        height: auto;
        overflow: visible;
    }

    .dashboard-layout .dashboard-messages {
        padding-inline: 1rem;
    }
}

.debug-banner {
    position: fixed;
    bottom: 0;
    background-color: yellowgreen;
    color: black;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 10px;
}

.login-page-main {
    display: flex;
    min-height: 100vh;
}

.login-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    width: 100%;
    min-height: 100vh;
}

.login-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.75rem 1.25rem;
}

.login-panel__inner {
    width: min(100%, 360px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
}

.login-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.625rem;
}

.login-brand__logo {
    width: 6rem;
    height: 6rem;
    object-fit: contain;
}

.login-card {
    border-radius: 1.5rem;
    overflow: hidden;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-form__field {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.login-form__group .input-group-text {
    width: 3rem;
    justify-content: center;
}

.login-form__submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
}

.login-panel__messages,
.login-card,
.login-legal {
    width: 100%;
}

.login-panel__messages .alert:last-child,
.login-form__error:last-child {
    margin-bottom: 0;
}

.login-legal {
    text-align: center;
}

.login-legal__links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem 0.875rem;
}

.login-hero {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
}

.login-hero__image,
.login-hero__overlay {
    position: absolute;
    inset: 0;
}

.login-hero__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.login-hero__content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100%;
    max-width: 34rem;
    padding: 3rem clamp(1.75rem, 4vw, 4rem);
    gap: 1.5rem;
    margin-inline: auto;
    text-align: center;
}

.login-hero__features {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: min(100%, 28rem);
}

.login-hero__feature {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1rem;
    align-items: start;
}

.login-hero__feature-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.375rem;
    height: 2.375rem;
    border-radius: 999px;
    flex-shrink: 0;
}

@media (max-width: 991.98px) {
    .login-layout {
        grid-template-columns: 1fr;
    }

    .login-panel,
    .login-hero {
        min-height: auto;
    }

    .login-panel {
        padding-block: 2rem;
    }

    .login-hero {
        min-height: 28rem;
    }
}

@media (max-width: 575.98px) {
    .login-panel {
        padding-inline: 1rem;
    }

    .login-panel__inner {
        width: 100%;
    }

    .login-hero {
        min-height: 24rem;
    }

    .login-hero__content {
        padding: 1.75rem 1.25rem;
        gap: 1.25rem;
    }
}
