@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');

:root {
    --primary: #0071e3;
    --primary-hover: #0077ed;
    --bg-color: #f5f5f7;
    --card-bg: rgba(255, 255, 255, 0.8);
    --text-main: #1d1d1f;
    --text-sub: #86868b;
    --error: #ff3b30;
    --success: #34c759;
    --input-bg: rgba(0, 0, 0, 0.05);
    --glass-border: rgba(255, 255, 255, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow-x: hidden;
}

.auth-container {
    width: 100%;
    max-width: 360px;
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 28px;
    padding: 32px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
    text-align: center;
    position: relative;
    overflow: hidden;
    /* Added to contain absolute children */
}

/* ⭐ Fixed: Sliding Viewport */
.sliding-viewport {
    width: 100%;
    overflow: hidden;
    position: relative;
    min-height: 400px;
    /* Ensure enough space for content */
}

.auth-title {
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -0.5px;
    margin-bottom: 4px;
}

.auth-fullname {
    font-size: 15px;
    color: var(--text-sub);
    margin-bottom: 24px;
}

.input-field {
    width: 100%;
    height: 46px;
    background: var(--input-bg);
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 0 16px;
    font-size: 15px;
    margin-bottom: 10px;
    outline: none;
    transition: all 0.2s ease;
}

.input-field:focus {
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.1);
}

.auth-button {
    width: 100%;
    height: 46px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.auth-button:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.auth-button:active {
    transform: translateY(0);
}

.auth-button.loading .btn-text {
    opacity: 0;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    position: absolute;
    display: none;
}

.auth-button.loading .spinner {
    display: block;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.separator {
    display: flex;
    align-items: center;
    margin: 16px 0;
    color: var(--text-sub);
    font-size: 13px;
}

.separator::before,
.separator::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(0, 0, 0, 0.1);
}

.separator::before {
    margin-right: 16px;
}

.separator::after {
    margin-left: 16px;
}

.secondary-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-secondary {
    width: 100%;
    height: 46px;
    background: #fff;
    border: 1px solid #d2d2d7;
    border-radius: 12px;
    font-size: 15px;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: #fbfbfd;
}

.btn-face {
    background: linear-gradient(135deg, #7c3aed, #06b6d4);
    color: #fff;
    border: none;
    padding: 0 24px;
    justify-content: flex-start;
    gap: 20px;
}

.btn-face span {
    font-size: 22px;
}

.btn-face:hover {
    filter: brightness(1.1);
}

.switch-link {
    margin-top: 24px;
    font-size: 14px;
    color: var(--text-sub);
}

.switch-link a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.error-message {
    color: var(--error);
    font-size: 14px;
    margin-top: -8px;
    margin-bottom: 12px;
    min-height: 20px;
    text-align: left;
}

.profile-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 16px;
    animation: fadeIn 0.4s ease;
}

#profile-pic {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 12px;
    border: 2px solid #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

#user-email-display {
    font-size: 15px;
    color: var(--text-sub);
    background: var(--input-bg);
    padding: 6px 16px;
    border-radius: 100px;
}

.auth-screens-wrapper {
    display: flex;
    flex-direction: row !important;
    width: 200%;
    transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.screen {
    width: 50%;
    padding: 24px 0;
    /* Horizontal padding handled by viewport */
    position: relative;
    box-sizing: border-box;
    flex-shrink: 0;
    /* CRITICAL: Prevent shrinking that causes overlap */
    display: flex;
    flex-direction: column;
}

.back-btn {
    position: absolute;
    top: 16px;
    left: 8px;
    background: rgba(0, 0, 0, 0.03);
    border: none;
    color: var(--text-sub);
    cursor: pointer;
    font-size: 18px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    z-index: 10;
    transition: all 0.2s ease;
}

.back-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    color: var(--text-main);
    transform: translateX(-2px);
}

.slide-to-password {
    transform: translateX(-50%);
}

.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: #fff;
    width: 100%;
    max-width: 400px;
    border-radius: 28px;
    padding: 32px;
    text-align: center;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.15);
    animation: slideInUp 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

.modal-icon {
    width: 80px;
    height: 80px;
    background: var(--input-bg);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
}

.modal-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 12px;
}

.modal-description {
    font-size: 15px;
    color: var(--text-sub);
    line-height: 1.5;
    margin-bottom: 32px;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- HELP BUTTON & FLOATING CHAT --- */
.help-popup-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
}

.help-button {
    background: var(--primary);
    color: #fff;
    padding: 12px 24px;
    border-radius: 100px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    box-shadow: 0 8px 16px rgba(0, 113, 227, 0.2);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.help-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 20px rgba(0, 113, 227, 0.3);
}

.floating-chat-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 360px;
    height: 540px;
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    transform-origin: bottom right;
}

.floating-chat-window.hidden {
    opacity: 0;
    transform: scale(0.8) translateY(20px);
    pointer-events: none;
}

.chat-header {
    background: #f5f5f7;
    padding: 24px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    text-align: left;
    position: relative;
}

.chat-header .heading {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.chat-header .subheading {
    font-size: 13px;
    color: var(--text-sub);
}

.support-label {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(52, 199, 89, 0.1);
    color: var(--success);
    padding: 4px 8px;
    border-radius: 4px;
    margin-top: 8px;
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: var(--text-sub);
    cursor: pointer;
    font-size: 20px;
}

.chats-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #fff;
}

.message-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    position: relative;
}

.user-message {
    align-self: flex-end;
    background: var(--primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.bot-message {
    align-self: flex-start;
    background: #f2f2f7;
    color: var(--text-main);
    border-bottom-left-radius: 4px;
}

.prompt-container {
    padding: 16px 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    background: #fff;
}

.prompt-form {
    display: flex;
    align-items: center;
    gap: 10px;
}

.prompt-input {
    flex: 1;
    height: 40px;
    background: var(--input-bg);
    border: none;
    border-radius: 20px;
    padding: 0 16px;
    font-size: 14px;
    outline: none;
}

.promt-actions button {
    background: var(--primary);
    color: #fff;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
}

.disclaimer {
    font-size: 11px;
    color: var(--text-sub);
    text-align: center;
    padding: 10px;
    background: #f5f5f7;
}

@media (max-width: 480px) {
    .auth-container {
        max-width: 100%;
        margin: 10px;
        padding: 32px 24px;
        border-radius: 20px;
    }

    .modal-content {
        max-width: 90%;
        border-radius: 24px;
    }
}