/* Custom styles for RTL and Arabic typography */

/* Ensure proper RTL layout */
body {
    direction: rtl;
    text-align: right;
}

/* Arabic font fallbacks */
.font-arabic {
    font-family: 'Tajawal', 'Cairo', 'Amiri', 'Tahoma', 'Arial', sans-serif;
}

/* Line clamp utilities for text truncation */
.line-clamp-1 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    line-clamp: 1;
}

.line-clamp-2 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}

.line-clamp-3 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
}

/* Product card hover effects */
.product-card {
    transition: all 0.3s ease;
    cursor: pointer;
}

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

/* Modal animations */
.modal-enter {
    animation: modalEnter 0.3s ease-out;
}

.modal-exit {
    animation: modalExit 0.3s ease-in;
}

@keyframes modalEnter {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes modalExit {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.9);
    }
}

/* Stripe Elements styling for RTL */
.StripeElement {
    box-sizing: border-box;
    height: 40px;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background-color: white;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    transition: box-shadow 150ms ease;
    direction: ltr; /* Keep payment fields LTR for international compatibility */
}

.StripeElement--focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    border-color: #3b82f6;
}

.StripeElement--invalid {
    border-color: #ef4444;
}

.StripeElement--webkit-autofill {
    background-color: #fefde8 !important;
}

/* Loading spinner */
.spinner {
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Custom scrollbar for modal */
.modal-content::-webkit-scrollbar {
    width: 6px;
}

.modal-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Price formatting */
.price {
    font-family: 'Tajawal', sans-serif;
    font-weight: 600;
}

/* Button hover effects */
.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

/* Responsive typography */
@media (max-width: 640px) {
    .text-4xl {
        font-size: 2rem;
        line-height: 2.5rem;
    }
    
    .text-2xl {
        font-size: 1.5rem;
        line-height: 2rem;
    }
}

/* Product grid responsive adjustments */
@media (max-width: 640px) {
    .products-grid {
        grid-template-columns: repeat(1, minmax(0, 1fr));
        gap: 1rem;
    }
}

@media (min-width: 641px) and (max-width: 1024px) {
    .products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1.5rem;
    }
}

/* Image lazy loading effect */
.image-loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* 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 states for keyboard navigation */
button:focus,
input:focus,
select:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .product-card {
        border: 2px solid #000;
    }
    
    .btn-primary {
        background: #000;
        color: #fff;
    }
    
    .btn-primary:hover {
        background: #333;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .product-card,
    .modal-enter,
    .modal-exit,
    .btn-primary {
        transition: none;
        animation: none;
    }
}

/* Print styles */
@media print {
    .modal,
    button,
    .sticky {
        display: none !important;
    }
    
    .product-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #000;
    }
    
    /* Order confirmation print styles */
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
    
    .bg-gray-50,
    .bg-blue-50,
    .bg-white {
        background: white !important;
    }
    
    .shadow-md {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }
    
    .text-primary-600,
    .text-blue-600,
    .text-green-600 {
        color: #000 !important;
    }
    
    .bg-green-100,
    .bg-blue-100,
    .bg-yellow-500,
    .bg-green-500 {
        background: #f0f0f0 !important;
        border: 1px solid #ccc;
    }
}
