/* ============================================
   AUTH PAGES - Login & Registrazione
   ============================================ */

.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-gray);
}

/* Auth Layout */
.auth-layout {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start; /* let columns grow independently */
}

/* Left panel - visual: sticky so it doesn't scroll */
.auth-visual {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-visual-bg {
    position: absolute;
    inset: 0;
}

.auth-visual-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.25;
}

.auth-visual-content {
    position: relative;
    z-index: 1;
    padding: 3rem;
    color: white;
    text-align: center;
    max-width: 460px;
}

.auth-visual-icon {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin: 0 auto 2rem;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.auth-visual-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.auth-visual-subtitle {
    font-size: 1.05rem;
    opacity: 0.85;
    line-height: 1.6;
    margin-bottom: 2.5rem;
}

.auth-features {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    text-align: left;
}

.auth-feature {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 0.875rem 1.25rem;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.auth-feature i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.auth-feature span {
    font-size: 0.9rem;
    font-weight: 500;
}

/* Right panel - form: scrolls independently */
.auth-form-panel {
    display: flex;
    justify-content: center;
    padding: 3rem 2rem;
    background: var(--bg-white);
    min-height: 100vh;
}

.auth-form-container {
    width: 100%;
    max-width: 500px;
    padding-bottom: 2rem;
}

.auth-form-header {
    margin-bottom: 2.5rem;
}

.auth-form-header h1 {
    font-size: 1.875rem;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.auth-form-header p {
    color: var(--text-gray);
    font-size: 0.95rem;
}

.auth-form-header p a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

.auth-form-header p a:hover {
    text-decoration: underline;
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.auth-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.auth-form label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-dark);
}

.input-wrapper {
    position: relative;
}

.input-wrapper .input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 0.9rem;
    pointer-events: none;
}

.input-wrapper input,
.input-wrapper select {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 2.75rem;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 0.95rem;
    color: var(--text-dark);
    background: var(--bg-white);
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

.input-wrapper select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
    cursor: pointer;
}

.input-wrapper input:focus,
.input-wrapper select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(38, 150, 190, 0.12);
}

.input-wrapper input.error,
.input-wrapper select.error {
    border-color: var(--danger);
}

.input-wrapper input.error:focus,
.input-wrapper select.error:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.password-toggle {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 0.2rem;
    font-size: 0.9rem;
    transition: color 0.2s;
}

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

.field-error {
    font-size: 0.8rem;
    color: var(--danger);
    display: none;
}

.field-error.show {
    display: block;
}

/* Password strength */
.password-strength {
    margin-top: 0.4rem;
}

.strength-bar {
    height: 4px;
    background: var(--bg-light);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.35rem;
}

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

.strength-fill.weak { width: 33%; background: var(--danger); }
.strength-fill.medium { width: 66%; background: var(--warning); }
.strength-fill.strong { width: 100%; background: var(--success); }

.strength-label {
    font-size: 0.75rem;
    color: var(--text-light);
}

/* Form options (remember me, forgot password) */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-gray);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

.link-forgot {
    font-size: 0.875rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.link-forgot:hover {
    text-decoration: underline;
}

/* Submit button */
.btn-auth {
    width: 100%;
    padding: 0.95rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.btn-auth:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

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

.btn-auth:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-auth .spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: none;
}

.btn-auth.loading .spinner { display: block; }
.btn-auth.loading .btn-text { display: none; }

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

/* Divider */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-light);
    font-size: 0.8rem;
    margin: 0.5rem 0;
}

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

/* Alert messages */
.auth-alert {
    padding: 0.875rem 1rem;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    display: none;
    align-items: center;
    gap: 0.625rem;
}

.auth-alert.show { display: flex; }

.auth-alert-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.auth-alert-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

/* Terms */
.auth-terms {
    font-size: 0.775rem;
    color: var(--text-light);
    text-align: center;
    line-height: 1.5;
}

.auth-terms a {
    color: var(--primary);
    text-decoration: none;
}

.auth-terms a:hover { text-decoration: underline; }

/* Responsive */
@media (max-width: 900px) {
    .auth-layout {
        grid-template-columns: 1fr;
    }
    .auth-visual {
        display: none;
    }
    .auth-form-panel {
        padding: 2rem 1.5rem;
        min-height: calc(100vh - 73px);
    }
}

@media (max-width: 480px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    .auth-form-header h1 {
        font-size: 1.5rem;
    }
}

/* ============================================
   GOOGLE AUTH BUTTON
   ============================================ */

.auth-google-wrapper {
    margin-bottom: 1.25rem;
}

.btn-google {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .75rem;
    padding: .875rem 1.25rem;
    background: #fff;
    border: 1.5px solid #dadce0;
    border-radius: 10px;
    font-size: .95rem;
    font-weight: 600;
    color: #3c4043;
    cursor: pointer;
    transition: background .18s, border-color .18s, box-shadow .18s;
    font-family: inherit;
    line-height: 1;
}

.btn-google:hover {
    background: #f8f9fa;
    border-color: #c6c6c6;
    box-shadow: 0 1px 6px rgba(32,33,36,.15);
}

.btn-google:active {
    background: #f1f3f4;
}

.btn-google:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.btn-google.loading {
    opacity: .65;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-google .google-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid #dadce0;
    border-top-color: #4285f4;
    border-radius: 50%;
    animation: spin .7s linear infinite;
    display: none;
    flex-shrink: 0;
}

.btn-google.loading .google-spinner { display: block; }
.btn-google.loading .google-g        { display: none; }
.btn-google.loading .google-label    { opacity: .7; }

/* ============================================
   GOOGLE COMPLETION MODAL
   ============================================ */

.gcm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: gcm-fade-in .2s ease;
    overflow-y: auto;
}

@keyframes gcm-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.gcm-card {
    background: #fff;
    border-radius: 20px;
    padding: 2rem 2rem 1.5rem;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
    animation: gcm-slide-up .25s ease;
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes gcm-slide-up {
    from { transform: translateY(24px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.gcm-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.gcm-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid #e5e7eb;
}

.gcm-avatar-placeholder {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.4rem;
    color: #94a3b8;
}

.gcm-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: #1a1a1a;
    margin-bottom: .15rem;
}

.gcm-subtitle {
    font-size: .85rem;
    color: #64748b;
}

.gcm-org-inner {
    padding: .5rem 0 .25rem;
    border-top: 1px dashed #e5e7eb;
    margin-top: .5rem;
}

@media (max-width: 520px) {
    .gcm-card {
        padding: 1.5rem 1.25rem 1.25rem;
        border-radius: 16px;
    }
}
