@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700&display=swap');
/* استيراد خط للأرقام الإنجليزية */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

body {
    font-family: 'Cairo', sans-serif;
    background-color: #f1f5f9;
}

/* كلاس مخصص لفرض الأرقام والتواريخ بالإنجليزية */
.en-text {
    font-family: 'Roboto', sans-serif !important;
    direction: ltr !important;
    unicode-bidi: embed;
}

/* تحسينات للموبايل */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="time"],
input[type="date"],
input[type="datetime-local"],
input[type="url"],
textarea,
select {
    font-size: 16px !important;
}

.view-section {
    display: none;
}

.active-view {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fab-btn {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
    z-index: 40;
}

.btn-loading {
    opacity: 0.7;
    pointer-events: none;
    cursor: not-allowed;
}

.filter-date-input {
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
    font-family: 'Roboto', sans-serif;
    /* لتظهر أرقام التاريخ بالإنجليزية داخل الفلتر */
}

/* AI Views Support */
#ai-chat-view,
#ai-settings-view {
    display: none;
}

#ai-chat-view.active-view,
#ai-settings-view.active-view {
    display: flex;
    /* Chat needs flex, others override to block if needed but flex column is good for chat */
}

#ai-settings-view.active-view {
    display: block;
    /* Settings page is standard block layout */
}

@keyframes fadeInBubble {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fadeIn {
    animation: fadeInBubble 0.3s ease-out forwards;
}

/* Smooth Scrolling */
.smooth-scroll {
    scroll-behavior: smooth;
}

/* Enhanced Loading Pulse */
.loading-pulse {
    animation: pulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Focus Ring for Better Accessibility */
.focus-ring:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.focus-ring:focus:not(:focus-visible) {
    outline: none;
}

/* RTL Input Support */
.rtl-input {
    direction: rtl;
    text-align: right;
}

.ltr-input {
    direction: ltr;
    text-align: left;
}

/* Better Button Loading State */
.btn-loading {
    position: relative;
    opacity: 0.7;
    pointer-events: none;
    cursor: not-allowed;
}

.btn-loading::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: inherit;
    animation: pulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Toast Notification Positioning */
.toast-container {
    position: fixed;
    top: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

[dir="rtl"] .toast-container {
    right: 20px;
}

[dir="ltr"] .toast-container {
    left: 20px;
}

.toast {
    pointer-events: auto;
    padding: 12px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease-out;
    max-width: 400px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

[dir="rtl"] @keyframes slideIn {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success {
    background: #10b981;
    color: white;
}

.toast.error {
    background: #ef4444;
    color: white;
}

.toast.info {
    background: #3b82f6;
    color: white;
}

.toast.warning {
    background: #f59e0b;
    color: white;
}

/* Improved Mobile Responsiveness */
@media (max-width: 768px) {
    .fab-btn {
        width: 50px;
        height: 50px;
        font-size: 24px;
        bottom: 15px;
        left: 15px;
    }

    /* Better touch targets */
    button,
    a,
    input[type="button"] {
        min-height: 44px;
        min-width: 44px;
    }

    /* Chat sidebar mobile optimization */
    #chat-sidebar {
        width: 60px;
    }

    /* Modal improvements */
    .modal-content {
        margin: 10px;
        max-height: calc(100vh - 20px);
        overflow-y: auto;
    }

    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: calc(100vw - 20px);
    }

    .toast {
        max-width: 100%;
    }
}

/* Form Validation Styles */
.input-error {
    border-color: #ef4444 !important;
    background-color: #fef2f2 !important;
}

.input-success {
    border-color: #10b981 !important;
    background-color: #f0fdf4 !important;
}

.error-message {
    color: #ef4444;
    font-size: 12px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.required-indicator {
    color: #ef4444;
    margin-inline-start: 2px;
}

/* Enhanced Empty States */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #9ca3af;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 14px;
    line-height: 1.5;
}

/* Improved Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Better keyboard focus for accessibility */
*:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}