/* Authentication Styles */

/* Auth Toggle Buttons */
.auth-toggle {
    display: flex;
    gap: 0;
    margin-bottom: 30px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--primary-color);
}

.auth-toggle-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: transparent;
    color: var(--primary-color);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: 14px;
}

.auth-toggle-btn.active {
    background: var(--primary-color);
    color: white;
}

.auth-toggle-btn:hover:not(.active) {
    background: rgba(99, 102, 241, 0.1);
}

/* Auth Forms */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.auth-form.hidden {
    display: none;
}

.auth-form h3 {
    margin: 0 0 20px 0;
    color: var(--text-primary);
    font-size: 24px;
    text-align: center;
}

.auth-form input {
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.auth-btn {
    padding: 15px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.3);
}

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

.auth-links {
    text-align: center;
    margin-top: 15px;
}

.auth-links a {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

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

/* Legacy Login Section */
.legacy-login {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid var(--border-color);
}

.legacy-login h4 {
    margin: 0 0 20px 0;
    color: var(--text-secondary);
    font-size: 16px;
    text-align: center;
}

.legacy-login input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    margin-bottom: 15px;
    box-sizing: border-box;
}

.legacy-login button {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #6b7280, #4b5563);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.legacy-login button:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(107, 114, 128, 0.3);
}

/* Divider */
.divider {
    position: relative;
    text-align: center;
    margin: 20px 0;
}

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

.divider span {
    background: var(--bg-primary);
    color: var(--text-secondary);
    padding: 0 15px;
    font-size: 12px;
    font-weight: 500;
}

/* Error and Success Messages */
.error-message, .success-message {
    padding: 0;
    border-radius: 6px;
    font-size: 14px;
    margin-top: 0;
    text-align: center;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.error-message:not(:empty), .success-message:not(:empty) {
    padding: 10px;
    margin-top: 10px;
    opacity: 1;
    max-height: 100px;
}

.error-message:not(:empty) {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.success-message:not(:empty) {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Auth Notes */
.auth-note {
    margin-top: 15px;
    padding: 12px;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 6px;
    font-size: 13px;
    text-align: center;
}

.auth-note p {
    margin: 0;
    color: #1e40af;
}

.auth-note strong {
    color: #1d4ed8;
}

/* Auth Controls in Navigation */
.auth-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.login-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.login-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.logout-btn {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 16px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    transition: all 0.3s ease;
    margin-left: 10px;
}

.logout-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(239, 68, 68, 0.3);
}

.user-info {
    display: flex;
    align-items: center;
    font-size: 12px;
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.1);
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

/* Loading States */
.auth-btn.loading {
    position: relative;
    color: transparent;
}

.auth-btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive Design */
@media (max-width: 480px) {
    .auth-toggle-btn {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .auth-form input, .auth-btn {
        padding: 12px;
        font-size: 14px;
    }
    
    .auth-form h3 {
        font-size: 20px;
    }
    
    .login-container {
        margin: 20px;
        padding: 30px 20px;
    }
}

/* Dark Mode Adjustments */
[data-theme="dark"] .auth-form input {
    background: var(--bg-secondary);
    border-color: #374151;
    color: var(--text-primary);
}

[data-theme="dark"] .auth-form input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

[data-theme="dark"] .divider::before {
    background: #374151;
}

[data-theme="dark"] .divider span {
    background: var(--bg-primary);
    color: var(--text-secondary);
}

[data-theme="dark"] .user-info {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.3);
}

/* Password Prompt Animations */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
        max-height: 0;
    }
    to {
        opacity: 1;
        transform: translateY(0);
        max-height: 200px;
    }
}

/* Additional responsive styles */
@media (max-width: 480px) {
    .auth-form input {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

/* New Authentication Controls Styling */
.auth-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-direction: column;
}

@media (min-width: 768px) {
    .user-info {
        flex-direction: row;
    }
}

.user-email {
    font-size: 12px;
    color: var(--text-secondary);
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.auth-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.login-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.3);
}

.logout-btn {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.logout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

/* Protected content access styling */
.protected-content-message {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
    border-radius: 12px;
    margin: 20px;
}

.protected-content-message h3 {
    color: var(--text-primary);
    margin-bottom: 15px;
}

.protected-content-message p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* Mobile responsive adjustments for auth controls */
@media (max-width: 768px) {
    .auth-controls {
        flex-direction: column;
        gap: 5px;
    }
    
    .user-email {
        font-size: 11px;
        max-width: 120px;
    }
    
    .auth-btn {
        padding: 6px 12px;
        font-size: 11px;
    }
}
