/* Arabic Math Tutor - Custom Styles */

/* ===========================================
   NEW COLOR SCHEME - Modern Vibrant Colors
   =========================================== */
:root {
    --primary: #6366F1;           /* Vibrant Indigo */
    --secondary: #8B5CF6;         /* Purple */
    --success: #10B981;           /* Emerald */
    --warning: #F59E0B;           /* Amber */
    --error: #EF4444;             /* Red */
    --gradient-start: #6366F1;    /* Indigo */
    --gradient-middle: #8B5CF6;   /* Purple */
    --gradient-end: #EC4899;      /* Pink */
}

/* ===========================================
   GLASS-MORPHISM CARDS - Phase 2 Feature
   =========================================== */

/* Base Glass-morphism Card */
.glass-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    border-radius: 1rem;
    transition: all 0.3s ease;
    will-change: transform, box-shadow, background;
}

/* Glass Card Hover Effects */
.glass-card:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.45);
}

/* Glass Card Variants for Different Backgrounds */
.glass-card-light {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.25);
    border-radius: 1rem;
    transition: all 0.3s ease;
}

.glass-card-light:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: translateY(-2px);
    box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.35);
}

/* Glass Card for Dark Backgrounds */
.glass-card-dark {
    background: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    border-radius: 1rem;
    transition: all 0.3s ease;
}

.glass-card-dark:hover {
    background: rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.4);
}

/* Glass Modal Backdrop */
.glass-modal-backdrop {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

/* Glass Modal Content */
.glass-modal-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 20px 60px 0 rgba(31, 38, 135, 0.3);
    border-radius: 1.5rem;
}

/* Performance Optimizations */
@supports not (backdrop-filter: blur(10px)) {
    .glass-card {
        background: rgba(255, 255, 255, 0.9);
        border: 1px solid rgba(0, 0, 0, 0.1);
    }
    
    .glass-card-light {
        background: rgba(255, 255, 255, 0.95);
        border: 1px solid rgba(0, 0, 0, 0.1);
    }
    
    .glass-modal-content {
        background: rgba(255, 255, 255, 0.98);
        border: 1px solid rgba(0, 0, 0, 0.1);
    }
}

/* ===========================================
   END OF GLASS-MORPHISM SECTION
   =========================================== */

/* ===========================================
   MODERN CARD DESIGN WITH DEPTH - Priority 1
   =========================================== */

/* Smooth everything - Global transitions */
* {
    transition: all 0.3s ease;
}

/* Modern Card Base Styles */
.card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1);
}

/* Enhanced Card with Glass Morphism */
.enhanced-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.enhanced-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1);
}

/* Better buttons with ripple effect */
button {
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

button:active::after {
    width: 300px;
    height: 300px;
}

button:hover {
    transform: translateY(-2px);
}

/* Glass morphism for modals */
.modal-backdrop {
    backdrop-filter: blur(8px);
    background: rgba(0,0,0,0.4);
}

/* Section Cards - Apply modern design to existing sections */
.welcome-card,
.curriculum-card,
.topic-selection-card,
.problem-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    transition: all 0.3s ease;
}

.welcome-card:hover,
.curriculum-card:hover,
.topic-selection-card:hover,
.problem-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1);
}

/* Module cards for dual-module layout */
.module-card {
    border-radius: 16px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    position: relative;
    overflow: hidden;
}

.module-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 25px -5px rgb(0 0 0 / 0.15);
}

.module-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.module-card:hover::before {
    opacity: 1;
}

/* Feature cards with gradient backgrounds */
.feature-card {
    border-radius: 12px;
    padding: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px -1px rgb(0 0 0 / 0.1);
}

.feature-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px -3px rgb(0 0 0 / 0.1);
}

/* Curriculum overview cards */
.curriculum-item {
    border-radius: 12px;
    padding: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px -1px rgb(0 0 0 / 0.1);
}

.curriculum-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px -3px rgb(0 0 0 / 0.1);
}

/* Difficulty selector cards */
.difficulty-card {
    border-radius: 12px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid;
}

.difficulty-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px -3px rgb(0 0 0 / 0.1);
}

/* Simplified difficulty card hover effects */
.difficulty-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px -3px rgb(0 0 0 / 0.1);
}

/* Problem section cards */
.problem-section-card {
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px -1px rgb(0 0 0 / 0.1);
}

.problem-section-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px -3px rgb(0 0 0 / 0.1);
}

/* Modal enhancements */
.modal-content {
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1);
    overflow: hidden;
}

/* Mobile improvements */
@media (max-width: 768px) {
    .card,
    .enhanced-card {
        margin-bottom: 16px;
    }
    
    /* Module cards responsive behavior */
    .module-card {
        padding: 1.25rem;
        margin-bottom: 1rem;
    }
    
    .module-card h3 {
        font-size: 1.125rem;
        margin-bottom: 0.75rem;
    }
    
    .module-card p {
        font-size: 0.875rem;
        margin-bottom: 1rem;
    }
    
    .module-card button {
        font-size: 1rem;
        padding: 0.75rem 1.5rem;
    }
    
    /* Feature cards on mobile */
    .feature-card {
        padding: 0.75rem;
    }
    
    button {
        margin-bottom: 12px;
    }
    
    .difficulty-selector {
        grid-template-columns: 1fr;
    }
}

/* ===========================================
   END OF MODERN CARD DESIGN SECTION
   =========================================== */


/* RTL Improvements */
html[dir="rtl"] {
    text-align: right;
}

/* Arabic Typography Enhancements */
.font-arabic {
    font-family: 'Noto Kufi Arabic', 'Arial', sans-serif;
    font-feature-settings: "kern" 1, "liga" 1;
    text-rendering: optimizeLegibility;
}

/* Improved Arabic Number Styling */
.arabic-numbers {
    font-variant-numeric: proportional-nums;
}

/* Specific problem section backgrounds with high specificity */
#problem-container .bg-blue-50,
#problem-container div.bg-blue-50,
div#problem-container .bg-blue-50 {
    background-color: #eff6ff !important;
    border-left: 4px solid #3b82f6 !important;
}

#problem-container .bg-green-50,
#problem-container div.bg-green-50,
div#problem-container .bg-green-50 {
    background-color: #ecfdf5 !important;
    border-left: 4px solid #10b981 !important;
}

#problem-container .bg-yellow-50,
#problem-container div.bg-yellow-50,
div#problem-container .bg-yellow-50 {
    background-color: #fffbeb !important;
    border-left: 4px solid #f59e0b !important;
}

/* Text color fixes for problem sections */
#problem-container .text-blue-900,
div.bg-blue-50 .text-blue-900,
div.bg-blue-50 h3 {
    color: #1e3a8a !important;
}

#problem-container .text-green-900,
div.bg-green-50 .text-green-900,
div.bg-green-50 h3 {
    color: #14532d !important;
}

#problem-container .text-yellow-900,
div.bg-yellow-50 .text-yellow-900,
div.bg-yellow-50 h3 {
    color: #78350f !important;
}

/* Content text colors */
#problem-container .text-gray-800,
div.bg-blue-50 .text-gray-800,
div.bg-green-50 .text-gray-800,
div.bg-yellow-50 .text-gray-800 {
    color: #1f2937 !important;
}

/* Fallback color classes */
.bg-blue-50 {
    background-color: #eff6ff !important;
    color: #1e40af !important;
}

.bg-green-50 {
    background-color: #ecfdf5 !important;
    color: #065f46 !important;
}

.bg-yellow-50 {
    background-color: #fffbeb !important;
    color: #92400e !important;
}

.text-blue-900 {
    color: #1e3a8a !important;
}

.text-green-900 {
    color: #14532d !important;
}

.text-yellow-900 {
    color: #78350f !important;
}

.text-gray-800 {
    color: #1f2937 !important;
}

/* Problem container styling */
#problem-container {
    background-color: white !important;
    color: #374151 !important;
}

/* Math content specific styling */
.math-content {
    background-color: transparent !important;
    color: inherit !important;
}

/* Individual section styling for maximum specificity */
div[id="question"].math-content {
    color: #1f2937 !important;
}

div[id="solution"].math-content {
    color: #1f2937 !important;
}

div[id="answer"].math-content {
    color: #1f2937 !important;
}

/* Legacy button styles integrated into modern design above */

/* Math Content Styling */
.math-content { 
    font-family: 'Noto Kufi Arabic', 'STIX Two Math', 'Times New Roman', serif;
    line-height: 1.8;
}

/* MathJax Styling */
.MathJax_Display {
    direction: ltr !important;
    text-align: center !important;
    margin: 1em 0 !important;
}

.MathJax {
    font-size: inherit !important;
    color: inherit !important;
}

/* Inline math alignment for RTL */
.MathJax_Preview {
    color: inherit !important;
}

mjx-container[jax="CHTML"] {
    direction: ltr !important;
    display: inline-block !important;
    margin: 0 0.125em !important;
}

mjx-container[jax="CHTML"][display="true"] {
    display: block !important;
    text-align: center !important;
    margin: 1em 0 !important;
}

/* Math content within problem sections */
.math-content mjx-container {
    color: inherit !important;
}

#question mjx-container,
#solution mjx-container,
#answer mjx-container {
    color: inherit !important;
    font-size: inherit !important;
}

/* Loading Animation */
.loading {
    animation: pulse 2s infinite;
}

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

/* Responsive Text */
@media (max-width: 640px) {
    .text-responsive {
        font-size: 0.9rem;
    }
}

/* Custom Scrollbar for Arabic content */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

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

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Enhanced Print Styles */
@media print {
    /* Hide elements that shouldn't be printed */
    .no-print,
    header,
    footer,
    nav,
    button,
    .action-btn,
    #error-message,
    #loader,
    form,
    #topic-selection-form {
        display: none !important;
    }
    
    /* Page setup */
    * {
        -webkit-print-color-adjust: exact !important;
        color-adjust: exact !important;
    }
    
    @page {
        margin: 2cm;
        size: A4;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.6;
        color: #000;
        background: white;
        font-family: 'Noto Kufi Arabic', Arial, sans-serif;
    }
    
    /* Problem container */
    #problem-container {
        display: block !important;
        background: white;
        box-shadow: none;
        border-radius: 0;
        padding: 0;
        margin: 0;
        page-break-inside: avoid;
    }
    
    /* Math content */
    .math-content {
        font-size: 14pt;
        line-height: 1.8;
        background: white !important;
        color: #000 !important;
        padding: 0.5cm;
        border: 1pt solid #ccc;
        border-radius: 0;
        margin: 0.5cm 0;
        page-break-inside: avoid;
    }
    
    /* Question section */
    .bg-blue-50 {
        background: #f8f9fa !important;
        border-right: 4pt solid #2563eb;
        padding: 0.5cm;
    }
    
    /* Solution section */
    .bg-green-50 {
        background: #f0f9ff !important;
        border-right: 4pt solid #10b981;
        padding: 0.5cm;
        margin-top: 1cm;
    }
    
    /* Answer section */
    .bg-yellow-50 {
        background: #fffbeb !important;
        border-right: 4pt solid #f59e0b;
        padding: 0.5cm;
        margin-top: 0.5cm;
    }
    
    /* Section headers */
    h3 {
        font-size: 16pt;
        font-weight: bold;
        margin-bottom: 0.3cm;
        color: #000;
        page-break-after: avoid;
    }
    
    /* Page breaks */
    .page-break {
        page-break-before: always;
    }
    
    /* Text formatting */
    strong {
        font-weight: bold;
        color: #000;
    }
    
    em {
        background: #f0f0f0 !important;
        padding: 2pt 4pt;
        border: none;
    }
    
    /* Ensure proper text direction */
    html[dir="rtl"] * {
        text-align: right;
        direction: rtl;
    }
    
    /* Print header */
    #problem-container::before {
        content: "الأستاذ الرقمي للرياضيات - الصف العاشر";
        display: block;
        font-size: 18pt;
        font-weight: bold;
        text-align: center;
        margin-bottom: 1cm;
        padding-bottom: 0.5cm;
        border-bottom: 2pt solid #000;
    }
    
    /* Print footer */
    #problem-container::after {
        content: "تم الطباعة من: الأستاذ الرقمي للرياضيات";
        display: block;
        font-size: 10pt;
        text-align: center;
        margin-top: 1cm;
        padding-top: 0.5cm;
        border-top: 1pt solid #000;
        color: #666;
    }
}

/* Focus and selection styles */
button:focus,
input:focus,
select:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* Message styles */
.message-success {
    background-color: #d1fae5;
    border-color: #10b981;
    color: #065f46;
    padding: 12px;
    border-radius: 8px;
    border-width: 1px;
}

.message-error {
    background-color: #fee2e2;
    border-color: #ef4444;
    color: #991b1b;
    padding: 12px;
    border-radius: 8px;
    border-width: 1px;
}

/* Animations */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

/* Math content improvements */
.math-content {
    word-wrap: break-word;
    overflow-wrap: break-word;
    direction: rtl;
    text-align: right;
}

.math-content strong {
    font-weight: 600;
    color: inherit;
}

.math-content em {
    background-color: #fef3c7;
    padding: 2px 4px;
    border-radius: 4px;
    font-style: normal;
    font-weight: 500;
}

/* Form styling improvements */
select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: left 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-left: 2.5rem;
}

html[dir="rtl"] select {
    background-position: right 0.5rem center;
    padding-right: 2.5rem;
    padding-left: 1rem;
}

/* Radio button styling */
.difficulty-selector input[type="radio"]:checked + div {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Loading spinner */
.loading-spinner {
    border: 4px solid #f3f4f6;
    border-top: 4px solid #2563eb;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

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

/* Problem sections */
.problem-section {
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
}

.problem-section:hover {
    border-left-color: #2563eb;
    transform: translateX(-2px);
}

/* Specific section styling */
.question-section {
    border-left-color: #3b82f6;
}

.solution-section {
    border-left-color: #10b981;
}

.answer-section {
    border-left-color: #f59e0b;
}

/* Action buttons styling */
.action-btn {
    position: relative;
    overflow: hidden;
}

.action-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

.action-btn:hover::before {
    width: 100%;
    height: 100%;
}

/* Success animation */
.success-animation {
    animation: successPulse 0.6s ease-in-out;
}

@keyframes successPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .math-content {
        font-size: 16px;
        line-height: 1.6;
    }
    
    .grid-cols-3 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .difficulty-selector label div {
        padding: 0.75rem;
    }
    
    .action-btn {
        font-size: 14px;
        padding: 8px 16px;
    }
    
    /* Header improvements for mobile */
    .timer-display,
    .points-summary {
        min-width: auto;
        flex-shrink: 0;
    }
    
    /* Responsive spacing */
    .container {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    
    /* Button improvements */
    button {
        min-height: 44px; /* Minimum touch target size */
        touch-action: manipulation;
    }
    
    /* Form elements */
    select {
        min-height: 44px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    /* Modal improvements */
    .modal-content {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .container {
        padding-left: 0.25rem;
        padding-right: 0.25rem;
    }
    
    .timer-display,
    .points-summary {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .topic-selection-card {
        padding: 0.75rem !important;
    }
    
    .difficulty-card {
        padding: 0.5rem !important;
    }
    
    /* Improve touch targets */
    .difficulty-card {
        min-height: 60px;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    .fade-in,
    button,
    .problem-section {
        animation: none;
        transition: none;
    }
    
    .action-btn::before {
        transition: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .math-content {
        border: 2px solid #000;
    }
    
    button {
        border: 2px solid currentColor;
    }
}

/* Override dark mode interference - keep at the end */
@media (prefers-color-scheme: dark) {
    /* Force light theme for the app */
    body, #problem-container {
        background-color: white !important;
        color: #374151 !important;
    }
    
    /* Ensure section backgrounds are visible */
    #problem-container .bg-blue-50 {
        background-color: #eff6ff !important;
        color: #1e3a8a !important;
    }
    
    #problem-container .bg-green-50 {
        background-color: #ecfdf5 !important;
        color: #14532d !important;
    }
    
    #problem-container .bg-yellow-50 {
        background-color: #fffbeb !important;
        color: #78350f !important;
    }
}

/* Performance optimized CSS for Arabic Math Tutor */

/* Critical performance styles - loaded inline in HTML */
/* Additional non-critical styles below */

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

/* Optimize font rendering */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Performance: Use transform for animations instead of changing layout properties */
.hover-scale {
    transition: transform 0.2s ease;
}

.hover-scale:hover {
    transform: scale(1.05);
}

/* Optimize images and media */
img {
    max-width: 100%;
    height: auto;
}

/* Print styles - hide non-essential elements */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
    }
    
    .math-content {
        font-size: 11pt;
    }
}

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

/* Optimize math content rendering */
.math-content {
    /* Prevent layout shift during MathJax rendering */
    min-height: 1.2em;
}

/* Performance: Use CSS transforms for modal animations */
.modal-enter {
    opacity: 0;
    transform: scale(0.9);
}

.modal-enter-active {
    opacity: 1;
    transform: scale(1);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Reduce repaints with will-change for animated elements */
.animate-spin {
    will-change: transform;
}

/* Optimize button interactions */
button {
    -webkit-tap-highlight-color: transparent;
}

/* Accessible focus indicators */
button:focus,
select:focus,
input:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* Performance hint: contain layout for cards */
.card {
    contain: layout style;
}

/* Arabic text optimization */
.arabic-text {
    direction: rtl;
    text-align: right;
    unicode-bidi: embed;
}

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

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

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

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

/* Responsive design helpers */
@media (max-width: 768px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    .text-2xl {
        font-size: 1.25rem;
    }
}

/* Performance: Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Dark mode support for better accessibility */
@media (prefers-color-scheme: dark) {
    /* This would be implemented if dark mode is needed */
}

/* Performance: Optimize for high DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* High DPI optimizations if needed */
} 