/* 
    Premium SaaS Authentication UI 
    Handcrafted for ChatOS
*/

:root {
    --pa-primary: #6C3BFF;
    --pa-primary-light: #8F5BFF;
    --pa-bg-overlay: rgba(8, 8, 20, 0.55);
    --pa-modal-bg: rgba(255, 255, 255, 0.92);
    --pa-input-bg: #F8F8FF;
    --pa-input-border: transparent;
    --pa-text-dark: #0f172a;
    --pa-text-muted: #64748b;
    --pa-bezier: cubic-bezier(.22,.61,.36,1);
    --pa-danger: #ef4444;
    --pa-success: #22c55e;
}

/* Overlay & Entrance */
.pa-overlay {
    position: fixed;
    inset: 0;
    background: var(--pa-bg-overlay);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 450ms var(--pa-bezier), visibility 450ms;
    overflow-y: auto;
    padding: 20px;
}

.pa-overlay.pa-active {
    opacity: 1;
    visibility: visible;
}

body.pa-no-scroll {
    overflow: hidden;
}

/* Modal Container */
.pa-modal {
    width: 100%;
    max-width: 760px; /* 720px visual + padding margins */
    background: var(--pa-modal-bg);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 40px 120px rgba(90, 45, 255, 0.20);
    display: flex;
    flex-direction: row;
    overflow: hidden;
    position: relative;
    transform: scale(0.95) translateY(20px);
    opacity: 0;
    transition: all 450ms var(--pa-bezier);
    margin: auto;
}

.pa-overlay.pa-active .pa-modal {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Close Button */
.pa-close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0,0,0,0.05);
    border: none;
    color: var(--pa-text-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 300ms var(--pa-bezier);
}

.pa-close-btn:hover {
    background: rgba(0,0,0,0.1);
    transform: rotate(90deg) scale(1.1);
}

/* Left Panel - 45% */
.pa-left {
    width: 45%;
    background: linear-gradient(135deg, #4F1DCC 0%, #6C3BFF 100%);
    border-radius: 24px;
    margin: 12px;
    padding: 40px;
    color: white;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Decorative glowing elements */
.pa-left::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 60%);
    animation: paFloat 15s infinite linear;
}

.pa-logo-area {
    position: relative;
    z-index: 2;
}

.pa-logo-area img {
    height: 32px;
    margin-bottom: 8px;
    filter: brightness(0) invert(1);
}

.pa-logo-area p {
    font-size: 13px;
    opacity: 0.8;
    margin: 0;
    font-weight: 500;
}

.pa-robot-container {
    position: relative;
    z-index: 2;
    margin: 30px 0;
    text-align: center;
    animation: paRobotHover 4s ease-in-out infinite alternate;
}

.pa-robot-container img {
    max-width: 140px;
    filter: drop-shadow(0 20px 30px rgba(0,0,0,0.3));
}

.pa-features {
    position: relative;
    z-index: 2;
    list-style: none;
    padding: 0;
    margin: 0 0 30px 0;
    font-size: 14px;
    font-weight: 500;
}

.pa-features li {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    opacity: 0;
    transform: translateX(-10px);
}

.pa-overlay.pa-active .pa-features li {
    animation: paSlideInRight 400ms forwards var(--pa-bezier);
}
.pa-features li:nth-child(1) { animation-delay: 100ms !important; }
.pa-features li:nth-child(2) { animation-delay: 150ms !important; }
.pa-features li:nth-child(3) { animation-delay: 200ms !important; }
.pa-features li:nth-child(4) { animation-delay: 250ms !important; }

.pa-features li i {
    color: #a78bfa;
    font-size: 18px;
}

.pa-stats {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    border-top: 1px solid rgba(255,255,255,0.2);
    padding-top: 20px;
}

.pa-stat {
    text-align: center;
}

.pa-stat h4 {
    font-size: 20px;
    font-weight: 800;
    margin: 0;
}

.pa-stat p {
    font-size: 11px;
    opacity: 0.8;
    margin: 4px 0 0 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Right Panel - 55% */
.pa-right {
    width: 55%;
    padding: 40px 48px;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Segmented Control */
.pa-segmented-control {
    background: #f1f5f9;
    border-radius: 99px;
    display: flex;
    position: relative;
    padding: 4px;
    margin-bottom: 30px;
}

.pa-segment-indicator {
    position: absolute;
    top: 4px; left: 4px;
    height: calc(100% - 8px);
    width: calc(50% - 4px);
    background: linear-gradient(135deg, var(--pa-primary), var(--pa-primary-light));
    border-radius: 99px;
    transition: transform 350ms var(--pa-bezier);
    box-shadow: 0 4px 12px rgba(108, 59, 255, 0.3);
}

.pa-segment-btn {
    flex: 1;
    text-align: center;
    padding: 12px 0;
    font-weight: 600;
    font-size: 14px;
    color: var(--pa-text-muted);
    cursor: pointer;
    position: relative;
    z-index: 1;
    transition: color 300ms;
    border: none;
    background: none;
}

.pa-segment-btn.pa-active {
    color: white;
}

.pa-form-view {
    display: none;
    animation: paFadeIn 400ms var(--pa-bezier);
}

.pa-form-view.pa-active {
    display: block;
}

.pa-header h2 {
    font-size: 26px;
    font-weight: 700;
    color: var(--pa-text-dark);
    margin: 0 0 6px 0;
    letter-spacing: -0.5px;
}

.pa-header p {
    color: var(--pa-text-muted);
    font-size: 15px;
    margin: 0 0 24px 0;
}

/* Input Fields */
.pa-input-group {
    position: relative;
    margin-bottom: 20px;
}

.pa-input-group i.pa-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 20px;
    transition: color 0.3s;
    z-index: 2;
}

.pa-input {
    width: 100%;
    height: 56px;
    background: var(--pa-input-bg);
    border: 1px solid var(--pa-input-border);
    border-radius: 16px;
    padding: 0 16px 0 48px;
    font-size: 15px;
    font-family: inherit;
    font-weight: 500;
    color: var(--pa-text-dark);
    transition: all 0.3s var(--pa-bezier);
    outline: none;
}

.pa-input-group.has-right-icon .pa-input {
    padding-right: 48px;
}

.pa-input-group i.pa-right-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 20px;
    cursor: pointer;
    transition: color 0.3s;
    z-index: 2;
}

.pa-input-group i.pa-right-icon:hover {
    color: var(--pa-text-dark);
}

.pa-input:focus {
    background: #ffffff;
    border-color: var(--pa-primary);
    box-shadow: 0 0 0 4px rgba(108, 59, 255, 0.15);
}

.pa-input:focus ~ i.pa-icon {
    color: var(--pa-primary);
}

/* Floating Label Logic */
.pa-label {
    position: absolute;
    left: 48px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 15px;
    pointer-events: none;
    transition: all 0.2s ease;
    z-index: 2;
}

.pa-input:focus ~ .pa-label,
.pa-input:not(:placeholder-shown) ~ .pa-label {
    top: 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--pa-primary);
}

.pa-input:focus,
.pa-input:not(:placeholder-shown) {
    padding-top: 16px;
}

/* Password Strength & Match */
.pa-password-strength {
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
    display: none;
}
.pa-strength-bar {
    height: 100%;
    width: 0;
    transition: all 0.3s ease;
}
.pa-strength-text {
    font-size: 11px;
    color: var(--pa-text-muted);
    margin-top: 4px;
    display: none;
    text-align: right;
    font-weight: 500;
}

/* Errors & Validation */
.pa-input.error {
    border-color: var(--pa-danger) !important;
    animation: paShake 0.4s;
}
.pa-input.success {
    border-color: var(--pa-success) !important;
}
.pa-error-msg {
    color: var(--pa-danger);
    font-size: 12px;
    margin-top: 4px;
    display: none;
}

/* Checkbox */
.pa-checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
}
.pa-checkbox {
    width: 18px;
    height: 18px;
    border-radius: 6px;
    border: 2px solid #cbd5e1;
    appearance: none;
    outline: none;
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
    background: white;
}
.pa-checkbox:checked {
    background: var(--pa-primary);
    border-color: var(--pa-primary);
}
.pa-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px; top: 1px;
    width: 4px; height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.pa-checkbox-group label {
    font-size: 13px;
    color: var(--pa-text-muted);
    cursor: pointer;
}
.pa-checkbox-group label a {
    color: var(--pa-primary);
    text-decoration: none;
    font-weight: 600;
}

.pa-forgot-link {
    float: right;
    font-size: 13px;
    color: var(--pa-primary);
    font-weight: 600;
    text-decoration: none;
    margin-top: -10px;
    margin-bottom: 20px;
}

/* Primary Button */
.pa-btn-primary {
    width: 100%;
    height: 58px;
    background: linear-gradient(135deg, var(--pa-primary), var(--pa-primary-light));
    border: none;
    border-radius: 18px;
    color: white;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(108, 59, 255, 0.35);
    transition: all 0.3s var(--pa-bezier);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.pa-btn-primary:hover {
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 15px 30px rgba(108, 59, 255, 0.45);
}

.pa-btn-primary:active {
    transform: translateY(1px);
}

/* Ripple */
.pa-ripple {
    position: absolute;
    border-radius: 50%;
    transform: scale(0);
    animation: paRippleAnim 600ms linear;
    background: rgba(255, 255, 255, 0.3);
}

/* Spinner */
.pa-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: paSpin 1s infinite linear;
    display: none;
}
.pa-btn-primary.loading .pa-spinner { display: block; }
.pa-btn-primary.loading .pa-btn-text { display: none; }

/* Social Auth */
.pa-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 24px 0;
    color: #94a3b8;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}
.pa-divider::before, .pa-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #e2e8f0;
}
.pa-divider::before { margin-right: 15px; }
.pa-divider::after { margin-left: 15px; }

.pa-social-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.pa-social-btn {
    height: 50px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--pa-text-dark);
    cursor: pointer;
    transition: all 0.2s;
}
.pa-social-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.pa-social-btn img {
    width: 20px; height: 20px;
}

/* Animations */
@keyframes paFloat {
    0% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(-20px, 10px) rotate(5deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}
@keyframes paRobotHover {
    0% { transform: translateY(0); }
    100% { transform: translateY(-15px); }
}
@keyframes paFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes paSlideInRight {
    from { opacity: 0; transform: translateX(-15px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes paRippleAnim {
    to { transform: scale(4); opacity: 0; }
}
@keyframes paSpin {
    to { transform: rotate(360deg); }
}
@keyframes paShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ============================================================
   RESPONSIVE PREMIUM AUTH
   ============================================================ */

/* ---- Tablet (≤992px) ---- */
@media (max-width: 992px) {
    .pa-modal {
        flex-direction: column;
        max-width: 600px;
        max-height: 90vh;
        overflow-y: auto;
    }
    .pa-left {
        width: auto;
        margin: 12px;
        padding: 24px;
        border-radius: 16px;
        flex: none;
    }
    .pa-robot-container { display: none; }
    .pa-features { display: none; }
    
    .pa-right {
        width: 100%;
        padding: 20px 24px 30px;
    }
    .pa-title { font-size: 24px; }
}

/* ---- Large Mobile (≤576px) ---- */
@media (max-width: 576px) {
    .pa-modal {
        max-width: 95%;
        border-radius: 20px;
    }
    .pa-left {
        margin: 8px;
        padding: 20px;
    }
    .pa-brand h2 { font-size: 20px; }
    .pa-left p { font-size: 14px; margin-top: 8px; }
    
    .pa-right { padding: 16px 20px 24px; }
    .pa-title { font-size: 20px; margin-bottom: 6px; }
    .pa-subtitle { font-size: 14px; }
    
    .pa-input-group input {
        min-height: 48px;
        padding-left: 42px;
    }
    .pa-social-group {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .pa-social-btn { height: 48px; }
}

/* ---- Small Mobile (≤414px) ---- */
@media (max-width: 414px) {
    .pa-modal { max-width: 95vw; }
    .pa-right { padding: 16px 16px 20px; }
    .pa-title { font-size: 18px; }
    .pa-btn-primary { height: 48px; font-size: 15px; }
}

/* ---- Very Small Mobile (≤360px) ---- */
@media (max-width: 360px) {
    .pa-left { display: none; /* Give all space to form */ }
    .pa-modal { border-radius: 16px; }
}
