/* Modal and authentication styles - BerryViral Dark Theme */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-app);
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    overflow-y: auto;
}

.modal.show {
    opacity: 1;
}

.modal-content {
    /* background-color: var(--bg-app); */
    margin: 0;
    padding: 0;
    border: none;
    width: 100%;
    height: 100%;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    min-height: 100vh;
}

.modal-left {
    flex: 1;
    background: linear-gradient(135deg, var(--bg-app) 0%, var(--slate-900) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: white;
    position: relative;
    overflow: hidden;
}

.modal-left::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.3;
}

.modal-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    /* background: var(--bg-surface); */
}

.modal-left-content {
    text-align: center;
    max-width: 400px;
    position: relative;
    z-index: 2;
}

.modal-left h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, #ffffff 0%, var(--berry-green-300) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.modal-left p {
    font-size: 1.1rem;
    opacity: 0.9;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.8);
}

/* .modal-left::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-accent);
} */

.auth-container {
    width: 100%;
    max-width: 400px;
}

.tab-buttons {
    display: flex;
    margin-bottom: 2rem;
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    padding: 4px;
}

.tab-button {
    flex: 1;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.tab-button.active {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-md);
}

.tab-button:hover:not(.active) {
    background: rgba(107, 70, 193, 0.1);
    color: var(--text-primary);
}

.close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    color: var(--berry-primary-400);
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    background: rgba(107, 70, 193, 0.1);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.close:hover,
.close:focus {
    background: rgba(107, 70, 193, 0.2);
    outline: none;
    transform: scale(1.1);
}

.modal-content .tab {
    display: none;
    flex-direction: column;
    width: 100%;
}

.modal-content .tab.active {
    display: flex;
}

.auth-form-group {
    margin-bottom: 1.5rem;
}

.auth-form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.auth-form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: var(--transition-fast);
    background: var(--bg-app);
    color: var(--text-primary);
    font-family: inherit;
}

.auth-form-group input::placeholder {
    color: var(--text-muted);
}

.auth-form-group input:focus {
    outline: none;
    border-color: var(--border-brand);
    box-shadow: 0 0 0 3px rgba(107, 70, 193, 0.1);
    background: var(--bg-elevated);
}

.auth-submit-btn {
    width: 100%;
    padding: 12px 20px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: var(--transition-fast);
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    outline: none;
}
.auth-submit-btn:focus-visible, .tab-button:focus-visible, .social-login-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(126,7,237,0.25);
    z-index: 2;
    position: relative;
    transition: box-shadow 0.18s;
}

.auth-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

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

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

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

.auth-divider {
    text-align: center;
    margin: 1.5rem 0;
    position: relative;
    color: var(--text-tertiary);
    font-size: 0.9rem;
}

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border-subtle);
    z-index: 1;
}

.auth-divider span {
    background: var(--bg-surface);
    padding: 0 1rem;
    position: relative;
    z-index: 2;
}

.social-login-btn {
    width: 100%;
    padding: 12px 20px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.social-login-btn:hover {
    border-color: var(--border-brand);
    background: var(--bg-app);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.social-login-btn.google {
    border-color: var(--border-subtle);
    color: var(--text-primary);
    background: var(--bg-surface);
}

.social-login-btn.google:hover {
    background: var(--bg-elevated);
    border-color: var(--berry-primary-500);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.social-login-btn.facebook {
    border-color: #1877f2;
    color: #1877f2;
}

.social-login-btn.facebook:hover {
    background: rgba(24, 119, 242, 0.1);
    border-color: #1d4ed8;
}

.auth-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .modal-content {
        flex-direction: column;
    }
    
    .modal-left {
        flex: none;
        min-height: 200px;
        padding: 1.5rem;
    }
    
    .modal-left h2 {
        font-size: 2rem;
    }
    
    .modal-right {
        flex: 1;
        padding: 1.5rem;
    }
    
    .close {
        top: 1rem;
        right: 1rem;
    }
    
    .auth-form-group input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .tab-buttons {
        margin-bottom: 1.5rem;
    }
    
    .tab-button {
        padding: 10px 12px;
        font-size: 0.9rem;
    }
}