/* Signup page tokens. Shared brand/ink/shadow/radius come from base.css
   (loaded first). Only page-specific aliases live here. */
:root {
    --primary-dark: #073454;
    --primary-light: #0d5a94;
    --accent-green: #2ecc71;
    --accent-green-dark: #27ae60;
    --text-primary: var(--ink-800, #1f2937);
    --text-secondary: var(--ink-500, #6b7280);
    --text-muted: var(--ink-400, #9ca3af);
    --bg-primary: var(--surface, #ffffff);
    --bg-secondary: var(--surface-soft, #f9fafb);
    --bg-light: var(--surface-muted, #f8f9fa);
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --transition: 0.2s ease;
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    display: flex;
    min-height: 100vh;
    overflow: hidden;
}

.signup-container {
    display: flex;
    width: 100%;
    height: 100vh;
}

/* Left Column - Welcome Section */
.welcome-section {
    flex: 1;
    background: linear-gradient(150deg, var(--hero-gradient-start) 0%, var(--hero-gradient-end) 100%);
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 3rem;
    color: white;
    overflow: hidden;
}

/* Soft radial glow for depth, echoing the site's hero treatment */
.welcome-section::before {
    content: '';
    position: absolute;
    top: -15%;
    right: -10%;
    width: 60%;
    height: 60%;
    background: radial-gradient(circle, rgba(46, 204, 113, 0.16) 0%, rgba(46, 204, 113, 0) 70%);
    pointer-events: none;
    z-index: 0;
}

.welcome-section::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(2, 21, 33, 0.55) 0%, rgba(2, 21, 33, 0) 45%);
    pointer-events: none;
    z-index: 0;
}

.welcome-background {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url("/static/authentication/images/study_group.76fce149ae8b.jpg?v=2");
    background-image: -webkit-image-set(
        url("/static/authentication/images/study_group.732c14edb017.webp?v=2") type('image/webp'),
        url("/static/authentication/images/study_group.76fce149ae8b.jpg?v=2") type('image/jpeg')
    );
    background-image: image-set(
        url("/static/authentication/images/study_group.732c14edb017.webp?v=2") type('image/webp'),
        url("/static/authentication/images/study_group.76fce149ae8b.jpg?v=2") type('image/jpeg')
    );
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    opacity: 0.14;
    filter: blur(6px) saturate(0.9);
    /* Optimize rendering */
    will-change: transform;
    transform: translateZ(0);
    /* Lazy load on mobile */
    content-visibility: auto;
}

.welcome-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 500px;
}

.welcome-logo {
    width: 120px;
    height: 100px;
    margin-bottom: 2.25rem;
    filter: brightness(0) invert(1);
    /* Optimize image rendering */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    object-fit: contain;
}

.welcome-title {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 1.1rem;
    line-height: 1.15;
}

.welcome-subtitle {
    font-size: 1.15rem;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.65;
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
}

/* Right Column - Signup Form */
.form-section {
    flex: 1;
    background: var(--surface);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 3rem;
    overflow-y: auto;
    box-shadow: inset 1px 0 0 var(--border-soft);
}

.form-container {
    width: 100%;
    max-width: 450px;
}

/* Back to Home link */
.back-home-wrap {
    text-align: center;
    margin-bottom: 1.25rem;
}

.back-home-link {
    color: var(--ink-500);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.3rem 0.1rem;
    border-bottom: 1px solid transparent;
    transition: color 0.25s var(--ease-out-quart), border-color 0.25s var(--ease-out-quart), transform 0.25s var(--ease-out-quart);
}

.back-home-link i {
    transition: transform 0.25s var(--ease-tactile);
}

.back-home-link:hover {
    color: var(--primary-color);
    border-color: currentColor;
}

.back-home-link:hover i {
    transform: translateX(-3px);
}

.form-logo {
    width: 100px;
    height: 80px;
    margin-bottom: 1.5rem;
    display: block;
    margin-left: auto;
    margin-right: auto;
    /* Optimize image rendering */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    object-fit: contain;
}

.form-heading {
    text-align: center;
    margin-bottom: 2rem;
}

.form-title {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--ink-900);
    margin-bottom: 0.5rem;
    text-align: center;
}

.form-subtitle {
    font-size: 0.95rem;
    color: var(--ink-500);
    line-height: 1.5;
}

.form-group {
    margin-bottom: 1.375rem;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ink-700);
    margin-bottom: 0.45rem;
    letter-spacing: 0.005em;
}

.form-input {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1.5px solid var(--border-soft);
    border-radius: var(--radius-sm);
    background-color: var(--surface-soft);
    font-size: 1rem;
    font-family: var(--font-body);
    color: var(--ink-900);
    transition: border-color 0.25s var(--ease-out-quart), box-shadow 0.25s var(--ease-out-quart), background-color 0.25s var(--ease-out-quart);
}

.form-input::placeholder {
    color: var(--ink-400);
}

.form-input:hover {
    border-color: var(--ink-300);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: var(--surface);
    box-shadow: 0 0 0 4px rgba(10, 72, 111, 0.12);
}

.form-input.is-invalid {
    border-color: var(--danger-color);
}

.form-input.is-invalid:focus {
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.12);
}

/* Password visibility toggle */
.password-input-wrapper {
    position: relative;
}

.password-input-wrapper .form-input {
    padding-right: 2.75rem;
}

.password-toggle-btn {
    position: absolute;
    top: 50%;
    right: 0.35rem;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--ink-500);
    cursor: pointer;
    transition: color 0.2s var(--ease-out-quart), background-color 0.2s var(--ease-out-quart);
}

.password-toggle-btn i {
    font-size: 1.1rem;
    line-height: 1;
    pointer-events: none;
}

.password-toggle-btn:hover {
    color: var(--primary-color);
    background-color: var(--surface-muted);
}

.password-toggle-btn:focus-visible {
    outline: 2px solid var(--primary-light);
    outline-offset: 2px;
}

.error-message {
    color: var(--danger-color);
    font-size: 0.8125rem;
    margin-top: 0.375rem;
    font-weight: 500;
}

.signup-button {
    width: 100%;
    padding: 0.95rem 1.5rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: transform 0.3s var(--ease-tactile), box-shadow 0.35s ease, background 0.3s ease;
    margin-top: 0.5rem;
    box-shadow: 0 4px 14px rgba(10, 72, 111, 0.3);
    position: relative;
    overflow: hidden;
}

.signup-button::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.16), transparent);
    transform: translateX(-100%);
    transition: transform 0.5s ease;
}

.signup-button:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, #052538 100%);
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(10, 72, 111, 0.38);
}

.signup-button:hover::after {
    transform: translateX(100%);
}

.signup-button:active {
    transform: translateY(0);
    box-shadow: 0 4px 14px rgba(10, 72, 111, 0.3);
}

.signup-button:focus-visible {
    outline: 2px solid var(--primary-light);
    outline-offset: 3px;
}

.form-container {
    --google-auth-border: var(--border-color, #e7ecf1);
    --google-auth-radius: var(--radius-sm, 10px);
    --google-auth-bg: var(--bg-primary, #ffffff);
    --google-auth-bg-hover: var(--bg-secondary, #f9fafb);
    --google-auth-ink: var(--text-primary, #1f2937);
    --google-auth-muted: var(--text-muted, #708499);
    --google-auth-focus: var(--primary-light, #0d5a94);
    --google-auth-font: var(--font-display, 'Plus Jakarta Sans', system-ui, sans-serif);
}

.login-link {
    text-align: center;
    margin-top: 1.75rem;
    color: var(--ink-500);
    font-size: 0.9rem;
}

.login-link a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px solid transparent;
    padding-bottom: 1px;
    transition: color 0.25s ease, border-color 0.25s ease;
}

.login-link a:hover {
    color: var(--primary-dark);
    border-color: currentColor;
}

.alert {
    padding: 0.8rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    border-left: 3px solid transparent;
}

.alert-danger {
    background-color: #fef1f1;
    color: #b3261e;
    border: 1px solid #f8d7d5;
    border-left: 3px solid var(--danger-color);
}

.alert-success {
    background-color: #edfaf3;
    color: #1f7a4d;
    border: 1px solid #cdeedc;
    border-left: 3px solid var(--accent-green-dark);
}

@media (max-width: 968px) {
    .signup-container {
        flex-direction: column;
    }

    .welcome-section {
        min-height: 40vh;
    }
    
    .welcome-background {
        background-attachment: scroll; /* Better performance on mobile */
    }

    .form-section {
        min-height: 60vh;
        /* Align to the top instead of centering: centered flex content that
           overflows its container clips the top edge and can't be scrolled
           back into view, hiding the back-link/logo on shorter viewports. */
        justify-content: flex-start;
        padding-top: 2.5rem;
        box-shadow: none;
    }
}

/* ============================================================================
   Enhanced Mobile Responsiveness for Signup Page
   ============================================================================ */

/* Tablet Portrait (max-width: 768px) */
@media (max-width: 768px) {
    body {
        overflow-x: hidden;
    }
    
    .signup-container {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        min-height: 100dvh;
    }
    
    .welcome-section {
        min-height: 35vh;
        padding: 2rem 1.5rem;
    }
    
    .welcome-logo {
        width: 90px;
        height: 75px;
        margin-bottom: 1.5rem;
    }
    
    .welcome-title {
        font-size: 2rem;
        margin-bottom: 0.75rem;
    }
    
    .welcome-subtitle {
        font-size: 1rem;
    }
    
    .welcome-content {
        max-width: 100%;
    }
    
    .form-section {
        min-height: 65vh;
        padding: 2rem 1.5rem;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .form-container {
        max-width: 100%;
    }
    
    .form-logo {
        width: 80px;
        height: 64px;
        margin-bottom: 1.5rem;
    }

    .form-heading {
        margin-bottom: 1.75rem;
    }

    .form-title {
        font-size: 1.5rem;
    }
    
    .form-group {
        margin-bottom: 1.25rem;
    }
    
    .form-input {
        padding: 0.875rem;
        font-size: 1rem; /* Prevents iOS zoom */
    }
    
    .form-label {
        font-size: 0.875rem;
    }
    
    .signup-button {
        padding: 0.875rem 1.25rem;
        font-size: 0.9375rem;
    }
    
    .error-message {
        font-size: 0.8125rem;
    }
    
    .alert {
        padding: 0.625rem 0.875rem;
        font-size: 0.875rem;
    }
}

/* Mobile Portrait (max-width: 576px) */
@media (max-width: 576px) {
    .signup-container {
        min-height: 100vh;
        min-height: 100dvh;
    }
    
    .welcome-section {
        min-height: 30vh;
        padding: 1.5rem 1rem;
    }
    
    .welcome-logo {
        width: 70px;
        height: 58px;
        margin-bottom: 1rem;
    }
    
    .welcome-title {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }
    
    .welcome-subtitle {
        font-size: 0.875rem;
        line-height: 1.5;
    }
    
    .form-section {
        min-height: 70vh;
        padding: 1.5rem 1rem;
    }
    
    .form-logo {
        width: 70px;
        height: 56px;
        margin-bottom: 1.25rem;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-input {
        padding: 0.75rem;
        font-size: 16px; /* Prevents iOS zoom */
    }
    
    .form-label {
        font-size: 0.8125rem;
        margin-bottom: 0.375rem;
    }
    
    .signup-button {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
        margin-top: 0.75rem;
    }
    
    .login-link {
        font-size: 0.875rem;
        margin-top: 1.25rem;
    }
    
    .error-message {
        font-size: 0.75rem;
    }
    
    .alert {
        padding: 0.625rem 0.75rem;
        font-size: 0.8125rem;
        margin-bottom: 1.25rem;
    }
    
    /* Back link */
    .back-home-wrap {
        margin-bottom: 0.75rem;
    }
    
    .back-home-link {
        font-size: 0.8125rem;
    }

    .form-heading {
        margin-bottom: 1.5rem;
    }

    .form-title {
        font-size: 1.375rem;
    }

    .form-subtitle {
        font-size: 0.875rem;
    }
}

/* Extra Small Mobile (max-width: 400px) */
@media (max-width: 400px) {
    .welcome-section {
        padding: 1rem 0.75rem;
        min-height: 25vh;
    }
    
    .welcome-logo {
        width: 60px;
        height: 50px;
        margin-bottom: 0.75rem;
    }
    
    .welcome-title {
        font-size: 1.25rem;
    }
    
    .welcome-subtitle {
        font-size: 0.8125rem;
    }
    
    .form-section {
        padding: 1rem 0.75rem;
    }
    
    .form-logo {
        width: 60px;
        height: 48px;
        margin-bottom: 1rem;
    }
    
    .form-input {
        padding: 0.625rem;
        font-size: 16px;
    }
    
    .signup-button {
        padding: 0.625rem 0.875rem;
        font-size: 0.8125rem;
    }
    
    .form-group {
        margin-bottom: 0.875rem;
    }
}

/* Landscape mobile devices */
@media (max-height: 600px) and (orientation: landscape) {
    .signup-container {
        flex-direction: row;
        height: 100vh;
    }
    
    .welcome-section {
        min-height: 100vh;
        flex: 0.4;
    }
    
    .form-section {
        min-height: 100vh;
        flex: 0.6;
        overflow-y: auto;
    }
    
    .welcome-logo {
        width: 60px;
        height: 50px;
        margin-bottom: 0.75rem;
    }
    
    .welcome-title {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }
    
    .welcome-subtitle {
        font-size: 0.875rem;
    }
    
    .form-logo {
        width: 60px;
        height: 48px;
        margin-bottom: 1rem;
    }
}

/* Prevent horizontal scroll */
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden;
        width: 100%;
    }
    
    * {
        max-width: 100%;
    }
    
    .form-input {
        width: 100%;
        box-sizing: border-box;
    }
}

/* Safe area insets for notched devices */
@supports (padding: env(safe-area-inset-bottom)) {
    @media (max-width: 768px) {
        .welcome-section {
            padding-left: max(1rem, env(safe-area-inset-left));
            padding-right: max(1rem, env(safe-area-inset-right));
        }
        
        .form-section {
            padding-left: max(1rem, env(safe-area-inset-left));
            padding-right: max(1rem, env(safe-area-inset-right));
            padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
        }
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .form-input {
        border-width: 2px;
    }
    
    .signup-button {
        border: 2px solid var(--primary-color);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .welcome-background {
        background-attachment: scroll;
    }
    
    .form-input,
    .signup-button {
        transition: none;
    }

    .signup-button::after {
        display: none;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .form-input,
    .signup-button {
        min-height: 44px; /* Minimum touch target size */
    }
    
    .signup-button {
        min-width: 44px;
    }

    .password-toggle-btn {
        width: 44px;
        height: 44px;
    }

    .signup-button::after {
        display: none;
    }
}