/* Auth Styles - Futuristic 2030 Design with Glassmorphism */

:root {
    --auth-glass-bg: rgba(255, 255, 255, 0.08);
    --auth-glass-border: rgba(255, 255, 255, 0.18);
    --auth-input-bg: rgba(255, 255, 255, 0.05);
    --auth-input-focus: rgba(255, 255, 255, 0.12);
    --auth-text: rgba(255, 255, 255, 0.95);
    --auth-text-secondary: rgba(255, 255, 255, 0.65);
    --auth-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --auth-glow: 0 0 40px rgba(102, 126, 234, 0.4);
}

.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg,
        rgba(17, 24, 39, 0.95) 0%,
        rgba(30, 41, 59, 0.95) 50%,
        rgba(17, 24, 39, 0.95) 100%);
    backdrop-filter: blur(10px);
    display: none;
    align-items: flex-start;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: var(--spacing-xl) 0;
    overflow-y: auto;
    box-sizing: border-box;
    scroll-behavior: smooth;
}

/* Custom scrollbar for auth overlay */
.auth-overlay::-webkit-scrollbar {
    width: 6px;
}

.auth-overlay::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.auth-overlay::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.auth-overlay::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.auth-overlay.active {
    display: flex;
    opacity: 1;
}

/* Body scroll lock when auth overlay is open */
body.auth-open {
    overflow: hidden;
}

.auth-container {
    background: var(--auth-glass-bg);
    backdrop-filter: blur(30px) saturate(180%);
    border: 1px solid var(--auth-glass-border);
    border-radius: var(--radius-2xl);
    box-shadow: var(--auth-shadow), var(--auth-glow);
    width: 90%;
    max-width: 440px;
    padding: var(--spacing-2xl);
    position: relative;
    animation: authSlideIn 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes authSlideIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.auth-close {
    position: absolute;
    top: var(--spacing-lg);
    right: var(--spacing-lg);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
}

.auth-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.auth-close svg {
    width: 20px;
    height: 20px;
    fill: var(--auth-text);
}

.auth-header {
    text-align: center;
    margin-bottom: var(--spacing-2xl);
    position: relative;
    z-index: 1;
}

.auth-logo {
    width: 74px;
    height: 74px;
    margin: 0 auto var(--spacing-lg);
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
    position: relative;
}

.auth-logo::before {
    content: '';
    position: absolute;
    inset: -3px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: var(--radius-xl);
    opacity: 0.5;
    filter: blur(10px);
    z-index: -1;
    animation: logoPulse 2.5s ease-in-out infinite;
}

@keyframes logoPulse {
    0%, 100% { 
        opacity: 0.4;
        transform: scale(0.95);
    }
    50% { 
        opacity: 0.7;
        transform: scale(1.08);
    }
}

.auth-logo svg {
    width: 38px;
    height: 38px;
    fill: white;
}

.auth-title {
    font-size: clamp(24px, 4.5vw, 32px);
    font-weight: 800;
    color: var(--auth-text);
    margin: 0 0 var(--spacing-sm);
    letter-spacing: -0.8px;
    line-height: 1.1;
}

.auth-subtitle {
    font-size: clamp(13px, 2vw, 15px);
    color: var(--auth-text-secondary);
    margin: 0;
    line-height: 1.2;
}

.auth-tabs {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-xl);
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-lg);
    padding: 4px;
    position: relative;
    z-index: 1;
}

.auth-tab {
    flex: 1;
    padding: var(--spacing-md) var(--spacing-lg);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--auth-text-secondary);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.auth-tab:hover {
    color: var(--auth-text);
    background: rgba(255, 255, 255, 0.05);
}

.auth-tab.active {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.auth-form {
    display: none;
    animation: authFormFade 0.3s ease;
    position: relative;
    z-index: 1;
}

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

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

.auth-form-group {
    margin-bottom: var(--spacing-lg);
}

/* Password Input Container */
.auth-input-container {
    position: relative;
    display: flex;
    align-items: center;
}

.auth-input-container .auth-input {
    flex: 1;
    padding-right: 50px; /* Space for toggle button */
}

/* Password Toggle Button */
.password-toggle {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 5px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-toggle:hover {
    color: var(--accent-primary);
}

.password-toggle.active {
    color: var(--accent-primary);
    opacity: 0.8;
}

.password-toggle .icon {
    width: 18px;
    height: 18px;
}

.auth-label {
    display: block;
    color: var(--auth-text);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    letter-spacing: 0.3px;
}

.auth-input {
    width: 100%;
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--auth-input-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    color: var(--auth-text);
    font-size: 15px;
    transition: all 0.3s ease;
    outline: none;
}

.auth-input::placeholder {
    color: var(--auth-text-secondary);
}

.auth-input:focus {
    background: var(--auth-input-focus);
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.auth-hint {
    display: block;
    color: var(--auth-text-secondary);
    font-size: 12px;
    margin-top: var(--spacing-xs);
    line-height: 1.4;
}

#password-match-hint {
    display: none;
    color: #22c55e;
}

#password-mismatch-hint {
    display: none;
    color: #ef4444;
}

.auth-button {
    width: 100%;
    padding: var(--spacing-md) var(--spacing-lg);
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: var(--spacing-lg);
    position: relative;
    overflow: hidden;
}

.auth-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.auth-button:hover::before {
    left: 100%;
}

.auth-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.5);
}

.auth-button:active {
    transform: translateY(0);
}

.auth-divider {
    display: flex;
    align-items: center;
    margin: var(--spacing-xl) 0;
    color: var(--auth-text-secondary);
    font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.auth-divider::before { margin-right: var(--spacing-md); }
.auth-divider::after { margin-left: var(--spacing-md); }

.auth-footer {
    text-align: center;
    margin-top: var(--spacing-xl);
    color: var(--auth-text-secondary);
    font-size: 14px;
    position: relative;
    z-index: 1;
}

.auth-link {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.auth-link:hover {
    color: var(--accent-secondary);
    text-decoration: underline;
}

.auth-error {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    color: #fca5a5;
    font-size: 14px;
    display: none;
}

.auth-error.show {
    display: block;
    animation: authErrorShake 0.5s ease;
}

@keyframes authErrorShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.auth-success {
    background: rgba(34, 197, 94, 0.2);
    border: 1px solid rgba(34, 197, 94, 0.4);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    color: #86efac;
    font-size: 14px;
    display: none;
}

.auth-success.show {
    display: block;
}

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

.password-strength-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: var(--spacing-xs);
}

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

.password-strength-text {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
    color: var(--auth-text-secondary);
}

.password-requirements {
    list-style: none;
    padding: 0;
    margin: var(--spacing-xs) 0 0 0;
}

.password-requirements li {
    font-size: 11px;
    color: var(--auth-text-secondary);
    margin-bottom: 4px;
    padding-left: 18px;
    position: relative;
    transition: color 0.3s ease;
}

.password-requirements li::before {
    content: '✗';
    position: absolute;
    left: 0;
    color: #ef4444;
    transition: all 0.3s ease;
}

.password-requirements li.valid {
    color: #86efac;
}

.password-requirements li.valid::before {
    content: '✓';
    color: #10b981;
}

/* Code Verification Styles */
.auth-code-section {
    text-align: center;
}

.auth-code-instruction {
    color: var(--auth-text);
    font-size: clamp(14px, 2.5vw, 16px);
    margin-bottom: var(--spacing-xl);
    line-height: 1.6;
}

.auth-code-instruction strong {
    color: rgba(255, 255, 255, 0.95);
    font-weight: 600;
}

.auth-code-inputs {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-bottom: var(--spacing-xl);
    flex-wrap: wrap;
    max-width: 100%;
}

.code-input {
    width: 44px;
    height: 52px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.95);
    transition: all 0.3s ease;
    font-family: 'Courier New', monospace;
    letter-spacing: 0;
    opacity: 0;
    transform: translateY(20px);
    animation: codeInputSlideUp 0.4s ease-out forwards;
}

.code-input:nth-child(1) { animation-delay: 0.05s; }
.code-input:nth-child(2) { animation-delay: 0.1s; }
.code-input:nth-child(3) { animation-delay: 0.15s; }
.code-input:nth-child(4) { animation-delay: 0.2s; }
.code-input:nth-child(5) { animation-delay: 0.25s; }
.code-input:nth-child(6) { animation-delay: 0.3s; }

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

.code-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 
        0 0 0 3px rgba(102, 126, 234, 0.2),
        0 4px 16px rgba(102, 126, 234, 0.3);
    transform: translateY(-2px);
}

.code-input.error-shake {
    animation: codeErrorShake 0.5s ease;
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

@keyframes codeErrorShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

.auth-link {
    display: block;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: clamp(14px, 2.5vw, 15px);
    cursor: pointer;
    padding: var(--spacing-sm) 0;
    margin: var(--spacing-sm) auto 0;
    text-decoration: none;
    transition: color 0.3s ease;
    width: auto;
}

.auth-link:hover {
    color: rgba(255, 255, 255, 0.95);
    text-decoration: underline;
}

.auth-link.loading {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Responsive Design */
@media (max-width: 480px) {
    .auth-code-inputs {
        gap: 3px;
/*      max-width: 280px;*/
        margin-left: auto;
        margin-right: auto;
    }
    
    .code-input {
        width: 40px;
        height: 48px;
        font-size: 20px;
    }
}

/* Two rows of 3 boxes each on very small screens */
@media (max-width: 360px) {
    .auth-code-inputs {
/*      max-width: 140px;*/
    }
}

@media (max-width: 768px) {
    .auth-overlay {
        padding: var(--spacing-lg) 0;
    }

    .auth-container {
        width: 95%;
        padding: 10px;
    }

    /* Ensure password toggle stays inside input field on mobile */
    .auth-input-container {
        position: relative;
    }

    .auth-input-container .auth-input {
        padding-right: 50px;
    }

    .password-toggle {
        position: absolute;
        right: 15px;
        top: 50%;
        transform: translateY(-50%);
        z-index: 10;
    }
    
    .auth-logo {
        width: clamp(56px, 12vw, 74px);
        height: clamp(56px, 12vw, 74px);
    }
    
    .auth-logo svg {
        width: clamp(28px, 6vw, 38px);
        height: clamp(28px, 6vw, 38px);
    }
    
    .code-input {
        width: 48px;
        height: 56px;
        font-size: 24px;
    }
    
    .auth-code-inputs {
        gap: var(--spacing-sm);
    }
}


/* Loading State */
.auth-button.loading {
    pointer-events: none;
    opacity: 0.7;
}

.auth-button.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: authButtonSpin 0.6s linear infinite;
}

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

/* Typography styles */
h1 {
    font-size: 2rem;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.25rem;
}

p {
    margin: var(--spacing-md) 0;
    line-height: 1.6;
}

ul,
ol {
    margin: var(--spacing-md) 0;
    margin-left: 3rem;
    padding-left: 0;
}

ul {
    list-style: circle;
}

ul li {
    margin: var(--spacing-xs) 0;
    line-height: 1.6;
}

ol {
    counter-reset: list-counter;
    list-style: none;
}

ol li {
    position: relative;
    margin: var(--spacing-xs) 0;
    line-height: 1.6;
    padding-left: 2rem;
    counter-increment: list-counter;
}

ol li::before {
    content: counter(list-counter) '.';
    position: absolute;
    left: 0;
    top: 0;
    color: var(--accent-primary);
    font-weight: 600;
}

pre,
code {
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-sm);
    padding: var(--spacing-xs) var(--spacing-sm);
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

pre {
    padding: var(--spacing-md);
    margin: var(--spacing-md) 0;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

pre code {
    background: transparent;
    padding: 0;
}
