/* --- Auth - ulica.club v5 REWORK --- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    color-scheme: dark;
    --bg: #07070b;
    --surface: rgba(13, 13, 20, 0.85);
    --surface-border: rgba(255, 255, 255, 0.05);
    --surface-hover: rgba(255, 255, 255, 0.03);
    --accent: #6c5ce7;
    --accent-rgb: 108, 92, 231;
    --accent-dim: rgba(108, 92, 231, 0.15);
    --accent-glow: rgba(108, 92, 231, 0.25);
    --text: #e5e5eb;
    --text-dim: #7d7f8a;
    --text-muted: #53565d;
    --danger: #ef4444;
    --success: #22c55e;
    --radius: 16px;
    --transition: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

::selection {
    background: rgba(108, 92, 231, 0.35);
    color: #fff;
}

::-moz-selection {
    background: rgba(108, 92, 231, 0.35);
    color: #fff;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- Background --- */
.auth-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}

.auth-particles {
    position: absolute;
    inset: 0;
}

.auth-particle {
    position: absolute;
    border-radius: 50%;
    background: rgba(108, 92, 231, 0.12);
    animation: particleFloat linear infinite;
}

@keyframes particleFloat {
    0% {
        translate: 0 110vh;
        scale: 0;
        opacity: 0;
    }

    10% {
        opacity: 0.6;
        scale: 1;
    }

    90% {
        opacity: 0.1;
    }

    100% {
        translate: var(--drift, 0px) -10vh;
        scale: 0.3;
        opacity: 0;
    }
}

.auth-glow {
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(140px);
    opacity: 0.06;
    animation: glowOrbit 25s ease-in-out infinite;
}

.auth-glow-1 {
    background: var(--accent);
    top: -200px;
    left: -200px;
}

.auth-glow-2 {
    background: #06b6d4;
    bottom: -200px;
    right: -200px;
    animation-delay: -12s;
    animation-direction: reverse;
}

@keyframes glowOrbit {

    0%,
    100% {
        translate: 0 0;
    }

    25% {
        translate: 80px 60px;
    }

    50% {
        translate: -40px 100px;
    }

    75% {
        translate: 60px -40px;
    }
}

/* Noise grain */
.auth-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 0 0' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 1;
}

/* --- Wrapper --- */
.auth-wrapper {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    gap: 20px;
}

/* --- Card --- */
.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    backdrop-filter: blur(40px) saturate(1.4);
    -webkit-backdrop-filter: blur(40px) saturate(1.4);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius);
    padding: 36px 32px 32px;
    position: relative;
    overflow: hidden;
    animation: cardIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Animated gradient border */
.auth-card::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: calc(var(--radius) + 1px);
    padding: 1px;
    background: conic-gradient(from var(--border-angle, 0deg), rgba(108, 92, 231, 0.3), transparent 25%, transparent 50%, rgba(6, 182, 212, 0.15) 75%, rgba(108, 92, 231, 0.3));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    z-index: 1;
    animation: rotateBorder 8s linear infinite;
}

@property --border-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

@keyframes rotateBorder {
    to {
        --border-angle: 360deg;
    }
}

/* Subtle inner glow */
.auth-card::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -25%;
    width: 150%;
    height: 100%;
    background: radial-gradient(ellipse, rgba(108, 92, 231, 0.03), transparent 60%);
    pointer-events: none;
    z-index: 0;
    border-radius: inherit;
}

@keyframes cardIn {
    from {
        opacity: 0;
        translate: 0 30px;
        scale: 0.97;
    }

    to {
        opacity: 1;
        translate: 0 0;
        scale: 1;
    }
}

/* --- Logo --- */
.auth-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    margin-bottom: 28px;
}

.auth-logo-icon {
    width: 28px;
    height: 28px;
    color: var(--accent);
    animation: logoPulse 3s ease-in-out infinite;
}

.auth-logo-icon svg {
    width: 100%;
    height: 100%;
}

@keyframes logoPulse {

    0%,
    100% {
        filter: drop-shadow(0 0 6px var(--accent-glow));
    }

    50% {
        filter: drop-shadow(0 0 18px var(--accent-glow));
    }
}

.auth-logo-text {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* --- Tabs --- */
.auth-tabs {
    display: flex;
    position: relative;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    padding: 3px;
    margin-bottom: 28px;
    gap: 2px;
}

.auth-tab {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-dim);
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    padding: 10px 0;
    cursor: pointer;
    position: relative;
    z-index: 1;
    transition: color var(--transition);
    border-radius: 8px;
}

.auth-tab.active {
    color: var(--text);
}

.auth-tab:hover:not(.active) {
    color: var(--text);
}

.auth-tab-indicator {
    position: absolute;
    top: 3px;
    left: 3px;
    width: calc(50% - 4px);
    height: calc(100% - 6px);
    background: rgba(108, 92, 231, 0.12);
    border: 1px solid rgba(108, 92, 231, 0.08);
    border-radius: 8px;
    transition: transform var(--transition);
    z-index: 0;
}

.auth-tabs[data-active="register"] .auth-tab-indicator {
    transform: translateX(calc(100% + 2px));
}

/* --- Form --- */
.auth-form {
    display: none;
    flex-direction: column;
    gap: 18px;
    animation: formIn 0.4s ease both;
}

.auth-form.active {
    display: flex;
}

@keyframes formIn {
    from {
        opacity: 0;
        translate: 0 12px;
    }

    to {
        opacity: 1;
        translate: 0 0;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-dim);
}

.input-wrap {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 10px;
    padding: 0 14px;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.input-wrap:focus-within {
    border-color: rgba(108, 92, 231, 0.5);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1), 0 0 24px rgba(108, 92, 231, 0.06);
    background: rgba(108, 92, 231, 0.02);
}

.input-icon {
    color: var(--text-muted);
    font-size: 13px;
    margin-right: 10px;
    flex-shrink: 0;
    transition: color var(--transition);
}

.input-wrap:focus-within .input-icon {
    color: var(--accent);
}

.input-wrap input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text);
    font: inherit;
    font-size: 13px;
    padding: 12px 0;
    min-width: 0;
}

.input-wrap input::placeholder {
    color: var(--text-muted);
}

.input-toggle-pw {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    font-size: 13px;
    transition: color var(--transition);
}

.input-toggle-pw:hover {
    color: var(--text);
}

.input-hint {
    font-size: 10px;
    color: var(--text-muted);
    padding-left: 2px;
}

.input-hint code {
    background: var(--accent-dim);
    color: var(--accent);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 800;
}

/* --- Password Meter --- */
.pw-meter {
    display: flex;
    gap: 4px;
    padding-top: 2px;
}

.pw-meter>div {
    flex: 1;
    height: 3px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.05);
    transition: background 0.3s ease;
}

.pw-meter[data-strength="1"]>div:nth-child(1) {
    background: var(--danger);
}

.pw-meter[data-strength="2"]>div:nth-child(-n+2) {
    background: #f59e0b;
}

.pw-meter[data-strength="3"]>div:nth-child(-n+3) {
    background: #eab308;
}

.pw-meter[data-strength="4"]>div {
    background: var(--success);
}

/* --- Submit Button --- */
.auth-submit {
    position: relative;
    background: linear-gradient(135deg, var(--accent), #5a4bd0);
    border: none;
    border-radius: 10px;
    padding: 13px 24px;
    color: #fff;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    overflow: hidden;
    transition: all var(--transition);
    margin-top: 4px;
}

.auth-submit:hover {
    box-shadow: 0 6px 28px var(--accent-glow);
    transform: translateY(-1px);
}

.auth-submit:active {
    transform: translateY(0) scale(0.99);
}

.auth-submit.loading .auth-submit-text {
    opacity: 0;
}

.auth-submit.loading .auth-submit-loader {
    opacity: 1;
}

.auth-submit-text {
    transition: opacity 0.2s ease;
}

.auth-submit-loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.spinner-ring {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        rotate: 360deg;
    }
}

.auth-submit-shimmer {
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 25%, rgba(255, 255, 255, 0.08) 50%, transparent 75%);
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {

    0%,
    100% {
        translate: -100% 0;
    }

    50% {
        translate: 100% 0;
    }
}

/* --- Back Link --- */
.auth-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition);
    animation: cardIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.2s both;
}

.auth-back:hover {
    color: var(--accent);
}

/* --- Toasts --- */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(12, 12, 16, 0.9);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    animation: toastIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
    min-width: 280px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.toast.out {
    animation: toastOut 0.3s ease forwards;
}

.toast-icon {
    font-size: 15px;
    flex-shrink: 0;
}

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

.toast.error .toast-icon {
    color: var(--danger);
}

.toast.info .toast-icon {
    color: var(--accent);
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    border-radius: 0 0 10px 10px;
    animation: toastProgress 3s linear forwards;
}

.toast.success .toast-progress {
    background: var(--success);
}

.toast.error .toast-progress {
    background: var(--danger);
}

.toast.info .toast-progress {
    background: var(--accent);
}

@keyframes toastIn {
    from {
        opacity: 0;
        translate: 40px 0;
        scale: 0.95;
    }

    to {
        opacity: 1;
        translate: 0 0;
        scale: 1;
    }
}

@keyframes toastOut {
    to {
        opacity: 0;
        translate: 40px 0;
        scale: 0.95;
    }
}

@keyframes toastProgress {
    from {
        width: 100%;
    }

    to {
        width: 0;
    }
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(108, 92, 231, 0.15);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(108, 92, 231, 0.25);
}

html {
    scrollbar-width: thin;
    scrollbar-color: rgba(108, 92, 231, 0.15) transparent;
}

/* --- Forgot Password Link --- */
.auth-forgot-link {
    display: block;
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    text-decoration: none;
    margin-top: -4px;
    transition: color var(--transition);
}

.auth-forgot-link:hover {
    color: var(--accent);
}

/* --- Auth Panels --- */
.auth-panel {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    text-align: center;
    animation: formIn 0.4s ease both;
    padding: 8px 0;
}

.auth-panel .form-group {
    width: 100%;
    text-align: left;
}

.auth-panel-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--accent-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}

.auth-panel-icon i {
    font-size: 24px;
    color: var(--accent);
}

.auth-panel-icon-success {
    background: rgba(34, 197, 94, 0.1);
}

.auth-panel-icon-success i {
    color: var(--success);
}

.auth-panel-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
    margin: 0;
    letter-spacing: -0.02em;
}

.auth-panel-desc {
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.5;
    margin: 0;
}

.auth-panel-desc strong {
    color: var(--text);
    font-weight: 600;
}

.auth-panel-subdesc {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
    margin: 0;
}

.auth-submit-secondary {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    width: 100%;
}

.auth-submit-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    box-shadow: none;
    transform: none;
}

/* Discord OAuth button (login page alternative) */
.auth-submit-discord {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    background: #5865f2;
    border: 1px solid rgba(255, 255, 255, 0.08);
    text-decoration: none;
    margin-top: 4px;
}

.auth-submit-discord:hover {
    background: #4752c4;
    text-decoration: none;
}

.auth-submit-discord .auth-submit-text i {
    margin-right: 4px;
}

/* "albo" divider between login form and Discord button */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 14px 0 10px;
    color: var(--text-muted);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.08), transparent);
}

.auth-panel .auth-submit {
    width: 100%;
}

.auth-back-to-login {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition);
    margin-top: 4px;
}

.auth-back-to-login:hover {
    color: var(--accent);
}

/* --- Mobile --- */
@media (max-width: 480px) {
    .auth-card {
        padding: 28px 24px 24px;
    }

    .auth-wrapper {
        padding: 24px 16px;
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== Ulica brand gradient ===== */
.ulica-brand-pre {
    background: linear-gradient(135deg, #6c5ce7 0%, #a78bfa 50%, #06b6d4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 200% 200%;
    font-weight: inherit;
    font-size: inherit;
    font-family: inherit;
    letter-spacing: inherit;
}
.ulica-brand-post {
    color: #ffffff;
    -webkit-text-fill-color: #ffffff;
    font-weight: inherit;
    font-size: inherit;
    font-family: inherit;
    letter-spacing: inherit;
}
