/* ============================================
   Babbel User — design system
   ============================================ */

:root {
    --user-bg: #f1f5f9;
    --user-surface: #ffffff;
    --user-text: #0f172a;
    --user-muted: #64748b;
    --user-border: #e2e8f0;
    --user-accent: #2563eb;
    --user-accent-hover: #1d4ed8;
    --user-accent-soft: #eff6ff;
    --user-danger: #dc2626;
    --user-success: #16a34a;
    --user-warning: #d97706;
    --user-radius: 14px;
    --user-radius-sm: 10px;
    --user-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .04);
    --user-header-h: 64px;
    --user-focus: 0 0 0 3px rgba(37, 99, 235, .28);
    --user-content-max: 72rem;
    --user-form-max: 44rem;
    --user-form-wide-max: 56rem;
    --user-readable-max: 42rem;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body.user-app-body,
body.auth-body {
    margin: 0;
    min-height: 100vh;
    font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--user-text);
    background: var(--user-bg);
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--user-accent);
}

a:hover {
    color: var(--user-accent-hover);
}

:focus-visible {
    outline: none;
    box-shadow: var(--user-focus);
}

.btn:focus-visible,
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    box-shadow: var(--user-focus);
    border-color: var(--user-accent);
}

.btn-primary {
    --bs-btn-bg: var(--user-accent);
    --bs-btn-border-color: var(--user-accent);
    --bs-btn-hover-bg: var(--user-accent-hover);
    --bs-btn-hover-border-color: var(--user-accent-hover);
    --bs-btn-active-bg: var(--user-accent-hover);
    --bs-btn-active-border-color: var(--user-accent-hover);
    font-weight: 600;
}

#main-content:focus {
    outline: none;
    box-shadow: none;
}

.skip-link {
    position: absolute;
    left: 1rem;
    top: -4rem;
    z-index: 2000;
    background: var(--user-text);
    color: #fff;
    padding: .5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
}

.skip-link:focus {
    top: 1rem;
    color: #fff;
}

/* ============================================
   Header
   ============================================ */

.user-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--user-border);
    min-height: var(--user-header-h);
}

.user-topbar-inner {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-height: var(--user-header-h);
    width: 100%;
    max-width: var(--user-content-max);
    margin: 0 auto;
    padding: 0 max(1.25rem, env(safe-area-inset-right)) 0 max(1.25rem, env(safe-area-inset-left));
}

.user-brand {
    display: inline-flex;
    align-items: center;
    gap: .65rem;
    color: var(--user-text);
    font-weight: 700;
    font-size: 1.05rem;
    text-decoration: none;
    flex-shrink: 0;
}

.user-brand:hover {
    color: var(--user-text);
}

.user-brand .brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--user-accent);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.user-nav {
    display: flex;
    align-items: center;
    gap: .25rem;
    margin-left: .5rem;
}

.user-nav-link {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .45rem .8rem;
    border-radius: 999px;
    color: var(--user-muted);
    font-weight: 600;
    font-size: .9rem;
    text-decoration: none;
}

.user-nav-link:hover {
    color: var(--user-text);
    background: #f1f5f9;
}

.user-nav-link.is-active {
    color: var(--user-accent);
    background: var(--user-accent-soft);
}

.user-topbar-actions {
    display: flex;
    align-items: center;
    gap: .65rem;
    margin-left: auto;
}

.user-nav-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border: 0;
    background: transparent;
    color: var(--user-text);
    border-radius: 10px;
}

.user-nav-toggle:hover {
    background: #f1f5f9;
}

.user-menu-btn {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .25rem .45rem .25rem .25rem;
    border: 1px solid var(--user-border);
    background: var(--user-surface);
    border-radius: 999px;
    color: var(--user-text);
    font-weight: 600;
    font-size: .85rem;
}

.user-menu-btn:hover {
    background: #f8fafc;
}

.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #0f172a;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    font-weight: 700;
}

.user-dropdown .dropdown-menu {
    min-width: 220px;
    border: 1px solid var(--user-border);
    border-radius: 12px;
    box-shadow: var(--user-shadow);
    padding: .4rem;
}

.user-dropdown .dropdown-item {
    border-radius: 8px;
    font-size: .9rem;
    padding: .5rem .7rem;
}

.user-dropdown .dropdown-item-text {
    font-size: .8rem;
    color: var(--user-muted);
    padding: .4rem .7rem .2rem;
}

/* ============================================
   Credits
   ============================================ */

.credit-badge {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    background: #fff7ed;
    color: #9a3412;
    border: 1px solid #fed7aa;
    border-radius: 999px;
    padding: .35rem .85rem;
    font-size: .85rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.credit-badge:hover {
    color: #7c2d12;
    background: #ffedd5;
}

.credit-cost-footer {
    display: flex;
    align-items: center;
    gap: .75rem;
    background: var(--user-surface);
    border: 1px solid var(--user-border);
    border-radius: var(--user-radius-sm);
    padding: .85rem 1rem;
    color: var(--user-muted);
    font-size: .9rem;
}

.credit-cost-footer.is-warning {
    background: #fff7ed;
    border-color: #fed7aa;
    color: #9a3412;
}

.credit-cost-footer i {
    color: var(--user-warning);
}

/* ============================================
   Main / page chrome
   ============================================ */

.user-main {
    min-height: calc(100vh - var(--user-header-h) - 72px);
}

.user-content {
    width: 100%;
    max-width: var(--user-content-max);
    margin: 0 auto;
    padding: 1.5rem max(1.25rem, env(safe-area-inset-right)) 3rem max(1.25rem, env(safe-area-inset-left));
}

.user-form-page {
    width: 100%;
    max-width: var(--user-form-max);
    margin: 0 auto;
}

.user-form-page--wide {
    max-width: var(--user-form-wide-max);
}

.user-page-header {
    margin-bottom: 1.5rem;
}

.user-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem;
    font-size: .8rem;
    color: var(--user-muted);
    margin-bottom: .55rem;
}

.user-breadcrumb a {
    color: var(--user-muted);
    text-decoration: none;
}

.user-breadcrumb a:hover {
    color: var(--user-accent);
}

.user-page-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.user-page-heading h1 {
    font-size: 1.55rem;
    font-weight: 700;
    letter-spacing: -.02em;
    margin: 0;
    line-height: 1.25;
}

.user-page-subtitle {
    margin: .35rem 0 0;
    color: var(--user-muted);
    max-width: var(--user-readable-max);
}

.user-flash .alert {
    border-radius: var(--user-radius-sm);
}

.user-footer {
    border-top: 1px solid var(--user-border);
    color: var(--user-muted);
    font-size: .8rem;
    padding: 1.25rem;
    text-align: center;
}

/* ============================================
   Home / modules
   ============================================ */

.user-hero {
    margin-bottom: 2rem;
}

.user-hero-title {
    font-size: clamp(1.5rem, 2.4vw, 1.9rem);
    font-weight: 700;
    letter-spacing: -.03em;
    margin: 0 0 .4rem;
}

.user-hero-subtitle {
    color: var(--user-muted);
    margin: 0;
    max-width: var(--user-readable-max);
}

.user-module-section {
    margin-bottom: 2rem;
}

.user-module-section-title {
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--user-muted);
    margin: 0 0 .85rem;
}

.module-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--user-surface);
    border: 1px solid var(--user-border);
    border-radius: var(--user-radius);
    padding: 1.25rem 1.3rem 1.15rem;
    text-decoration: none;
    color: inherit;
    transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
}

.module-card:hover,
.module-card:focus-visible {
    color: inherit;
    border-color: #bfdbfe;
    box-shadow: var(--user-shadow);
    transform: translateY(-2px);
}

.module-card-disabled {
    opacity: .72;
}

.module-card-disabled:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--user-border);
}

.module-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--user-accent-soft);
    color: var(--user-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    margin-bottom: .9rem;
}

.module-card-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0 0 .4rem;
}

.module-card-desc {
    color: var(--user-muted);
    font-size: .9rem;
    line-height: 1.45;
    flex-grow: 1;
    margin: 0;
}

.module-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-top: 1rem;
    padding-top: .9rem;
    border-top: 1px solid #f1f5f9;
}

.module-cost {
    font-size: .8rem;
    font-weight: 600;
    color: var(--user-muted);
    background: #f8fafc;
    border-radius: 999px;
    padding: .25rem .65rem;
}

.module-cta {
    font-size: .85rem;
    font-weight: 700;
    color: var(--user-accent);
}

.module-card-disabled .module-cta {
    color: var(--user-muted);
}

.user-empty {
    background: var(--user-surface);
    border: 1px dashed var(--user-border);
    border-radius: var(--user-radius);
    padding: 2.5rem 1.5rem;
    text-align: center;
    color: var(--user-muted);
}

.user-empty i {
    font-size: 1.75rem;
    margin-bottom: .75rem;
    color: #94a3b8;
}

/* ============================================
   Status / result / lists
   ============================================ */

.user-status-card {
    background: var(--user-surface);
    border: 1px solid var(--user-border);
    border-radius: var(--user-radius);
    padding: 1.15rem 1.25rem;
}

.user-txn-list {
    background: var(--user-surface);
    border: 1px solid var(--user-border);
    border-radius: var(--user-radius);
    overflow: hidden;
}

.user-txn-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: .95rem 1.15rem;
    border-bottom: 1px solid #f1f5f9;
}

.user-txn-item:last-child {
    border-bottom: 0;
}

.license-list {
    background: var(--user-surface);
    border: 1px solid var(--user-border);
    border-radius: var(--user-radius);
    overflow: hidden;
}

.license-list-item {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.15rem 1.25rem;
    border-bottom: 1px solid #f1f5f9;
}

.license-list-item:last-child {
    border-bottom: 0;
}

.license-list-main {
    flex: 1 1 16rem;
    min-width: 0;
}

.license-list-name {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0 0 .75rem;
}

.license-list-data {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
    gap: .55rem 1.25rem;
    margin: 0;
}

.license-list-data div {
    min-width: 0;
}

.license-list-data dt {
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--user-muted);
    margin: 0 0 .15rem;
}

.license-list-data dd {
    margin: 0;
    font-size: .925rem;
    word-break: break-word;
}

.license-list-pending {
    margin: .75rem 0 0;
    font-size: .8rem;
    color: #b45309;
}

.license-list-actions {
    flex: 0 0 auto;
    align-self: flex-start;
}

.user-state {
    max-width: 28rem;
    margin: 2.5rem auto;
    text-align: center;
}

.user-state-icon {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1.1rem;
}

.user-state-icon.is-lock {
    background: #f1f5f9;
    color: #64748b;
}

.user-state-icon.is-coins {
    background: #fff7ed;
    color: var(--user-warning);
}

/* ============================================
   Auth
   ============================================ */

.auth-body {
    display: flex;
    min-height: 100vh;
}

.auth-main {
    width: 100%;
    max-width: 420px;
    margin: auto;
    padding: 2rem 1.25rem 3rem;
}

.auth-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .65rem;
    margin-bottom: 1.5rem;
    color: var(--user-text);
    font-weight: 700;
    font-size: 1.2rem;
    text-decoration: none;
}

.auth-brand:hover {
    color: var(--user-text);
}

.auth-brand .brand-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--user-accent);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.auth-card {
    background: var(--user-surface);
    border: 1px solid var(--user-border);
    border-radius: 18px;
    box-shadow: var(--user-shadow);
    padding: 1.75rem 1.5rem 1.5rem;
}

.auth-card h1 {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0 0 .35rem;
}

.auth-lead {
    color: var(--user-muted);
    font-size: .925rem;
    margin-bottom: 1.25rem;
}

.auth-switch {
    margin: 1.1rem 0 0;
    text-align: center;
    color: var(--user-muted);
    font-size: .875rem;
}

.auth-footer {
    margin-top: 1.5rem;
    text-align: center;
    color: var(--user-muted);
    font-size: .8rem;
}

.password-field {
    position: relative;
}

.password-field .form-control {
    padding-right: 2.75rem;
}

.password-toggle {
    position: absolute;
    right: .35rem;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: var(--user-muted);
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 8px;
}

.password-toggle:hover {
    color: var(--user-text);
}

/* ============================================
   Forms polish
   ============================================ */

.form-label {
    font-weight: 600;
    font-size: .875rem;
    margin-bottom: .35rem;
}

.form-control,
.form-select {
    border-radius: 10px;
    border-color: #cbd5e1;
    padding: .6rem .8rem;
}

.card {
    border-radius: var(--user-radius);
}

.offcanvas.user-offcanvas {
    width: min(320px, 92vw);
}

.user-offcanvas .offcanvas-header {
    border-bottom: 1px solid var(--user-border);
}

.user-offcanvas .user-nav-link {
    display: flex;
    width: 100%;
    border-radius: 10px;
}

@media (max-width: 991.98px) {
    .user-nav-desktop {
        display: none;
    }

    .user-nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .user-brand .brand-text {
        display: none;
    }
}

.choice-card {
    cursor: pointer;
    background: var(--user-surface);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.choice-card:hover {
    border-color: #bfdbfe !important;
}

.choice-card:has(input:checked) {
    border-color: var(--user-accent) !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .module-card,
    .module-card:hover {
        transition: none;
        transform: none;
    }
}
