/* Custom styles for Fashion Balance Analyzer */

/* Base styles */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* General section spacing for better UX */
section {
    margin-bottom: 3rem;
}

@media (min-width: 768px) {
    section {
        margin-bottom: 4rem;
    }
}

/* Arabic RTL support */
[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .flex {
    flex-direction: row-reverse;
}

[dir="rtl"] .space-x-4 > * + * {
    margin-left: 0;
    margin-right: 1rem;
}

[dir="rtl"] .space-x-2 > * + * {
    margin-left: 0;
    margin-right: 0.5rem;
}

/* Upload area animations */
#uploadArea {
    transition: all 0.3s ease;
}

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

#uploadArea.dragover {
    border-color: #3b82f6;
    background-color: #eff6ff;
}

.dark #uploadArea.dragover {
    background-color: #1e3a8a;
}

/* Score animations */
.score-card {
    transition: all 0.3s ease;
}

.score-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

/* Color swatch styles */
.color-swatch {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #e5e7eb;
    display: inline-block;
    margin: 2px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
}

.color-swatch:hover {
    transform: scale(1.1);
}

.dark .color-swatch {
    border-color: #4b5563;
}

/* Loading animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Score bar colors */
.score-excellent {
    background-color: #10b981;
}

.score-good {
    background-color: #f59e0b;
}

.score-poor {
    background-color: #ef4444;
}

/* Recommendation item styles */
.recommendation-item {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    padding: 12px;
    color: white;
    margin-bottom: 8px;
    transition: transform 0.2s ease;
}

.recommendation-item:hover {
    transform: translateX(4px);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .max-w-7xl {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    #uploadArea {
        padding: 2rem 1rem;
    }
    
    .grid-cols-1.md\:grid-cols-3 {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }
    
    .grid-cols-1.md\:grid-cols-2 {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }
}

/* Dark mode transitions */
.dark * {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* 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;
}

.dark ::-webkit-scrollbar-track {
    background: #374151;
}

.dark ::-webkit-scrollbar-thumb {
    background: #6b7280;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Focus states for accessibility */
button:focus,
select:focus,
input:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Image preview styles */
#previewImage {
    max-height: 400px;
    object-fit: contain;
    border: 1px solid #e5e7eb;
}

.dark #previewImage {
    border-color: #4b5563;
}

/* Modal backdrop blur */
#errorModal {
    backdrop-filter: blur(4px);
}

/* Language selector flag support */
.language-flag {
    width: 20px;
    height: 15px;
    margin-right: 8px;
    border-radius: 2px;
}

/* Animation utilities */
.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

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

.slide-up {
    animation: slideUp 0.3s ease-out;
}

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

/* Mobile UX Improvements */
@media (max-width: 768px) {
    /* Increase section spacing on mobile for better UX */
    section {
        margin-bottom: 2.5rem !important;
    }
    
    /* Compact hero section */
    .hero-section {
        padding: 2rem 0 !important;
    }
    
    /* Collapsible sections */
    .toggle-section {
        transition: all 0.2s ease;
        border: 1px solid #e5e7eb;
    }
    
    .toggle-section:active {
        transform: scale(0.98);
        background-color: rgba(59, 130, 246, 0.05);
    }
    
    .dark .toggle-section {
        border-color: #4b5563;
    }
    
    .dark .toggle-section:active {
        background-color: rgba(59, 130, 246, 0.1);
    }
    
    /* Compact text sizes */
    h1 {
        font-size: 1.875rem !important; /* 30px */
        line-height: 1.2 !important;
    }
    
    h2 {
        font-size: 1.5rem !important; /* 24px */
        line-height: 1.3 !important;
    }
    
    h3 {
        font-size: 1.25rem !important; /* 20px */
    }
    
    /* Compact padding */
    .p-8 {
        padding: 1rem !important;
    }
    
    .p-6 {
        padding: 0.75rem !important;
    }
    
    .py-16 {
        padding-top: 3rem !important;
        padding-bottom: 3rem !important;
    }
    
    .py-12 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
    
    /* Stack grid items on mobile */
    .grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    /* Compact cards */
    .bg-white, .bg-gray-800 {
        margin-bottom: 1rem;
    }
    
    /* Optimize font sizes for mobile readability */
    .text-xl {
        font-size: 1.125rem !important; /* 18px */
    }
    
    .text-2xl {
        font-size: 1.25rem !important; /* 20px */
    }
    
    .text-3xl {
        font-size: 1.5rem !important; /* 24px */
    }
    
    /* Compact upload area */
    #uploadArea {
        padding: 2rem 1rem !important;
        min-height: 200px !important;
    }
    
    /* Mobile-friendly buttons */
    button {
        min-height: 44px; /* Apple's recommended touch target size */
        padding: 0.75rem 1rem;
    }
    
    /* Hide excessive content on mobile */
    .mobile-hide {
        display: none !important;
    }
    
    /* Show mobile-specific content */
    .mobile-show {
        display: block !important;
    }
}

/* Animation for collapsible content */
.toggle-content {
    transition: max-height 0.3s ease-out, opacity 0.2s ease-out;
    overflow: hidden;
}

.toggle-content.hidden {
    max-height: 0;
    opacity: 0;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

.toggle-content:not(.hidden) {
    max-height: 2000px;
    opacity: 1;
}

/* Rotate chevron icon */
.toggle-section i.rotate-180 {
    transform: rotate(180deg);
}

/* Better mobile touch targets */
@media (max-width: 768px) {
    .language-selector select,
    .theme-toggle,
    .file-input {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
}
