/* Cosmic background applied to layout when auth pages are shown */
.auth-bg {
    position: relative;
    background: #04020e;
    min-height: 100vh;
    overflow: hidden;
}

.auth-bg::before {
    content: "";
    position: absolute;
    inset: 0;
    background: url("/images/cosmo_bg.avif") center/cover no-repeat;
    z-index: 0;
}

.auth-bg::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background:
        radial-gradient(ellipse 70% 50% at 50% 40%, rgba(99, 102, 241, 0.12) 0%, transparent 70%),
        radial-gradient(ellipse 60% 40% at 20% 70%, rgba(34, 211, 238, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse 50% 40% at 80% 20%, rgba(167, 139, 250, 0.08) 0%, transparent 60%),
        linear-gradient(180deg, rgba(4, 2, 14, 0.48) 0%, rgba(4, 2, 14, 0.72) 55%, rgba(4, 2, 14, 0.88) 100%);
}

/* Centered auth container */
.auth-container {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
    position: relative;
    z-index: 2;
}

/* Glassmorphism card */
.auth-card {
    padding: 40px 34px;
    border-radius: 24px;
    width: min(92vw, 560px);
    background: rgba(12, 8, 34, 0.82);
    border: 1px solid rgba(99, 102, 241, 0.24);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.7), 0 0 18px rgba(34, 211, 238, 0.12), 0 0 32px rgba(167, 139, 250, 0.08);
    backdrop-filter: blur(8px);
}

/* Gradient title */
.auth-title,
.auth-card form {
    outline: none;
}

.auth-title {
    font-family: "Orbitron", "Montserrat", sans-serif;
    text-align: center;
    width: 100%;
    display: block;
    margin: 0 0 26px;
    font-size: clamp(26px, 4vw, 34px);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: linear-gradient(135deg, #ffffff 0%, #e0e7ff 35%, #22d3ee 65%, #a78bfa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 24px rgba(34, 211, 238, 0.15));
}

/* Form group */
.form-group {
    position: relative;
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    color: rgba(232, 234, 246, 0.66);
    font-family: "Rajdhani", "Roboto", sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid rgba(99, 102, 241, 0.3);
    background: rgba(4, 2, 14, 0.55);
    color: rgba(232, 234, 246, 0.96);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.form-input:focus {
    border-color: rgba(99, 102, 241, 0.6);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.form-input::placeholder {
    color: rgba(232, 234, 246, 0.4);
}

/* Password field with toggle */
.password-wrapper {
    position: relative;
}

.password-wrapper .form-input {
    padding-right: 48px;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(232, 234, 246, 0.5);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.password-toggle:hover {
    color: rgba(232, 234, 246, 0.8);
}

/* Autofill overrides */
.form-input:-webkit-autofill,
.form-input:-webkit-autofill:hover,
.form-input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px rgba(12, 8, 34, 0.95) inset !important;
    -webkit-text-fill-color: rgba(232, 234, 246, 0.96) !important;
    transition: background-color 5000s ease-in-out 0s;
}

.form-input:autofill {
    box-shadow: 0 0 0 1000px rgba(12, 8, 34, 0.95) inset !important;
    -webkit-text-fill-color: rgba(232, 234, 246, 0.96) !important;
}

/* Checkbox */
.form-check {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.form-check input[type="checkbox"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    min-width: 20px;
    border-radius: 6px;
    border: 1px solid rgba(99, 102, 241, 0.4);
    background: rgba(4, 2, 14, 0.55);
    cursor: pointer;
    position: relative;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.form-check input[type="checkbox"]:hover {
    border-color: rgba(99, 102, 241, 0.6);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

.form-check input[type="checkbox"]:checked {
    background: linear-gradient(135deg, #6366f1, #a78bfa);
    border-color: transparent;
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.3);
}

.form-check input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 11px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.form-check-label {
    color: rgba(232, 234, 246, 0.72);
    font-family: "Rajdhani", "Roboto", sans-serif;
    font-size: 0.9rem;
    letter-spacing: 0.01em;
    user-select: none;
}

/* Submit button */
.btn-submit {
    width: 100%;
    height: 54px;
    border: none;
    border-radius: 9999px;
    color: #f6fbff;
    font-family: "Orbitron", "Montserrat", sans-serif;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    background: linear-gradient(135deg, #0e7490 0%, #22d3ee 45%, #6366f1 75%, #a78bfa 100%);
    box-shadow: 0 6px 24px rgba(34, 211, 238, 0.35), 0 0 42px rgba(99, 102, 241, 0.2);
    cursor: pointer;
    transition: transform 0.15s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.btn-submit:hover {
    transform: translateY(-1px);
}

.btn-submit:active {
    transform: translateY(0);
}

/* Alert / error message */
.alert-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 16px;
    color: #fca5a5;
    font-size: 0.875rem;
}

/* Validation errors */
.validation-message {
    color: #fca5a5;
    font-size: 0.8rem;
    margin-top: 4px;
}

/* Responsive */
@media (max-width: 640px) {
    .auth-card {
        padding: 28px 20px;
        width: min(96vw, 560px);
    }

    .auth-title {
        margin-bottom: 20px;
    }
}
