/**
 * Custom styles for Image Converter Pro
 * Tailwind CSS handles most styling, this file contains custom animations and utilities
 */

/* Smooth transitions for dark mode */
* {
    transition-property: background-color, border-color, color;
    transition-duration: 200ms;
    transition-timing-function: ease-in-out;
}

/* Prevent transition on page load */
.preload * {
    transition: none !important;
}

/* Custom scrollbar for dark mode */
::-webkit-scrollbar {
    width: 12px;
}

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

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

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 6px;
}

.dark ::-webkit-scrollbar-thumb {
    background: #4b5563;
}

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

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

/* Drag and drop zone highlight animation */
#dropZone.dragging {
    animation: pulse 1s infinite;
}

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

/* File upload animation */
@keyframes slideIn {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.file-preview-enter {
    animation: slideIn 0.3s ease-out;
}

/* Loading spinner animation (already using Tailwind's animate-spin) */

/* Toast notification animation */
@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutToRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

#toast:not(.hidden) {
    animation: slideInFromRight 0.3s ease-out;
}

#toast.hiding {
    animation: slideOutToRight 0.3s ease-in;
}

/* Smooth gradient background for hero section */
.bg-gradient-to-r {
    background-image: linear-gradient(to right, var(--tw-gradient-stops));
}

/* Custom focus styles for better accessibility */
*:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.dark *:focus-visible {
    outline-color: #60a5fa;
}

/* Image preview hover effect */
.file-preview-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.file-preview-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.dark .file-preview-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

/* Progress bar animation (for Phase 3) */
@keyframes progress {
    0% {
        width: 0%;
    }
}

.progress-bar {
    animation: progress 0.5s ease-out;
}

/* Button press effect */
button:active:not(:disabled) {
    transform: scale(0.98);
}

/* Skeleton loading animation (for Phase 3) */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.skeleton {
    animation: shimmer 2s infinite;
    background: linear-gradient(to right, #f6f7f8 0%, #edeef1 20%, #f6f7f8 40%, #f6f7f8 100%);
    background-size: 1000px 100%;
}

.dark .skeleton {
    background: linear-gradient(to right, #374151 0%, #4b5563 20%, #374151 40%, #374151 100%);
}

/* Fade in animation for results */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* Responsive image grid */
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

@media (min-width: 768px) {
    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

/* Print styles */
@media print {
    header, footer, #dropZone, #convertBtn {
        display: none;
    }

    #resultsContainer {
        page-break-inside: avoid;
    }
}

/* Accessibility: Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    * {
        border-width: 2px !important;
    }

    button, a {
        text-decoration: underline;
    }
}

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

.dark .text-shadow {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Truncate text with ellipsis */
.truncate-2-lines {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Glass morphism effect (optional, for modern browsers) */
.glass {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.dark .glass {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}
