/* DiF v5 - Authentication Styles */

/* Authentication Pages */
.auth-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #f5f5f0; /* Light cream background */
    padding: 1rem;
    gap: 2rem;
}

/* Register inside app shell keeps centered card and scrollability */
body.app-shell-page.register-page #app-main {
    overflow-y: auto;
}

body.app-shell-page.register-page .auth-container {
    min-height: 100%;
    padding: 2rem 1rem;
}

.auth-card {
    background: #ffffff;
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    padding: 2.5rem;
    width: 100%;
    max-width: 450px;
    position: relative;
    box-sizing: border-box;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo {
    max-width: 300px;
    height: auto;
    margin-bottom: 1.5rem;
}

.auth-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 0.5rem;
}

.auth-subtitle {
    color: #718096;
    font-size: 0.95rem;
    margin: 0;
}

.auth-notice {
    border: 1px solid #d8dee2;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    line-height: 1.45;
    margin: -0.5rem 0 1.5rem;
    padding: 0.8rem 0.9rem;
}

.auth-notice strong {
    display: block;
    color: #2d3748;
    margin-bottom: 0.2rem;
}

.auth-notice-info {
    background: #f4f7f2;
    border-color: #c9d5c2;
    color: #4a5568;
}

.auth-legal-consent {
    margin: 0.35rem 0 1.15rem;
    padding: 0.85rem 0.9rem;
    border: 1px solid #d7e0d6;
    border-radius: 0.7rem;
    background: #f7faf6;
    color: #4a5568;
    font-size: 0.86rem;
    line-height: 1.45;
}

.auth-legal-consent label {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.65rem;
    align-items: start;
    margin: 0;
    cursor: pointer;
}

.auth-legal-consent input[type="checkbox"] {
    width: 1.05rem;
    height: 1.05rem;
    margin-top: 0.15rem;
    accent-color: #356b58;
}

.auth-legal-consent a {
    color: #2f6956;
    font-weight: 700;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

.auth-notice-warning {
    background: #fff8e6;
    border-color: #efd08a;
    color: #5c4821;
}

.resend-confirmation-form {
    display: grid;
    gap: 0.6rem;
    margin-top: 0.85rem;
}

.resend-confirmation-label {
    color: #5c4821;
    font-size: 0.85rem;
    font-weight: 600;
    margin: 0;
}

.resend-confirmation-form input[type="text"] {
    width: 100%;
    border: 1px solid #efd08a;
    border-radius: 0.5rem;
    box-sizing: border-box;
    color: #2d3748;
    font-size: 0.95rem;
    padding: 0.65rem 0.75rem;
}

.resend-confirmation-form input[type="text"]:focus {
    border-color: #8b9d83;
    box-shadow: 0 0 0 3px rgba(139, 157, 131, 0.12);
    outline: none;
}

.resend-confirmation-btn {
    background: #5c4821;
    border: 0;
    border-radius: 0.5rem;
    color: #ffffff;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.65rem 0.85rem;
}

.resend-confirmation-btn:hover {
    background: #3f3116;
}

.auth-form {
    margin-bottom: 1.5rem;
    width: 100%;
}

.form-group {
    margin-bottom: 1.5rem;
    width: 100%;
}

.input-wrapper {
    position: relative;
    width: 100%;
    box-sizing: border-box; /* Ensure padding is included in width calculation */
}

.auth-input {
    width: 100%;
    padding: 0.875rem 1rem;
    padding-left: 2.75rem; /* Extra space for left-side icons */
    padding-right: 3rem; /* Ensure adequate space for icon */
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    font-size: 1rem;
    background-color: #ffffff;
    transition: all 0.2s ease;
    box-sizing: border-box;
    text-overflow: ellipsis; /* Handle long text gracefully */
    white-space: nowrap; /* Prevent text wrapping */
}

.auth-input:focus {
    outline: none;
    border-color: #4a5568;
    box-shadow: 0 0 0 3px rgba(74, 85, 104, 0.1);
}

.auth-input::placeholder {
    color: #a0aec0;
    text-overflow: ellipsis; /* Handle long placeholder text */
    white-space: nowrap;
    overflow: hidden;
    max-width: calc(100% - 3rem); /* Ensure placeholder doesn't overlap with icon */
}

.birthdate-input-wrapper {
    padding-left: 0;
}

.birthdate-select-row {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.8fr) minmax(0, 0.9fr);
    gap: 0.5rem;
    width: 100%;
}

.birthdate-select {
    padding-left: 0.75rem;
    padding-right: 2rem;
    white-space: nowrap;
}

.input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.1rem;
    color: #718096;
    transition: color 0.2s ease;
    pointer-events: auto; /* Ensure icon is clickable */
    z-index: 2; /* Ensure icon appears above input text */
    max-width: 1.5rem; /* Prevent icon from being too wide */
    text-align: center; /* Center icon content */
    box-sizing: border-box; /* Ensure consistent sizing */
}

.password-icon {
    cursor: pointer;
    pointer-events: auto;
}

.password-icon:hover {
    color: #4a5568;
}

.helper-text {
    font-size: 0.8rem;
    color: #718096;
    margin-top: 0.5rem;
    margin-left: 0.5rem;
}

.password-strength {
    font-size: 0.8rem;
    color: #3182ce;
    margin-top: 0.5rem;
    margin-left: 0.5rem;
}

.strength-indicator {
    font-weight: 600;
}

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.9rem;
    color: #4a5568;
}

.checkbox-wrapper input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid #cbd5e0;
    border-radius: 0.25rem;
    margin-right: 0.5rem;
    position: relative;
    transition: all 0.2s ease;
}

.checkbox-wrapper input[type="checkbox"]:checked + .checkmark {
    background-color: #4a5568;
    border-color: #4a5568;
}

.checkbox-wrapper input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 0.8rem;
    font-weight: bold;
}

.forgot-link {
    color: #4a5568;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.forgot-link:hover {
    color: #2d3748;
    text-decoration: underline;
}

.auth-btn {
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, #8b9d83 0%, #a67c52 100%);
    border: none;
    border-radius: 0.75rem;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 1.5rem;
}

.auth-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 157, 131, 0.3);
}

.auth-btn:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.auth-divider {
    text-align: center;
    margin: 1.5rem 0;
    position: relative;
}

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background-color: #e2e8f0;
}

.auth-divider span {
    background-color: #ffffff;
    padding: 0 1rem;
    color: #718096;
    font-size: 0.9rem;
    position: relative;
    z-index: 1;
}

.auth-footer {
    text-align: center;
}

.create-account-link {
    color: #553c9a;
    text-decoration: underline;
    font-weight: 600;
    font-size: 1rem;
}

.create-account-link:hover {
    color: #44337a;
}

.login-link {
    color: #3182ce;
    text-decoration: none;
}

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

.alpha-notice {
    font-size: 0.75rem;
    color: #718096;
    margin-top: 1rem;
    margin-bottom: 0;
}

/* Mobile Authentication Styles */
@media (max-width: 576px) {
    .auth-container {
        padding: 0.5rem;
    }

    body.app-shell-page.register-page .auth-container {
        padding: 1rem 0.5rem;
    }
    
    .auth-card {
        padding: 1.5rem;
        margin: 0.5rem;
        box-sizing: border-box;
        max-width: calc(100vw - 1rem); /* Ensure card never exceeds viewport width */
    }
    
    .auth-logo {
        max-width: 250px;
    }
    
    .auth-title {
        font-size: 1.5rem;
    }
    
    .form-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .auth-input {
        padding: 0.75rem 1rem;
        padding-left: 2.5rem; /* Space for left-side icons on mobile */
        padding-right: 2.5rem; /* Maintain adequate space for icon */
        box-sizing: border-box;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .auth-input::placeholder {
        max-width: calc(100% - 2.5rem); /* Adjust for mobile padding */
    }

    .birthdate-select-row {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.4rem;
    }

    .birthdate-select {
        padding-left: 0.6rem;
        padding-right: 1.5rem;
    }
    
    .input-icon {
        right: 0.75rem;
        font-size: 1rem;
        pointer-events: auto;
        max-width: 1.25rem; /* Slightly smaller on mobile */
        z-index: 2;
    }
}

/* Additional responsive adjustments for very small screens */
@media (max-width: 480px) {
    .auth-container {
        padding: 0.25rem;
    }

    body.app-shell-page.register-page .auth-container {
        padding: 0.75rem 0.25rem;
    }
    
    .auth-card {
        padding: 1rem;
        margin: 0.25rem;
        max-width: calc(100vw - 0.5rem);
    }
    
    .auth-title {
        font-size: 1.25rem;
    }
    
    .auth-subtitle {
        font-size: 0.875rem;
    }

    .birthdate-select-row {
        gap: 0.3rem;
    }
}

/* Ultra-small screen adjustments */
@media (max-width: 360px) {
    .auth-container {
        padding: 0.125rem;
    }

    body.app-shell-page.register-page .auth-container {
        padding: 0.625rem 0.125rem;
    }
    
    .auth-card {
        padding: 0.75rem;
        margin: 0.125rem;
        max-width: calc(100vw - 0.25rem);
    }
    
    .auth-title {
        font-size: 1.125rem;
    }
    
    .auth-subtitle {
        font-size: 0.8rem;
    }
    
    .auth-input {
        padding: 0.625rem 0.875rem;
        padding-left: 2.25rem; /* Space for left-side icons on very small screens */
        padding-right: 2.25rem; /* Maintain adequate space for icon */
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .auth-input::placeholder {
        max-width: calc(100% - 2.25rem); /* Adjust for ultra-small screen padding */
    }
    
    .input-icon {
        right: 0.625rem;
        font-size: 0.9rem;
        max-width: 1.1rem; /* Even smaller on ultra-small screens */
        z-index: 2;
    }
}

/* Onboarding Styles */
.onboarding-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f5f5f0; /* Light cream background - matches auth pages */
    padding: 1rem;
}

.onboarding-card {
    background: #ffffff;
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    padding: 2.5rem;
    width: 100%;
    max-width: 800px;
    position: relative;
    box-sizing: border-box;
}

.onboarding-header {
    text-align: center;
    margin-bottom: 2rem;
}

.onboarding-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 0.5rem;
}

.onboarding-header p {
    color: #718096;
    font-size: 0.95rem;
    margin: 0;
}

.progress-container {
    padding: 1.5rem 0;
    background: transparent;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 2rem;
}

.progress-bar {
    height: 8px;
    background: #e2e8f0;
    border-radius: 0.75rem;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #8b9d83 0%, #a67c52 100%); /* Match auth button gradient */
    transition: width 0.3s ease;
    border-radius: 0.75rem;
}

.step-indicators {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.step-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.step-circle.active {
    background: linear-gradient(135deg, #8b9d83 0%, #a67c52 100%); /* Match auth button gradient */
    color: white;
    transform: scale(1.1);
}

.step-circle.completed {
    background: #28a745;
    color: white;
}

/* Mobile Responsiveness for Auth Container with Amara Preview */
@media (max-width: 768px) {
    .auth-container {
        padding: 0.5rem;
        gap: 1.5rem;
    }
    
    .auth-card {
        padding: 2rem;
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .auth-container {
        padding: 0.25rem;
        gap: 1rem;
    }
    
    .auth-card {
        padding: 1.5rem;
    }
}

/* Login Modal Styles */
.login-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.login-modal.active {
    opacity: 1;
    visibility: visible;
}

.login-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.login-modal-content {
    position: relative;
    width: 100%;
    max-width: 450px;
    margin: 1rem;
    background: #ffffff;
    border-radius: 1rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9) translateY(20px);
    transition: all 0.3s ease;
    overflow: hidden;
}

.login-modal.active .login-modal-content {
    transform: scale(1) translateY(0);
}

.login-modal-header {
    position: relative;
    padding: 1rem;
    text-align: right;
}

.login-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #718096;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.2s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-modal-close:hover {
    background: #f7fafc;
    color: #4a5568;
    transform: scale(1.1);
}

.login-modal-body {
    padding: 0 1rem 1rem 1rem;
}

.login-modal-message {
    margin: 0 0 0.85rem 0;
    padding: 0.65rem 0.75rem;
    font-size: 0.9rem;
    color: #4a5568;
    background: #edf2f7;
    border-radius: 8px;
    line-height: 1.45;
}

.login-modal-message[hidden] {
    display: none !important;
}

.login-modal .auth-card {
    background: transparent;
    box-shadow: none;
    padding: 0;
    margin: 0;
    max-width: none;
}

.login-modal .auth-header {
    margin-bottom: 1.5rem;
}

.login-modal .auth-logo {
    max-width: 250px;
}

/* Mobile Responsiveness for Login Modal */
@media (max-width: 576px) {
    .login-modal-content {
        margin: 0.5rem;
        max-width: calc(100vw - 1rem);
    }
    
    .login-modal-body {
        padding: 0 0.5rem 0.5rem 0.5rem;
    }
    
    .login-modal .auth-logo {
        max-width: 375px;
    }
}

@media (max-width: 480px) {
    .login-modal-content {
        margin: 0.25rem;
        max-width: calc(100vw - 0.5rem);
    }
    
    .login-modal-body {
        padding: 0 0.25rem 0.25rem 0.25rem;
    }
    
    .login-modal .auth-logo {
        max-width: 338px;
    }
}
