/* Custom styles for Spirit Qalaid */

/* Arabic Font */
@font-face {
    font-family: 'LPMQ IsepMisbah';
    src: url('../LPMQ IsepMisbah.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

/* Arabic text styling */
.arabic-text {
    font-family: 'LPMQ IsepMisbah', 'Amiri', 'Scheherazade New', serif;
    font-size: 1.25rem;
    line-height: 1.8;
    text-align: right;
    direction: rtl;
    color: #1f2937;
}

/* Chat container styling */
.chat-container {
    height: calc(100vh - 200px); /* Adjust based on dashboard header height */
    display: flex;
    flex-direction: column;
    min-height: 400px;
}

.chat-messages {
    flex: 1;
    overflow-y: scroll; /* Force scrollbar to always show */
    overflow-x: hidden;
    padding: 1rem;
    background-color: #f9fafb;
    min-height: 0; /* Important for flex child to shrink */
    max-height: calc(100vh - 300px); /* Ensure it doesn't exceed viewport */
    display: flex;
    flex-direction: column;
    /* Remove justify-content: flex-end so messages start from top */
}

.chat-input-area {
    flex-shrink: 0;
    background-color: white;
    border-top: 1px solid #e5e7eb;
    padding: 1rem;
    position: sticky;
    bottom: 0;
    z-index: 10;
}

/* Custom scrollbar for chat messages */
.chat-messages::-webkit-scrollbar {
    width: 8px; /* Make scrollbar slightly wider for better visibility */
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #10b981; /* Use emerald color to match theme */
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #059669; /* Darker emerald on hover */
}

/* Firefox scrollbar styling */
.chat-messages {
    scrollbar-width: thin;
    scrollbar-color: #10b981 #f1f5f9;
}

/* Ensure scrollbar is always visible on all browsers */
.chat-messages {
    -ms-overflow-style: scrollbar; /* IE and Edge */
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Custom backdrop blur for older browsers */
.backdrop-blur-sm {
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.backdrop-blur-md {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* Loading animation */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Custom focus styles */
.focus-emerald:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
    border-color: #10b981;
}

/* Sidebar transitions */
.sidebar-transition {
    transition: transform 0.3s ease-in-out;
}

/* Page content transitions */
.page-content {
    transition: opacity 0.3s ease-in-out;
}

.page-content.hidden {
    opacity: 0;
    pointer-events: none;
}

.page-content:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

/* Navigation link styles */
.nav-link {
    transition: all 0.2s ease-in-out;
}

.nav-link.active {
    background-color: rgba(16, 185, 129, 0.2);
    color: white;
}

.nav-link:hover:not(.active) {
    background-color: rgba(16, 185, 129, 0.1);
}

/* Form input focus styles */
input:focus,
textarea:focus,
select:focus {
    outline: none;
    ring: 2px;
    ring-color: #10b981;
    border-color: #10b981;
}

/* Button hover effects */
.btn-emerald {
    background-color: #10b981;
    color: white;
    transition: all 0.2s ease-in-out;
}

.btn-emerald:hover {
    background-color: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-emerald:active {
    transform: translateY(0);
}

/* Card hover effects */
.card-hover {
    transition: all 0.3s ease-in-out;
}

.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* Gradient backgrounds */
.gradient-emerald {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.gradient-emerald-light {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
}

/* Text gradients */
.text-gradient-emerald {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .mobile-padding {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .mobile-text-sm {
        font-size: 0.875rem;
    }
    
    .mobile-hidden {
        display: none;
    }
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        background: white !important;
    }
    
    .bg-gradient-to-br {
        background: white !important;
    }
}

/* Accessibility improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus visible for keyboard navigation */
.focus-visible:focus-visible {
    outline: 2px solid #10b981;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .bg-emerald-600 {
        background-color: #047857;
    }
    
    .text-emerald-600 {
        color: #047857;
    }
    
    .border-emerald-300 {
        border-color: #047857;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    html {
        scroll-behavior: auto;
    }
}

/* Dark mode support (for future implementation) */
@media (prefers-color-scheme: dark) {
    .dark-mode-bg {
        background-color: #1f2937;
        color: #f9fafb;
    }
    
    .dark-mode-card {
        background-color: #374151;
        border-color: #4b5563;
    }
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #10b981;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Error states */
.error-shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Success states */
.success-pulse {
    animation: pulse 2s ease-in-out;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Utility classes */
.text-shadow {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.box-shadow-lg {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.border-gradient {
    border: 2px solid transparent;
    background: linear-gradient(white, white) padding-box,
                linear-gradient(135deg, #10b981, #059669) border-box;
}
