/**
 * ==========================================
 *        POWERED BY ARYA VL ENGINE
 * ==========================================
 */

/* ==========================================
   AUTH PAGES CSS (Login / Signup)
   ========================================== */

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark, #04060f);
}

::-webkit-scrollbar-thumb {
    background: var(--accent-primary, #00f5d4);
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(0, 245, 212, 0.4);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary, #00ffcc);
    box-shadow: 0 0 15px rgba(0, 245, 212, 0.6);
}

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-dark);
    position: relative;
    overflow: hidden;
    /* Prevent scroll on desktop if possible */
}

.auth-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
    position: relative;
    z-index: 10;
}

@media (max-width: 480px) {
    .auth-page {
        align-items: flex-start;
        /* Better for mobile keyboard push-up */
        padding-top: 10vh;
        overflow-y: auto;
    }

    .auth-container {
        padding: 0 20px;
    }
}

/* Glassmorphism Card */
.auth-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);

    /* Glowing animated border */
    position: relative;

    /* In-animation */
    opacity: 0;
    transform: scale(0.95);
    animation: cardEntrance 400ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.auth-card::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: calc(var(--radius-lg) + 1px);
    padding: 1px;
    background: linear-gradient(45deg,
            rgba(0, 255, 204, 0.2),
            rgba(168, 85, 247, 0.2),
            rgba(0, 255, 204, 0.2));
    -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;
    background-size: 200% 200%;
    animation: borderCycle 8s linear infinite;
}

@keyframes borderCycle {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

@keyframes cardEntrance {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Header & Typography */
.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-title {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--text-main);
    min-height: 1.2em;
    /* Prevent layout shift during typewriter */
}

.auth-subtitle:not(.hidden) {
    opacity: 1;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
    transition: all 0.2s ease;
    width: fit-content;
}

.back-link:hover {
    color: var(--accent-primary);
    transform: translateX(-5px);
}

.back-link .prompt-char {
    margin-right: 2px;
}

/* Forms & Inputs */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Slide in animation for elements */
.slide-in-element {
    opacity: 0;
    transform: translateX(-15px);
    transition: opacity 400ms ease-out, transform 400ms ease-out;
}

.slide-in-element.entered {
    opacity: 1;
    transform: translateX(0);
}

.delay-1 {
    transition-delay: 100ms;
}

.delay-2 {
    transition-delay: 200ms;
}

.delay-3 {
    transition-delay: 300ms;
}

.delay-4 {
    transition-delay: 400ms;
}

.delay-5 {
    transition-delay: 500ms;
}

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

    .slide-in-element,
    .auth-card {
        transition: none !important;
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    padding: 0 1rem;
    transition: all 0.2s ease;
    height: 48px;
    /* Touch target size */
}

/* Inner glow on focus focus-within */
.input-wrapper:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 15px rgba(0, 255, 204, 0.15), inset 0 0 10px rgba(0, 255, 204, 0.05);
}

.prompt-char {
    font-family: var(--font-mono);
    color: var(--accent-primary);
    margin-right: 0.5rem;
    font-weight: bold;
    user-select: none;
}

.input-wrapper input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    padding: 1.2rem 0 0.4rem 0;
    /* Make room for floating label */
    outline: none;
    width: 100%;
}

.input-wrapper input::placeholder {
    color: transparent;
    transition: color 0.2s;
}

.input-wrapper input:focus::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

/* Floating Label */
.input-wrapper label {
    position: absolute;
    left: 2.5rem;
    /* Past the prompt char */
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-muted);
    pointer-events: none;
    transition: all 0.2s ease;
}

.input-wrapper input:focus~label,
.input-wrapper input:not(:placeholder-shown)~label {
    top: 6px;
    transform: translateY(0);
    font-size: 0.65rem;
    color: var(--accent-primary);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* Validation Icon & Spinner */
.validation-icon {
    margin-left: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
}

.validation-icon svg {
    width: 16px;
    height: 16px;
}

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

.icon-error {
    color: var(--accent-red);
}

.spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Toggle Password */
.toggle-password {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    margin-right: -0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    height: 44px;
    /* Touch target */
    width: 44px;
}

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

/* Validation Feedback Message */
.feedback-msg {
    font-size: 0.75rem;
    font-family: var(--font-mono);
    margin-top: 0.4rem;
    min-height: 1em;
    /* reserve space */
    display: flex;
    align-items: center;
    opacity: 0;
    transform: translateY(-5px);
    transition: all 0.2s ease;
}

.feedback-msg.visible {
    opacity: 1;
    transform: translateY(0);
}

.feedback-success {
    color: var(--accent-primary);
}

.feedback-error {
    color: var(--accent-red);
}

.feedback-warning {
    color: var(--accent-yellow);
}

/* Password Strength Meter */
.password-strength-container {
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    opacity: 1;
    transition: opacity 0.3s;
}

.password-strength-container.hidden {
    opacity: 0;
    height: 0;
    margin-top: 0;
    overflow: hidden;
    pointer-events: none;
}

.strength-bar {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.strength-fill {
    height: 100%;
    width: 0%;
    transition: width 0.3s ease, background-color 0.3s ease;
}

.strength-fill.weak {
    width: 25%;
    background-color: var(--accent-red);
}

.strength-fill.fair {
    width: 50%;
    background-color: var(--accent-yellow);
}

.strength-fill.good {
    width: 75%;
    background-color: var(--accent-blue);
}

.strength-fill.strong {
    width: 100%;
    background-color: var(--accent-primary);
}

.strength-fill.strong-pulse {
    animation: strengthPulse 0.5s ease-out;
}

@keyframes strengthPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 255, 204, 0.7);
    }

    70% {
        box-shadow: 0 0 0 5px rgba(0, 255, 204, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(0, 255, 204, 0);
    }
}

/* Top Level Error Banner */
.server-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: var(--accent-red);
    padding: 0.8rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.1);

    transform-origin: top;
    animation: errorSlideDown 0.3s ease-out forwards;
}

.server-error.hidden {
    display: none;
}

@keyframes errorSlideDown {
    from {
        opacity: 0;
        transform: scaleY(0.8) translateY(-10px);
    }

    to {
        opacity: 1;
        transform: scaleY(1) translateY(0);
    }
}

/* Submit Button Specifics */
.auth-submit {
    width: 100%;
    margin-top: 0.5rem;
    transition: all 0.3s;
}

.auth-submit.loading .btn-text {
    opacity: 0.7;
}

.auth-submit.success {
    background: rgba(0, 255, 204, 0.1);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    box-shadow: 0 0 20px rgba(0, 255, 204, 0.2);
}

.auth-submit.error {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--accent-red);
    color: var(--accent-red);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.2);
    animation: shake 0.4s cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes shake {

    10%,
    90% {
        transform: translate3d(-1px, 0, 0);
    }

    20%,
    80% {
        transform: translate3d(2px, 0, 0);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-4px, 0, 0);
    }

    40%,
    60% {
        transform: translate3d(4px, 0, 0);
    }
}

/* Redirect Link */
.auth-redirect {
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.auth-redirect a {
    color: var(--text-main);
    font-weight: 700;
    margin-left: 0.3rem;
    position: relative;
}

.auth-redirect a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 1px;
    background: currentColor;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.3s ease;
}

.auth-redirect a:hover {
    color: var(--accent-primary);
}

.auth-redirect a:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

/* Custom Checkbox (Login) */
.checkbox-wrapper {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: -0.5rem;
}

.checkbox-wrapper input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: relative;
    height: 18px;
    width: 18px;
    background-color: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    margin-right: 0.8rem;
    transition: all 0.2s;
}

.checkbox-wrapper:hover input~.checkmark {
    border-color: rgba(255, 255, 255, 0.5);
}

.checkbox-wrapper input:checked~.checkmark {
    background-color: rgba(0, 255, 204, 0.1);
    border-color: var(--accent-primary);
    box-shadow: 0 0 10px rgba(0, 255, 204, 0.2);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid var(--accent-primary);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-wrapper input:checked~.checkmark:after {
    display: block;
    animation: checkAnim 0.2s ease-out;
}

@keyframes checkAnim {
    0% {
        height: 0;
        width: 0;
        opacity: 0;
    }

    100% {
        height: 8px;
        width: 4px;
        opacity: 1;
    }
}

.forgot-password {
    text-align: right;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    margin-top: -0.5rem;
}

.forgot-password a {
    color: var(--text-muted);
    transition: color 0.2s;
}

.forgot-password a:hover {
    color: var(--text-main);
}

/* ==========================================
   GLOBAL AUTH HEADER STYLES (for index.html etc)
   ========================================== */

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 80px;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    background: linear-gradient(to bottom, rgba(10, 10, 15, 0.9) 0%, rgba(10, 10, 15, 0) 100%);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

.nav-logo {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: 1.5rem;
    letter-spacing: 2px;
    color: var(--text-main);
    text-decoration: none;
    text-shadow: 0 0 10px rgba(0, 255, 204, 0.2);
    transition: all 0.3s ease;
}

.nav-logo:hover {
    text-shadow: 0 0 15px rgba(0, 255, 204, 0.6);
}

.logo-glow {
    color: var(--accent-primary);
}

#auth-header-container {
    display: flex;
    align-items: center;
}

@media (max-width: 768px) {
    .site-header {
        padding: 0 1rem;
        height: 70px;
    }
}

.auth-buttons {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.header-btn {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
    cursor: pointer;
}

.header-btn-ghost {
    color: var(--text-muted);
    border: 1px solid transparent;
}

.header-btn-ghost:hover {
    color: var(--text-main);
    border-color: rgba(255, 255, 255, 0.2);
}

.header-btn-neon {
    color: var(--accent-primary);
    border: 1px solid var(--accent-primary);
    background: rgba(0, 255, 204, 0.05);
    box-shadow: inset 0 0 10px rgba(0, 255, 204, 0), 0 0 10px rgba(0, 255, 204, 0);
}

.header-btn-neon:hover {
    background: rgba(0, 255, 204, 0.15);
    box-shadow: inset 0 0 10px rgba(0, 255, 204, 0.2), 0 0 15px rgba(0, 255, 204, 0.3);
    text-shadow: 0 0 5px rgba(0, 255, 204, 0.5);
}

/* User Menu Dropdown */
.user-menu {
    position: relative;
    cursor: pointer;
}

.avatar-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--accent-primary);
    box-shadow: 0 0 15px rgba(0, 255, 204, 0.2);
    transition: all 0.3s ease;
}

.user-menu:hover .avatar-circle,
.user-menu.active .avatar-circle {
    background: var(--accent-primary);
    color: #000;
    box-shadow: 0 0 20px rgba(0, 255, 204, 0.5);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    min-width: 200px;
    padding: 0.5rem 0;
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: all 0.2s ease-out;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.user-menu.active .dropdown-menu {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.dropdown-username {
    display: block;
    padding: 0.8rem 1.2rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 0.5rem;
}

.dropdown-menu a,
.dropdown-menu button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.8rem 1.2rem;
    background: none;
    border: none;
    color: var(--text-main);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.dropdown-menu a:hover,
.dropdown-menu button:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--accent-primary);
}

.dropdown-menu .admin-link {
    color: var(--accent-red);
}

.dropdown-menu .admin-link:hover {
    color: #fff;
    background: rgba(239, 68, 68, 0.2);
}

#logout-btn {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: 0.5rem;
    color: var(--text-muted);
}

#logout-btn:hover {
    color: var(--accent-red);
    background: rgba(239, 68, 68, 0.1);
}