/* ====================================
   Custom Auth Modal - Hebrew RTL
   ==================================== */

/* Auth Modal Overlay */
.auth-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.auth-modal-overlay.active {
    display: flex;
    opacity: 1;
}

/* Auth Modal */
.auth-modal {
    background: white;
    border-radius: 20px;
    max-width: 450px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
    position: relative;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
    direction: rtl;
}

.auth-modal-overlay.active .auth-modal {
    transform: scale(1) translateY(0);
}

/* Modal Header */
.auth-modal-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 30px;
    text-align: center;
    position: relative;
}

.auth-modal-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gold-gradient);
}

.auth-modal-header::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 30px;
    background: white;
    border-radius: 50% 50% 0 0 / 100% 100% 0 0;
}

.auth-modal-close {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.auth-modal-logo {
    width: 70px;
    height: 70px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.auth-modal-logo img {
    width: 50px;
    height: 50px;
    object-fit: contain;
}

.auth-modal-logo i {
    font-size: 2rem;
    color: var(--primary-color);
}

.auth-modal-header h2 {
    font-size: 1.5rem;
    margin: 0 0 5px;
    font-weight: 700;
}

.auth-modal-header p {
    margin: 0;
    opacity: 0.9;
    font-size: 0.95rem;
}

/* Modal Body */
.auth-modal-body {
    padding: 40px 30px 30px;
}

/* Auth Forms */
.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
    animation: fadeInUp 0.4s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.auth-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.95rem;
}

.auth-form-group label .required {
    color: #e74c3c;
}

.auth-input-wrapper {
    position: relative;
}

.auth-input-wrapper i {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1rem;
}

.auth-input {
    width: 100%;
    padding: 14px 45px 14px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    direction: rtl;
}

.auth-input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 4px rgba(26, 95, 122, 0.1);
}

.auth-input::placeholder {
    color: #aaa;
}

.auth-input.error {
    border-color: #e74c3c;
}

/* Password Toggle */
.password-toggle {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px;
    font-size: 1rem;
}

.password-toggle:hover {
    color: var(--primary-color);
}

/* Form Error */
.auth-error {
    color: #e74c3c;
    font-size: 0.85rem;
    margin-top: 6px;
    display: none;
}

.auth-error.show {
    display: block;
}

/* Submit Button */
.auth-submit-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 25px;
}

.auth-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(26, 95, 122, 0.35);
}

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

.auth-submit-btn .spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Switch Form */
.auth-switch {
    text-align: center;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    color: var(--text-muted);
}

.auth-switch a {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

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

/* Social Login Divider */
.auth-divider {
    display: flex;
    align-items: center;
    margin: 25px 0;
}

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

.auth-divider span {
    padding: 0 15px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Google Button */
.auth-google-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px 20px;
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    color: #444;
    cursor: pointer;
    transition: all 0.3s ease;
}

.auth-google-btn:hover {
    background: #f8f9fa;
    border-color: #4285F4;
    box-shadow: 0 4px 15px rgba(66, 133, 244, 0.2);
    transform: translateY(-2px);
}

.auth-google-btn svg {
    flex-shrink: 0;
}

/* Message States */
.auth-message {
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: none;
    align-items: center;
    gap: 12px;
}

.auth-message.show {
    display: flex;
}

.auth-message.success {
    background: #e8f5e9;
    color: #2e7d32;
}

.auth-message.error {
    background: #ffebee;
    color: #c62828;
}

.auth-message.info {
    background: #e3f2fd;
    color: #1565c0;
}

.auth-message i {
    font-size: 1.2rem;
}

/* Confirmation Screen */
.auth-confirmation {
    text-align: center;
    padding: 20px 0;
    display: none;
}

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

.auth-confirmation-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: white;
    font-size: 2.5rem;
}

.auth-confirmation h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 1.4rem;
}

.auth-confirmation p {
    color: var(--text-muted);
    line-height: 1.6;
}

.auth-confirmation .email-highlight {
    display: inline-block;
    background: var(--gold-light);
    padding: 8px 15px;
    border-radius: 8px;
    font-weight: 600;
    color: var(--primary-color);
    margin: 15px 0;
}

.auth-resend {
    margin-top: 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.auth-resend a {
    color: var(--primary-color);
    cursor: pointer;
}

/* Logged In State */
.auth-logged-in {
    text-align: center;
    padding: 20px 0;
    display: none;
}

.auth-logged-in.active {
    display: block;
}

.auth-user-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.auth-user-avatar {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2.5rem;
}

.auth-user-name {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-color);
}

.auth-user-email {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.auth-logged-in-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    text-decoration: none;
}

.auth-action-btn.primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.auth-action-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(26, 95, 122, 0.35);
}

.auth-action-btn.secondary {
    background: var(--gold-light);
    color: var(--primary-color);
}

.auth-action-btn.secondary:hover {
    background: #e6d8b3;
}

.auth-action-btn.danger {
    background: #ffebee;
    color: #e74c3c;
}

.auth-action-btn.danger:hover {
    background: #ffcdd2;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .auth-modal {
        max-width: 100%;
        margin: 0 10px;
        border-radius: 15px;
    }
    
    .auth-modal-header {
        padding: 25px 20px;
    }
    
    .auth-modal-body {
        padding: 30px 20px 20px;
    }
    
    .auth-modal-header h2 {
        font-size: 1.3rem;
    }
    
    .auth-input {
        padding: 12px 40px 12px 12px;
        font-size: 0.95rem;
    }
    
    .auth-submit-btn {
        padding: 14px;
        font-size: 1rem;
    }
}

/* ====================================
   Fix Header User Menu Dropdown
   ==================================== */
   
/* Override - ensure dropdown opens below header */
.navbar .nav-auth {
    position: relative;
    z-index: 100;
}

.navbar .user-menu {
    position: relative;
}

.navbar .user-menu-dropdown {
    position: fixed !important;
    top: auto !important;
    left: auto;
    right: auto;
    z-index: 10001;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10002;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: white;
    padding: 15px 25px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    pointer-events: all;
    animation: toastIn 0.4s ease;
    direction: rtl;
}

.toast.success {
    border-right: 4px solid #27ae60;
    color: #27ae60;
}

.toast.error {
    border-right: 4px solid #e74c3c;
    color: #e74c3c;
}

.toast.info {
    border-right: 4px solid var(--primary-color);
    color: var(--primary-color);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.toast.fade-out {
    animation: toastOut 0.3s ease forwards;
}

@keyframes toastOut {
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}
