/**
 * Email Authentication Modal Styles
 * Provides modern, responsive styling for email/password authentication
 */

/* Modal Overlay */
.email-auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.email-auth-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Modal Content */
.email-auth-content {
    background: white;
    border-radius: 16px;
    max-width: 440px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.8) translateY(-20px);
    transition: transform 0.3s ease;
    position: relative;
}

.email-auth-overlay.show .email-auth-content {
    transform: scale(1) translateY(0);
}

/* Header */
.email-auth-header {
    padding: 32px 32px 0 32px;
    text-align: center;
    position: relative;
}

.email-auth-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 28px;
    color: #666;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.email-auth-close:hover {
    background: #f0f0f0;
    color: #333;
}

.email-auth-title {
    font-size: 24px;
    font-weight: 700;
    color: #333;
    margin: 0 0 24px 0;
}

/* Tabs */
.email-auth-tabs {
    display: flex;
    gap: 0;
    padding: 0 32px;
    margin-bottom: 24px;
    border-bottom: 2px solid #e9ecef;
}

.email-auth-tab {
    flex: 1;
    padding: 12px 16px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 16px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: -2px;
}

.email-auth-tab:hover {
    color: #333;
    background: #f8f9fa;
}

.email-auth-tab.active {
    color: #4285f4;
    border-bottom-color: #4285f4;
}

/* Body */
.email-auth-body {
    padding: 0 32px 32px 32px;
}

/* Alert Messages */
.email-auth-alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 500;
    display: none;
    position: relative;
}

.email-auth-alert.error {
    background: #fee;
    color: #c33;
    border: 1px solid #fcc;
}

.email-auth-alert.success {
    background: #efe;
    color: #3c3;
    border: 1px solid #cfc;
}

.email-auth-alert.info {
    background: #e7f3ff;
    color: #0066cc;
    border: 1px solid #b3d9ff;
}

/* Alert Action Button */
.alert-action-btn {
    margin-left: 12px;
    padding: 6px 14px;
    background: #4285f4;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    vertical-align: middle;
}

.alert-action-btn:hover {
    background: #3367d6;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(66, 133, 244, 0.3);
}

.email-auth-alert.error .alert-action-btn {
    background: #dc3545;
}

.email-auth-alert.error .alert-action-btn:hover {
    background: #c82333;
}

/* Form */
.email-auth-form {
    margin-bottom: 20px;
}

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

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.optional-label {
    font-size: 12px;
    font-weight: 400;
    color: #666;
    font-style: italic;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.form-input:focus {
    outline: none;
    border-color: #4285f4;
    box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.1);
}

.form-input::placeholder {
    color: #999;
}

.input-error {
    display: block;
    color: #c33;
    font-size: 13px;
    margin-top: 4px;
    min-height: 18px;
}

/* Password Input Wrapper */
.password-input-wrapper {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    padding: 4px;
    line-height: 1;
}

.password-toggle:hover {
    opacity: 0.7;
}

/* Password Strength Indicator */
.password-strength {
    margin-top: 12px;
}

.strength-bar {
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.strength-bar-fill {
    height: 100%;
    width: 0%;
    transition: all 0.3s ease;
    border-radius: 3px;
}

.strength-bar-fill.weak {
    background: #dc3545;
}

.strength-bar-fill.medium {
    background: #ffc107;
}

.strength-bar-fill.good {
    background: #17a2b8;
}

.strength-bar-fill.strong {
    background: #28a745;
}

.strength-text {
    font-size: 13px;
    font-weight: 600;
    color: #666;
    margin-bottom: 8px;
}

/* Password Requirements */
.password-requirements {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 12px;
}

.requirement {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #666;
}

.requirement-icon {
    font-size: 12px;
    color: #999;
    font-weight: bold;
}

.requirement.met {
    color: #28a745;
}

.requirement.met .requirement-icon {
    color: #28a745;
}

/* Form Actions */
.form-actions {
    text-align: right;
    margin-bottom: 16px;
}

.forgot-password-link {
    font-size: 14px;
    color: #4285f4;
    text-decoration: none;
    font-weight: 500;
}

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

/* Buttons */
.email-auth-button {
    width: 100%;
    padding: 14px 20px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.email-auth-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.email-auth-button.primary {
    background: #4285f4;
    color: white;
    margin-bottom: 16px;
}

.email-auth-button.primary:hover:not(:disabled) {
    background: #3367d6;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.3);
}

.email-auth-button.magic-link {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-bottom: 12px;
}

.email-auth-button.magic-link:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.magic-icon {
    font-size: 18px;
}

.email-auth-button.google-oauth {
    background: white;
    color: #333;
    border: 2px solid #ddd;
    margin-bottom: 16px;
}

.email-auth-button.google-oauth:hover:not(:disabled) {
    background: #f8f9fa;
    border-color: #4285f4;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.google-icon {
    flex-shrink: 0;
}

/* Divider */
.auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 24px 0;
    color: #999;
    font-size: 14px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #ddd;
}

.auth-divider span {
    padding: 0 16px;
    font-weight: 500;
}

/* Toggle Text */
.auth-toggle-text {
    text-align: center;
    font-size: 14px;
    color: #666;
    margin-top: 16px;
}

.auth-toggle-link {
    color: #4285f4;
    text-decoration: none;
    font-weight: 600;
    margin-left: 4px;
}

.auth-toggle-link:hover {
    text-decoration: underline;
}

/* Scrollbar Styling */
.email-auth-content::-webkit-scrollbar {
    width: 8px;
}

.email-auth-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 0 16px 16px 0;
}

.email-auth-content::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.email-auth-content::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Responsive Design */
@media (max-width: 768px) {
    .email-auth-content {
        max-width: 95%;
        width: 95%;
        max-height: 95vh;
    }

    .email-auth-header {
        padding: 24px 24px 0 24px;
    }

    .email-auth-body {
        padding: 0 24px 24px 24px;
    }

    .email-auth-tabs {
        padding: 0 24px;
    }

    .email-auth-title {
        font-size: 20px;
    }

    .password-requirements {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .email-auth-header {
        padding: 20px 20px 0 20px;
    }

    .email-auth-body {
        padding: 0 20px 20px 20px;
    }

    .email-auth-tabs {
        padding: 0 20px;
    }

    .email-auth-title {
        font-size: 18px;
    }

    .form-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
    .email-auth-content {
        background: #1a1a1a;
    }

    .email-auth-title {
        color: #fff;
    }

    .email-auth-close {
        color: #aaa;
    }

    .email-auth-close:hover {
        background: #333;
        color: #fff;
    }

    .email-auth-tab {
        color: #aaa;
    }

    .email-auth-tab:hover {
        color: #fff;
        background: #333;
    }

    .email-auth-tabs {
        border-bottom-color: #333;
    }

    .form-group label {
        color: #fff;
    }

    .form-input {
        background: #2a2a2a;
        border-color: #444;
        color: #fff;
    }

    .form-input:focus {
        border-color: #4285f4;
    }

    .strength-bar {
        background: #333;
    }

    .requirement {
        color: #aaa;
    }

    .email-auth-button.google-oauth {
        background: #2a2a2a;
        border-color: #444;
        color: #fff;
    }

    .email-auth-button.google-oauth:hover:not(:disabled) {
        background: #333;
    }

    .auth-divider::before,
    .auth-divider::after {
        border-bottom-color: #444;
    }
}
