:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --success-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --dark-bg: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.4);
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 20px;
    --border-radius-xl: 30px;
    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;
}

* {
    box-sizing: border-box;
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    overflow-x: hidden;
}

/* Modern scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    transition: var(--transition-base);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #7689f0 0%, #8558b0 100%);
}

/* Selection styling */
::selection {
    background: rgba(102, 126, 234, 0.3);
    color: white;
}

::-moz-selection {
    background: rgba(102, 126, 234, 0.3);
    color: white;
}

a, .btn-link {
    color: #667eea;
    text-decoration: none;
    transition: var(--transition-base);
}

a:hover, .btn-link:hover {
    color: #7689f0;
    text-decoration: none;
}

.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50px;
    font-weight: 600;
    padding: 0.625rem 1.5rem;
    transition: var(--transition-base);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
    background: linear-gradient(135deg, #7689f0 0%, #8558b0 100%);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
    outline: none;
}

/* Modern form controls */
.form-control, .form-select {
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-md);
    background: var(--glass-bg);
    color: var(--text-primary);
    backdrop-filter: blur(10px);
    transition: var(--transition-base);
    padding: 0.625rem 1rem;
}

.form-control:focus, .form-select:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
    color: var(--text-primary);
}

.form-control::placeholder {
    color: var(--text-secondary);
}

.account-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 2.5rem 1rem;
    color: #1c2744;
    background:
        radial-gradient(circle at 20% 10%, rgba(102, 126, 234, .16), transparent 32%),
        radial-gradient(circle at 90% 90%, rgba(118, 75, 162, .14), transparent 36%),
        #f7f8fc;
}

.account-home-link {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    align-self: center;
    width: min(100%, 430px);
    color: #56617a;
    font-size: .88rem;
    font-weight: 700;
}

.account-home-link:hover {
    color: #5368c5;
    transform: translateX(-2px);
}

.account-brand {
    display: inline-flex;
    align-items: center;
    gap: .65rem;
    color: #1c2744;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -.04em;
}

.account-brand-mark {
    display: grid;
    width: 2rem;
    height: 2rem;
    place-items: center;
    border-radius: .65rem;
    color: #fff;
    background: var(--primary-gradient);
    box-shadow: 0 8px 18px rgba(102, 126, 234, .25);
}

.account-card {
    width: min(100%, 430px);
    padding: 2.25rem;
    border: 1px solid #e4e7f0;
    border-radius: 24px;
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 24px 60px rgba(35, 48, 91, .12);
}

.account-heading {
    margin-bottom: 1.75rem;
}

.account-eyebrow {
    color: #d67855;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.account-heading h1 {
    margin: .45rem 0 .5rem;
    color: #182343;
    font-size: clamp(2rem, 8vw, 2.5rem);
    letter-spacing: -.05em;
}

.account-heading p {
    margin: 0;
    color: #727b91;
    line-height: 1.55;
}

.account-form {
    display: grid;
    gap: 1rem;
}

.account-form .form-control {
    min-height: 3.35rem;
    border-color: #dfe3ee;
    background: #fff;
    color: #1c2744;
    box-shadow: none;
}

.account-form .form-control:focus {
    border-color: #7180d0;
    box-shadow: 0 0 0 4px rgba(113, 128, 208, .14);
}

.account-form .form-floating > label {
    color: #7d879b;
}

.account-form .validation-message {
    display: block;
    margin-top: .35rem;
    font-size: .78rem;
}

.account-checkbox {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    color: #56617a;
    font-size: .88rem;
}

.account-checkbox input {
    width: 1rem;
    height: 1rem;
    accent-color: #5368c5;
}

.account-submit {
    width: 100%;
    margin-top: .35rem;
    padding: .8rem 1rem;
    border-radius: 12px;
}

.external-login-divider {
    display: flex;
    align-items: center;
    gap: .85rem;
    margin: 1.2rem 0 .9rem;
    color: #9aa3b7;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.external-login-divider::before,
.external-login-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #e2e6ef;
}

.external-login-divider span {
    flex: 0 0 auto;
}

.external-login-buttons {
    display: grid;
    gap: .65rem;
}

.external-login-buttons form {
    margin: 0;
}

.external-login-button {
    width: 100%;
    min-height: 2.8rem;
    border-color: #cfd5e2;
    border-radius: 11px;
    color: #53617d;
    background: #fff;
}

.external-login-button:hover {
    border-color: #7180d0;
    color: #3e4c70;
    background: #f7f8ff;
}

.account-switch {
    margin: 1.5rem 0 0;
    color: #727b91;
    font-size: .9rem;
    text-align: center;
}

.account-recovery {
    margin: .9rem 0 0;
    font-size: .88rem;
    text-align: center;
}

.account-success {
    margin-bottom: 1.25rem;
}

.email-provider-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin: 0 0 1.1rem;
    padding: .65rem .75rem;
    border: 1px solid #e2e6ef;
    border-radius: 12px;
    background: #fafbff;
}

.email-provider-link-label {
    color: #727b91;
    font-size: .82rem;
}

.email-provider-link a {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    color: #5368c5;
    font-size: .86rem;
    font-weight: 700;
    text-decoration: none;
}

.email-provider-link a:hover {
    color: #3e4c70;
}

.email-provider-mark {
    display: inline-grid;
    width: 1.45rem;
    height: 1.45rem;
    place-items: center;
    border-radius: 50%;
    background: #5368c5;
    color: #fff;
    font-size: .75rem;
    font-weight: 800;
    padding: 0;
    line-height: 1;
    flex: 0 0 1.45rem;
    text-align: center;
}

.account-dev-link {
    display: grid;
    gap: .4rem;
    margin-bottom: 1.25rem;
    padding: .85rem 1rem;
    border: 1px dashed #d5b45c;
    border-radius: 12px;
    color: #6d5310;
    background: #fff9e8;
    font-size: .82rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.account-dev-link a {
    color: #6148b5;
}

.account-page .form-control {
    background: #fff;
    border-color: #ced4da;
    color: #1c2744;
    caret-color: #212529;
    backdrop-filter: none;
}

.account-page .form-control:focus {
    background: #fff;
    border-color: #667eea;
    color: #212529;
}

.account-page .form-floating > label {
    color: #6c757d;
}

.account-page .form-control::placeholder {
    color: #6c757d;
}

.content {
    padding-top: 1.1rem;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    letter-spacing: -0.02em;
}

h1:focus {
    outline: none;
}

/* Modern card styling */
.card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    backdrop-filter: blur(10px);
    transition: var(--transition-base);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* Loading states */
.spinner-border {
    animation: spinner-border 0.75s linear infinite;
}

@keyframes spinner-border {
    to {
        transform: rotate(360deg);
    }
}

/* Validation */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
    box-shadow: 0 0 0 3px rgba(38, 176, 80, 0.2);
}

.invalid {
    outline: 1px solid #e50000;
    box-shadow: 0 0 0 3px rgba(229, 0, 0, 0.2);
}

.validation-message {
    color: #ff6b6b;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Error boundary */
.blazor-error-boundary {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-lg);
    position: relative;
}

.blazor-error-boundary::before {
    content: '?';
    position: absolute;
    left: 1rem;
    font-size: 1.8rem;
    top: 50%;
    transform: translateY(-50%);
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--text-secondary);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* Utility animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

.slide-in {
    animation: slideIn 0.3s ease forwards;
}

.scale-in {
    animation: scaleIn 0.3s ease forwards;
}

/* Modern badge */
.badge {
    border-radius: 50px;
    padding: 0.375rem 0.875rem;
    font-weight: 600;
    font-size: 0.875rem;
    letter-spacing: 0.02em;
}

/* Smooth transitions for all interactive elements */
button, a, input, select, textarea {
    transition: var(--transition-base);
}

/* Focus visible for accessibility */
*:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

@media (max-width: 768px) {
    .account-page {
        justify-content: flex-start;
        min-height: 100dvh;
        padding: 2rem .75rem;
    }

    .account-card {
        padding: 1.5rem;
        border-radius: 20px;
    }

    .content {
        padding-top: .5rem;
    }

    .form-control,
    .form-select {
        padding: .55rem .75rem;
    }

    .card:hover {
        transform: none;
        box-shadow: none;
    }

    /* Avoid expensive compositing on the small-screen path. */
    .card,
    .top-row,
    .sidebar {
        backdrop-filter: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }
}
