/* Safe Modal Login Styles */
.login-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.login-modal-overlay {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    max-width: 420px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.login-modal-header {
    padding: 24px 24px 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.login-modal-header h2 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.5em;
    font-weight: 600;
    line-height: 1.3;
    flex: 1;
    padding-right: 15px;
}

.login-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #95a5a6;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.login-modal-close:hover {
    color: #e74c3c;
    background: #f8f9fa;
}

.login-modal-body {
    padding: 24px;
}

.modal-login-form .form-group {
    margin-bottom: 20px;
}

.modal-login-form label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #2c3e50;
    font-size: 14px;
}

.modal-login-form input[type="text"],
.modal-login-form input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 16px;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: #f8f9fa;
}

.modal-login-form input:focus {
    outline: none;
    border-color: #3498db;
    background: white;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-actions {
    margin: 24px 0 20px;
}

.login-submit-btn {
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-submit-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #2980b9, #1f639a);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.login-submit-btn:active:not(:disabled) {
    transform: translateY(0);
}

.login-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.login-btn-spinner {
    font-size: 14px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.login-links {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: #7f8c8d;
}

.login-links a {
    color: #3498db;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.login-links a:hover {
    color: #2980b9;
    text-decoration: underline;
}

.login-links .separator {
    margin: 0 12px;
    color: #bdc3c7;
}

/* Social Login Styles */
.social-login-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 24px 0 20px;
}

.social-login-divider::before,
.social-login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e9ecef;
}

.social-login-divider span {
    padding: 0 16px;
    color: #7f8c8d;
    font-size: 14px;
    font-weight: 500;
}

.social-login-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.social-login-btn {
    width: 100%;
    padding: 14px 20px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 50px;
    background: white;
    color: #2c3e50;
}

.social-login-btn:hover:not(:disabled) {
    border-color: #d0d7de;
    background: #f8f9fa;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.social-login-btn:active:not(:disabled) {
    transform: translateY(0);
}

.social-login-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.google-login-btn {
    border-color: #dadce0;
}

.google-login-btn:hover:not(:disabled) {
    border-color: #1a73e8;
    background: #fafbff;
}


.social-login-btn svg {
    flex-shrink: 0;
}

.social-login-btn span {
    flex: 1;
    text-align: center;
}

.login-error {
    background: #ffebee;
    color: #c62828;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    border-left: 4px solid #e53e3e;
    font-size: 14px;
    line-height: 1.4;
}

.login-error::before {
    content: "⚠ ";
    font-weight: bold;
}

.login-success-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #4CAF50;
    color: white;
    padding: 15px 20px;
    border-radius: 6px;
    z-index: 10001;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    font-size: 14px;
    max-width: 300px;
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from { 
        transform: translateX(100%); 
        opacity: 0; 
    }
    to { 
        transform: translateX(0); 
        opacity: 1; 
    }
}

/* Responsive design */
@media (max-width: 480px) {
    .login-modal-overlay {
        padding: 10px;
    }
    
    .login-modal-content {
        border-radius: 8px;
        max-width: none;
        margin: 0;
    }
    
    .login-modal-header {
        padding: 20px 20px 0;
    }
    
    .login-modal-body {
        padding: 20px;
    }
    
    .login-modal-header h2 {
        font-size: 1.3em;
    }
    
    .modal-login-form input[type="text"],
    .modal-login-form input[type="password"] {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Tablet responsive design - larger touch targets */
@media (min-width: 481px) and (max-width: 1024px) {
    .login-modal-content {
        max-width: 460px;
    }

    .login-modal-header {
        padding: 28px 28px 0;
    }

    .login-modal-body {
        padding: 28px;
    }

    .modal-login-form input[type="text"],
    .modal-login-form input[type="password"],
    .modal-login-form input[type="email"] {
        padding: 16px 20px;
        font-size: 17px;
    }

    .login-submit-btn,
    .social-login-btn {
        padding: 16px 24px;
        min-height: 56px;
        font-size: 17px;
    }

    .form-group {
        margin-bottom: 24px;
    }

    .login-modal-header h2 {
        font-size: 1.6em;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .login-modal {
        background: rgba(0, 0, 0, 0.8);
    }
    
    .modal-login-form input[type="text"],
    .modal-login-form input[type="password"] {
        border-width: 2px;
    }
    
    .login-submit-btn {
        background: #000;
        border: 2px solid #fff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .login-modal,
    .login-modal-content,
    .login-success-notification {
        animation: none;
    }
    
    .login-modal-close,
    .login-submit-btn {
        transition: none;
    }
    
    .login-btn-spinner {
        animation: none;
    }
    
    .login-btn-spinner::after {
        content: "...";
    }
}

/* Logout Modal Specific Styles */
.logout-modal .logout-content {
    max-width: 400px;
}

.logout-modal .logout-message {
    font-size: 1.1em;
    color: #2c3e50;
    margin: 0 0 24px 0;
    line-height: 1.6;
    text-align: center;
}

.logout-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.logout-cancel-btn,
.logout-confirm-btn {
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    min-width: 120px;
}

.logout-cancel-btn {
    background: #ecf0f1;
    color: #2c3e50;
}

.logout-cancel-btn:hover {
    background: #d5dbdb;
}

.logout-confirm-btn {
    background: #e74c3c;
    color: white;
}

.logout-confirm-btn:hover:not(:disabled) {
    background: #c0392b;
}

.logout-confirm-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.logout-btn-spinner {
    display: none;
    animation: spin 0.6s linear infinite;
}

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

.logout-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #95a5a6;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.logout-modal-close:hover {
    color: #e74c3c;
    background: #f8f9fa;
}

/* Mobile responsive */
@media (max-width: 480px) {
    .logout-actions {
        flex-direction: column;
    }

    .logout-cancel-btn,
    .logout-confirm-btn {
        width: 100%;
    }
}

/* ===================================================================
 * UNIFIED LOGIN/SIGNUP FLOW
 * Multi-step authentication with email detection
 * ================================================================ */

/* Step containers */
.auth-step {
    display: none;
    animation: stepFadeIn 0.3s ease-out;
}

.auth-step.active {
    display: block;
}

@keyframes stepFadeIn {
    from {
        opacity: 0;
        transform: translateX(10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Step subtitles */
.auth-subtitle {
    font-size: 14px;
    color: #7f8c8d;
    margin: 0 0 20px 0;
    text-align: center;
}

/* Back button */
.auth-back-btn {
    background: none;
    border: none;
    color: #3498db;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 0;
    margin-bottom: 16px;
    display: inline-block;
    transition: color 0.2s ease;
}

.auth-back-btn:hover {
    color: #2980b9;
    text-decoration: underline;
}

/* Email display pill */
.auth-email-display {
    background: #e8f4fc;
    color: #2c3e50;
    padding: 10px 18px;
    border-radius: 20px;
    display: inline-block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 20px;
    word-break: break-all;
}

/* Auth method options */
.auth-method-message {
    font-size: 14px;
    color: #2c3e50;
    margin-bottom: 16px;
    text-align: center;
}

.auth-method-options {
    margin-bottom: 20px;
}

.auth-social-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

/* Password strength indicator */
.password-strength {
    height: 4px;
    margin-top: 8px;
    border-radius: 2px;
    transition: all 0.3s ease;
    background: #e9ecef;
}

.password-strength.weak {
    background: #e74c3c;
    width: 33%;
}

.password-strength.medium {
    background: #f39c12;
    width: 66%;
}

.password-strength.strong {
    background: #27ae60;
    width: 100%;
}

/* Optional label styling */
.optional {
    font-size: 12px;
    font-weight: 400;
    color: #95a5a6;
}

/* Terms text */
.terms-text {
    font-size: 12px;
    color: #7f8c8d;
    text-align: center;
    margin-top: 16px;
    line-height: 1.5;
}

.terms-text a {
    color: #3498db;
    text-decoration: none;
}

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

/* Age/Terms checkbox */
.form-group-checkbox {
    margin-bottom: 20px;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-weight: normal;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: #3498db;
}

.checkbox-text {
    font-size: 13px;
    color: #2c3e50;
    line-height: 1.5;
}

.checkbox-text a {
    color: #3498db;
    text-decoration: none;
}

.checkbox-text a:hover {
    text-decoration: underline;
}

/* Social signin buttons container in email step */
.social-signin-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Responsive adjustments for unified flow */
@media (max-width: 480px) {
    .auth-email-display {
        font-size: 13px;
        padding: 8px 14px;
    }

    .auth-back-btn {
        font-size: 13px;
    }
}

/* Reduced motion support for step transitions */
@media (prefers-reduced-motion: reduce) {
    .auth-step {
        animation: none;
    }

    @keyframes stepFadeIn {
        from {
            opacity: 1;
            transform: none;
        }
        to {
            opacity: 1;
            transform: none;
        }
    }
}