/* ============================================================================
   Authentication Modal Styles
   RTL Support for Hebrew Interface
   ============================================================================ */

/* Auth Modal Overlay */
.auth-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Auth Modal Container */
.auth-modal {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    width: 90%;
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideUp 0.3s ease;
    direction: rtl;
    text-align: right;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Close Button */
.auth-modal-close {
    position: absolute;
    top: 16px;
    left: 16px;
    background: none;
    border: none;
    font-size: 24px;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.auth-modal-close:hover {
    background-color: #f3f4f6;
    color: #111827;
}

/* Modal Header */
.auth-modal-header {
    padding: 32px 24px 16px;
    border-bottom: 1px solid #e5e7eb;
}

.auth-modal-header h2 {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 8px;
    color: #111827;
}

.auth-modal-header p {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
}

/* Tabs */
.auth-tabs {
    display: flex;
    flex-direction: row-reverse;
    gap: 0;
    padding: 0 24px;
    border-bottom: 1px solid #e5e7eb;
    margin-top: 16px;
}

.auth-tab {
    flex: 1;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 12px 0;
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
}

.auth-tab:hover {
    color: #111827;
}

.auth-tab.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
}

/* Tab Content */
.auth-tab-content {
    padding: 24px;
    min-height: 200px;
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

/* Form Group */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #111827;
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background-color: #f9fafb;
    color: #111827;
    transition: all 0.2s;
    box-sizing: border-box;
    direction: ltr;
}

.form-group input:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
    background-color: white;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group input:focus:not(:focus-visible) {
    outline: none;
    background-color: white;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group input::placeholder {
    color: #9ca3af;
}

/* Submit Button */
.auth-submit-btn {
    width: 100%;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    color: white;
    background-color: #3b82f6;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.auth-submit-btn:hover:not(:disabled) {
    background-color: #2563eb;
}

.auth-submit-btn:disabled {
    background-color: #9ca3af;
    cursor: not-allowed;
}

/* Forgot Password Button */
.auth-forgot-btn {
    background: none;
    border: none;
    color: #3b82f6;
    font-size: 13px;
    cursor: pointer;
    padding: 0;
    text-decoration: none;
    transition: color 0.2s;
    width: 100%;
    text-align: center;
}

.auth-forgot-btn:hover {
    text-decoration: underline;
    color: #2563eb;
}

/* Back Button */
.auth-back-btn {
    background: none;
    border: none;
    color: #3b82f6;
    font-size: 13px;
    cursor: pointer;
    padding: 8px;
    text-decoration: none;
    transition: color 0.2s;
    width: 100%;
    text-align: center;
}

.auth-back-btn:hover {
    text-decoration: underline;
    color: #2563eb;
}

/* Forgot Password Description */
.forgot-description {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 16px;
    line-height: 1.5;
}

/* Divider */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 24px;
    color: #9ca3af;
    font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background-color: #e5e7eb;
}

/* Social Buttons */
.auth-social-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 0 24px 24px;
}

.social-btn {
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background-color: white;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.social-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12);
}

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

.social-btn i {
    font-size: 18px;
}

.google-btn {
    border-color: #ea4335;
    color: #ea4335;
}

.google-btn:hover:not(:disabled) {
    background-color: #fef2f2;
    border-color: #dc2626;
}

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

.facebook-btn:hover:not(:disabled) {
    background-color: #eff6ff;
    border-color: #1d4ed8;
}

/* Error Message */
.auth-error {
    background-color: #fee2e2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    padding: 12px;
    color: #991b1b;
    font-size: 13px;
    margin: 0 24px 16px;
    text-align: right;
}

/* User Menu Styles */
.user-menu {
    display: none;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    position: relative;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    background-color: #f3f4f6;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    color: #111827;
}

.user-menu:hover {
    opacity: 0.8;
}

/* User Dropdown Menu */
.user-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    min-width: 240px;
    margin-top: 8px;
    z-index: 1001;
    direction: rtl;
    animation: slideDown 0.2s ease;
    white-space: nowrap;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Dropdown Header */
.user-dropdown-header {
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-direction: row-reverse;
}

.dropdown-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background-color: #f3f4f6;
}

.dropdown-user-info {
    display: flex;
    flex-direction: column;
    text-align: right;
}

.dropdown-user-name {
    font-size: 13px;
    font-weight: 600;
    color: #111827;
}

.dropdown-user-score {
    font-size: 12px;
    color: #6b7280;
}

/* Dropdown Items */
.user-dropdown-items {
    padding: 8px 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: none;
    border: none;
    color: #111827;
    font-size: 14px;
    cursor: pointer;
    width: 100%;
    text-align: right;
    text-decoration: none;
    transition: background-color 0.2s;
    flex-direction: row-reverse;
}

.dropdown-item:hover {
    background-color: #f3f4f6;
}

.dropdown-item i {
    font-size: 16px;
    color: #6b7280;
}

.logout-btn {
    border-top: 1px solid #e5e7eb;
    margin-top: 8px;
    padding-top: 10px;
    color: #ef4444;
}

.logout-btn i {
    color: #ef4444;
}

.logout-btn:hover {
    background-color: #fee2e2;
}

/* Auth Buttons Container */
#auth-buttons {
    display: flex;
    gap: 8px;
}

.auth-action-btn {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background-color: white;
    color: #111827;
    cursor: pointer;
    transition: all 0.2s;
}

.auth-action-btn:hover {
    background-color: #f3f4f6;
    border-color: #9ca3af;
}

.auth-action-btn.primary {
    background-color: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.auth-action-btn.primary:hover {
    background-color: #2563eb;
    border-color: #2563eb;
}

/* Responsive Design */
@media (max-width: 480px) {
    .auth-modal {
        width: 95%;
        max-width: 100%;
        border-radius: 8px;
    }

    .auth-modal-header {
        padding: 24px 20px 12px;
    }

    .auth-modal-header h2 {
        font-size: 20px;
    }

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

    .auth-tab-content {
        padding: 20px;
    }

    .auth-divider {
        margin: 12px 20px;
    }

    .auth-social-buttons {
        padding: 0 20px 24px;
        gap: 10px;
    }

    .social-btn {
        padding: 14px 12px;
        font-size: 13px;
    }

    .social-btn span {
        display: inline;
    }

}

/* Loading Spinner */
.fa-spinner {
    animation: spin 1s linear infinite;
}

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

    to {
        transform: rotate(360deg);
    }
}

/* Focus Styles for Accessibility */
.auth-submit-btn:focus,
.social-btn:focus,
.form-group input:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Print Styles */
@media print {

    .auth-modal-overlay,
    .user-dropdown-menu {
        display: none;
    }
}