/**
 * Auth Modal Styles
 * Premium, Modern Authentication Modal Design
 * Features: Glassmorphism, Gradients, Micro-animations
 */

/* ============================================
   AUTH MODAL - Base Styling
   ============================================ */

#authModal .modal-dialog {
    max-width: 420px;
}

#authModal .modal-content {
    border: none;
    border-radius: 24px;
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    overflow: hidden;
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    animation: modalSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ============================================
   MODAL HEADER - Tab Navigation
   ============================================ */

#authModal .modal-header {
    border-bottom: none;
    padding: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
}

#authModal .modal-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {

    0%,
    100% {
        transform: rotate(0deg);
    }

    50% {
        transform: rotate(180deg);
    }
}

#authModal .nav-tabs {
    border: none;
    position: relative;
    z-index: 1;
    padding: 1rem 1rem 0 1rem;
}

#authModal .nav-tabs .nav-item {
    flex: 1;
}

#authModal .nav-tabs .nav-link {
    border: none;
    border-radius: 16px 16px 0 0;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 1rem 1.5rem;
    transition: all 0.3s ease;
    background: transparent;
    position: relative;
    overflow: hidden;
}

#authModal .nav-tabs .nav-link::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 3px;
    background: #fff;
    transform: translateX(-50%);
    transition: width 0.3s ease;
    border-radius: 3px 3px 0 0;
}

#authModal .nav-tabs .nav-link:hover {
    color: rgba(255, 255, 255, 0.9);
}

#authModal .nav-tabs .nav-link.active {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.05) 100%);
    color: #fff;
}

#authModal .nav-tabs .nav-link.active::before {
    width: 60%;
}

#authModal .nav-tabs .nav-link i {
    transition: transform 0.3s ease;
}

#authModal .nav-tabs .nav-link:hover i {
    transform: scale(1.1);
}

#authModal .btn-close {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 10;
    filter: brightness(0) invert(1);
    opacity: 0.7;
    transition: all 0.3s ease;
    padding: 0.5rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
}

#authModal .btn-close:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

/* ============================================
   MODAL BODY - Form Styling
   ============================================ */

#authModal .modal-body {
    padding: 2rem;
}

#authModal .form-label {
    font-weight: 600;
    color: #374151;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

#authModal .form-control {
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background: #f9fafb;
}

#authModal .form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
    background: #fff;
}

#authModal .form-control::placeholder {
    color: #9ca3af;
}

/* Input Group Styling - RTL Layout (input first, then icon) */
#authModal .input-group {
    position: relative;
    flex-wrap: nowrap;
}

/* Standard input group: [input] [icon] - In RTL this displays as [icon] [input] visually */
#authModal .input-group .form-control {
    border: 2px solid #e5e7eb;
    border-left: none;
    border-radius: 0 12px 12px 0;
}

#authModal .input-group .input-group-text {
    border: 2px solid #e5e7eb;
    border-right: none;
    border-radius: 12px 0 0 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
    min-width: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#authModal .input-group:focus-within .input-group-text {
    border-color: #667eea;
}

#authModal .input-group:focus-within .form-control {
    border-color: #667eea;
    box-shadow: none;
}

/* Captcha Group Styling: [input] [captcha image] [refresh button] in HTML, displays as [button] [image] [input] in RTL */
#authModal .captcha-group .form-control {
    border-radius: 0 12px 12px 0;
    border-left: none;
    flex: 1;
}

#authModal .captcha-group .captcha-container {
    border-radius: 0;
    background: #fff !important;
    border: 2px solid #e5e7eb;
    border-left: none;
    border-right: none;
    padding: 0 !important;
}

#authModal .captcha-group .captcha-img {
    height: 42px;
    border-radius: 0;
    display: block;
}

#authModal .captcha-group .btn-refresh {
    border: 2px solid #e5e7eb;
    border-right: none;
    border-radius: 12px 0 0 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: #fff !important;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
}

#authModal .captcha-group .btn-refresh:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%) !important;
    border-color: #667eea;
}

#authModal .captcha-group .btn-refresh:hover i {
    animation: spin 0.5s ease;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

#authModal .captcha-group:focus-within .form-control,
#authModal .captcha-group:focus-within .captcha-container,
#authModal .captcha-group:focus-within .btn-refresh {
    border-color: #667eea;
}

/* Checkbox Styling */
#authModal .form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    transition: all 0.2s ease;
}

#authModal .form-check-input:checked {
    background-color: #667eea;
    border-color: #667eea;
}

#authModal .form-check-input:focus {
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
}

#authModal .form-check-label {
    color: #6b7280;
    font-size: 0.9rem;
    padding-right: 0.5rem;
}

/* Forgot Password Link */
#authModal .text-decoration-none.small {
    color: #667eea;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

#authModal .text-decoration-none.small:hover {
    color: #764ba2;
    text-decoration: underline !important;
}

/* ============================================
   SUBMIT BUTTONS - Gradient & Animation
   ============================================ */

#authModal .btn-primary,
#authModal .btn-success {
    border: none;
    border-radius: 14px;
    font-weight: 600;
    font-size: 1rem;
    padding: 0.875rem 2rem;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

#authModal .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

#authModal .btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

#authModal .btn-primary::before,
#authModal .btn-success::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.2),
            transparent);
    transition: left 0.5s ease;
}

#authModal .btn-primary:hover::before,
#authModal .btn-success:hover::before {
    left: 100%;
}

#authModal .btn-primary:hover,
#authModal .btn-success:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px -5px rgba(102, 126, 234, 0.4);
}

#authModal .btn-success:hover {
    box-shadow: 0 10px 25px -5px rgba(16, 185, 129, 0.4);
}

#authModal .btn-primary:active,
#authModal .btn-success:active {
    transform: translateY(-1px);
}

/* Loading Spinner */
#authModal .spinner-border {
    width: 1.25rem;
    height: 1.25rem;
    border-width: 2px;
}

/* ============================================
   ERROR ALERTS - Styled Alerts
   ============================================ */

#authModal .alert-danger {
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #fef2f2 0%, #fecaca 100%);
    color: #991b1b;
    padding: 1rem;
    font-size: 0.9rem;
    border-right: 4px solid #ef4444;
}

#authModal .alert-danger strong {
    color: #7f1d1d;
}

#authModal .alert-danger ul {
    margin-bottom: 0;
    font-size: 0.85rem;
}

/* ============================================
   SOCIAL LOGIN - Google Button
   ============================================ */

.auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.5rem 0;
    color: #9ca3af;
    font-size: 0.85rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, #e5e7eb, transparent);
}

.auth-divider::before {
    margin-left: 1rem;
}

.auth-divider::after {
    margin-right: 1rem;
}

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.875rem 1.5rem;
    border: 2px solid #e5e7eb;
    border-radius: 14px;
    background: #fff;
    color: #374151;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-google:hover {
    border-color: #4285f4;
    background: #f8fafc;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px -5px rgba(66, 133, 244, 0.3);
    color: #374151;
}

.btn-google:active {
    transform: translateY(0);
}

.btn-google .google-icon {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.btn-google:hover .google-icon {
    transform: scale(1.1);
}

/* Google Icon SVG Colors */
.btn-google svg {
    flex-shrink: 0;
}

/* ============================================
   DARK MODE SUPPORT
   ============================================ */

[data-theme="dark"] #authModal .modal-content {
    background: linear-gradient(145deg, #1f2937 0%, #111827 100%);
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] #authModal .form-label {
    color: #e5e7eb;
}

[data-theme="dark"] #authModal .form-control {
    background: #374151;
    border-color: #4b5563;
    color: #f3f4f6;
}

[data-theme="dark"] #authModal .form-control:focus {
    background: #4b5563;
    border-color: #667eea;
}

[data-theme="dark"] #authModal .form-control::placeholder {
    color: #6b7280;
}

[data-theme="dark"] #authModal .input-group .input-group-text {
    border-color: #4b5563;
}

[data-theme="dark"] #authModal .captcha-group .captcha-container {
    background: #374151 !important;
    border-color: #4b5563;
}

[data-theme="dark"] #authModal .captcha-group .btn-refresh {
    border-color: #4b5563;
}

[data-theme="dark"] #authModal .form-check-input {
    background-color: #374151;
    border-color: #4b5563;
}

[data-theme="dark"] #authModal .form-check-label {
    color: #9ca3af;
}

[data-theme="dark"] #authModal .alert-danger {
    background: linear-gradient(135deg, #450a0a 0%, #7f1d1d 100%);
    color: #fecaca;
    border-right-color: #dc2626;
}

[data-theme="dark"] #authModal .alert-danger strong {
    color: #fef2f2;
}

[data-theme="dark"] .btn-google {
    background: #374151;
    border-color: #4b5563;
    color: #e5e7eb;
}

[data-theme="dark"] .btn-google:hover {
    background: #4b5563;
    border-color: #4285f4;
    color: #f3f4f6;
}

[data-theme="dark"] .auth-divider {
    color: #6b7280;
}

[data-theme="dark"] .auth-divider::before,
[data-theme="dark"] .auth-divider::after {
    background: linear-gradient(90deg, transparent, #4b5563, transparent);
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */

@media (max-width: 576px) {
    #authModal .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }

    #authModal .modal-content {
        border-radius: 20px;
    }

    #authModal .modal-body {
        padding: 1.5rem;
    }

    #authModal .nav-tabs {
        padding: 0.75rem 0.75rem 0 0.75rem;
    }

    #authModal .nav-tabs .nav-link {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    #authModal .btn-primary,
    #authModal .btn-success {
        padding: 0.75rem 1.5rem;
        font-size: 0.95rem;
    }

    .btn-google {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
}

/* ============================================
   FORM FIELD ANIMATIONS
   ============================================ */

#authModal .mb-3 {
    animation: fadeInUp 0.4s ease forwards;
    opacity: 0;
}

#authModal .mb-3:nth-child(1) {
    animation-delay: 0.1s;
}

#authModal .mb-3:nth-child(2) {
    animation-delay: 0.15s;
}

#authModal .mb-3:nth-child(3) {
    animation-delay: 0.2s;
}

#authModal .mb-3:nth-child(4) {
    animation-delay: 0.25s;
}

#authModal .mb-3:nth-child(5) {
    animation-delay: 0.3s;
}

#authModal .mb-3:nth-child(6) {
    animation-delay: 0.35s;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#authModal .row {
    animation: fadeInUp 0.4s ease forwards;
    animation-delay: 0.1s;
    opacity: 0;
}

/* Tab Panel Transitions */
#authModal .tab-pane {
    transition: opacity 0.3s ease;
}

#authModal .tab-pane.show {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Focus Ring Enhancement */
#authModal input:focus,
#authModal button:focus {
    outline: none;
}

/* ============================================
   PASSWORD VISIBILITY TOGGLE
   ============================================ */

/* Password input group container */
#authModal .password-input-group {
    position: relative;
}

#authModal .password-input-group .form-control {
    padding-left: 45px;
    /* Space for the eye button on the left in RTL */
}

/* Password toggle button */
#authModal .btn-password-toggle {
    position: absolute;
    left: 50px;
    /* Positioned after the lock icon in RTL */
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 0.5rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#authModal .btn-password-toggle:hover {
    color: #667eea;
}

#authModal .btn-password-toggle:focus {
    outline: none;
    color: #667eea;
}

#authModal .btn-password-toggle i {
    font-size: 1rem;
    transition: transform 0.2s ease;
}

#authModal .btn-password-toggle:hover i {
    transform: scale(1.1);
}

/* Active state when password is visible */
#authModal .btn-password-toggle.active {
    color: #667eea;
}

/* Dark mode password toggle */
[data-theme="dark"] #authModal .btn-password-toggle {
    color: #6b7280;
}

[data-theme="dark"] #authModal .btn-password-toggle:hover,
[data-theme="dark"] #authModal .btn-password-toggle.active {
    color: #a78bfa;
}

/* Input Validation States */
#authModal .form-control.is-invalid {
    border-color: #ef4444;
    background-image: none;
}

#authModal .form-control.is-invalid:focus {
    border-color: #ef4444;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15);
}

#authModal .form-control.is-valid {
    border-color: #10b981;
    background-image: none;
}

#authModal .form-control.is-valid:focus {
    border-color: #10b981;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.15);
}