:root {
    /* No navbar on the auth pages. The retired /shared-topnav.js stub used to pin
       this to 0; seed it here so .auth-container's calc(100vh - var(--tt-topnav-h))
       stays a full viewport now that the stub reference is gone. */
    --tt-topnav-h: 0px;

    --primary-bg: #0a0a0f;
    --secondary-bg: #141419;
    --card-bg: #1a1a24;
    --card-hover-bg: #222230;
    --border-color: rgba(255, 255, 255, 0.1);
    --border-hover: rgba(255, 255, 255, 0.2);

    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-error: #ef4444;
    --accent-info: #3b82f6;

    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-tertiary: rgba(255, 255, 255, 0.5);

    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;

    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;

    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
}

/* Custom Scrollbar - Dark Mode (Ultra Modern Design) */
::-webkit-scrollbar {
    width: 16px;
    height: 16px;
}

::-webkit-scrollbar-track {
    background: var(--primary-bg);
    border-left: 1px solid var(--border-color);
    border-top: 1px solid var(--border-color);
}

::-webkit-scrollbar-track:horizontal {
    border-left: none;
    border-top: 1px solid var(--border-color);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 50%, #ec4899 100%);
    border: 4px solid var(--primary-bg);
    border-radius: 12px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 0 10px rgba(99, 102, 241, 0.3);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #ec4899 0%, var(--accent-secondary) 50%, var(--accent-primary) 100%);
    border-width: 2px;
    box-shadow:
        0 0 20px rgba(99, 102, 241, 0.8),
        0 0 40px rgba(139, 92, 246, 0.5),
        inset 0 0 15px rgba(236, 72, 153, 0.3);
    transform: scale(1.05);
}

/* Light Mode */
[data-theme="light"] {
    --primary-bg: #f8fafc;
    --secondary-bg: #ffffff;
    --card-bg: #ffffff;
    --card-hover-bg: #f8fafc;
    --border-color: rgba(0, 0, 0, 0.1);
    --border-hover: rgba(0, 0, 0, 0.2);

    --text-primary: #0f172a;
    --text-secondary: rgba(15, 23, 42, 0.7);
    --text-tertiary: rgba(15, 23, 42, 0.5);

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
}

/* Custom Scrollbar - Light Mode */
[data-theme="light"] ::-webkit-scrollbar-track {
    background: #f8fafc;
    border-left: 1px solid rgba(0, 0, 0, 0.08);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
    border: 4px solid #f8fafc;
    border-radius: 12px;
    box-shadow: inset 0 0 10px rgba(99, 102, 241, 0.2);
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #ec4899 0%, #8b5cf6 50%, #6366f1 100%);
    border-width: 2px;
    box-shadow:
        0 0 20px rgba(99, 102, 241, 0.6),
        0 0 40px rgba(139, 92, 246, 0.4),
        inset 0 0 15px rgba(236, 72, 153, 0.2);
    transform: scale(1.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--primary-bg);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Auth Container */
.auth-container {
    min-height: calc(100vh - var(--tt-topnav-h, 56px));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl);
    position: relative;
    overflow: hidden;
}

/* Auth Background */
.auth-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
}

.bg-circle {
    position: absolute;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    opacity: 0.05;
    animation: float 20s infinite ease-in-out;
}

.bg-circle:nth-child(1) {
    width: 400px;
    height: 400px;
    top: -200px;
    left: -200px;
    animation-delay: 0s;
}

.bg-circle:nth-child(2) {
    width: 600px;
    height: 600px;
    bottom: -300px;
    right: -300px;
    animation-delay: -7s;
}

.bg-circle:nth-child(3) {
    width: 300px;
    height: 300px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -14s;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-30px) rotate(180deg);
    }
}

/* Auth Card */
.auth-card {
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    width: 100%;
    max-width: 450px;
    box-shadow: var(--shadow-xl);
    position: relative;
    z-index: 1;
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Auth Header */
.auth-header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
    position: relative;
}

.auth-logo {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--spacing-md);
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
}

.auth-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: var(--spacing-xs);
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Auth Form */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.input-group i {
    position: absolute;
    left: var(--spacing-md);
    color: var(--text-tertiary);
    font-size: 0.875rem;
    pointer-events: none;
}

.input-group input {
    width: 100%;
    padding: var(--spacing-md) var(--spacing-md) var(--spacing-md) 2.75rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: inherit;
    transition: all var(--transition-base);
}

.input-group input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.input-group input::placeholder {
    color: var(--text-tertiary);
}

/* Password Strength */
.password-strength {
    margin-top: var(--spacing-xs);
}

.strength-bar {
    width: 100%;
    height: 4px;
    background: var(--card-bg);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: var(--spacing-xs);
}

.strength-fill {
    height: 100%;
    background: var(--accent-error);
    transition: all var(--transition-base);
    width: 0;
}

.strength-text {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

/* Form Options */
.form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-md);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-secondary);
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent-primary);
}

.checkbox-label span {
    flex: 1;
}

/* Terms / Privacy links inside the agree-checkbox (Rule 7.4 terms notice) */
.checkbox-label a {
    color: var(--accent-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.checkbox-label a:hover {
    color: var(--accent-secondary, var(--accent-primary));
}

/* Error Message */
.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    font-size: 0.875rem;
    color: var(--accent-error);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.error-message::before {
    content: '\f06a';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
}

/* Buttons */
.btn {
    padding: var(--spacing-md) var(--spacing-lg);
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    transition: all var(--transition-base);
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--card-bg);
    color: var(--text-primary);
}

.btn-block {
    width: 100%;
}

.btn-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Auth Footer */
.auth-footer {
    text-align: center;
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--border-color);
}

.auth-footer p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-base);
}

.auth-footer a:hover {
    color: var(--accent-secondary);
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--card-bg);
    color: var(--text-primary);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    opacity: 0;
    transform: translateY(1rem);
    transition: all var(--transition-base);
    z-index: 10000;
    max-width: 400px;
    border-left: 4px solid var(--accent-primary);
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-success {
    border-left-color: var(--accent-success);
}

.toast-success i {
    color: var(--accent-success);
}

.toast-error {
    border-left-color: var(--accent-error);
}

.toast-error i {
    color: var(--accent-error);
}

.toast i {
    font-size: 1.25rem;
}

.toast span {
    flex: 1;
    font-size: 0.875rem;
}

/* Theme Toggle (matching Kanban board style) */
.theme-toggle {
    position: absolute;
    top: 0;
    right: 0;
    width: 40px;
    height: 40px;
    padding: 0 !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden;
}

.theme-toggle i {
    font-size: 1.1rem;
    transition: transform 0.3s ease;
}

.theme-toggle:hover i {
    transform: rotate(20deg) scale(1.1);
}

/* Responsive */
@media (max-width: 768px) {
    .auth-container {
        padding: var(--spacing-md);
    }

    .auth-card {
        padding: var(--spacing-lg);
    }

    .auth-header h1 {
        font-size: 1.5rem;
    }

    .toast {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
        max-width: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Live @handle preview under the name field (added 2026-09-04). The handle is derived from
   the name with the diacritics FOLDED (š→s, á→a) — see usernameFromName() in script.js. */
.handle-preview {
    margin: 0.4rem 0 0;
    font-size: 0.75rem;
    color: var(--text-tertiary, rgba(255, 255, 255, 0.5));
}

.handle-preview code {
    padding: 1px 6px;
    border-radius: 5px;
    background: rgba(99, 102, 241, 0.16);
    color: var(--accent-primary, #6366f1);
    font-weight: 700;
    font-family: 'SFMono-Regular', Consolas, monospace;
}

.handle-preview[hidden] { display: none !important; }
