/**
 * Custom Styles for OCR Web App
 * Additional styles to complement Tailwind CSS
 */

/* Custom gradient background */
.gradient-bg {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* Drop zone styling */
.drop-zone {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-width: 3px;
    position: relative;
    overflow: hidden;
}

.drop-zone::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.1), transparent);
    transition: left 0.5s;
}

.drop-zone:hover::before {
    left: 100%;
}

.drop-zone.dragover {
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
    border-color: #6366f1;
    transform: scale(1.02);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.drop-zone.dragover .upload-icon {
    transform: scale(1.1);
    color: #6366f1;
}

/* Keyboard paste feedback */
.drop-zone:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
    border-color: #6366f1;
}

.drop-zone.paste-ready {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1) 0%, rgba(59, 130, 246, 0.1) 100%);
    border-color: #10b981;
    animation: pulseGreen 1s ease-in-out;
}

@keyframes pulseGreen {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
    }
}

/* Keyboard shortcut styling */
kbd {
    box-shadow: inset 0 -2px 0 0 currentColor;
    transition: all 0.2s ease;
}

kbd:hover {
    transform: translateY(-1px);
    box-shadow: inset 0 -3px 0 0 currentColor;
}

/* Button hover effects */
.btn-hover {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-hover::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn-hover:hover::before {
    left: 100%;
}

/* Image preview animation */
.image-preview {
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(20px);
}

.image-preview.loaded {
    opacity: 1;
    transform: translateY(0);
}

/* Loading spinner enhancement */
.loading-spinner {
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Text area custom styling */
.text-area-custom {
    resize: vertical;
    min-height: 200px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    line-height: 1.6;
}

.text-area-custom:focus {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Notification styling */
.notification {
    backdrop-filter: blur(10px);
    border-left: 4px solid currentColor;
}

/* Card hover effects */
.card-hover {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* Progress bar */
.progress-bar {
    height: 4px;
    background: linear-gradient(90deg, #6366f1, #8b5cf6, #ec4899);
    background-size: 200% 100%;
    animation: progressShine 2s linear infinite;
}

@keyframes progressShine {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Custom scrollbar */
.custom-scrollbar {
    scrollbar-width: thin;
    scrollbar-color: #6366f1 #f1f5f9;
}

.custom-scrollbar::-webkit-scrollbar {
    width: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #6366f1;
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #4f46e5;
}

/* Language selector styling */
.language-select {
    appearance: none;
    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 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

/* File type icons */
.file-icon {
    position: relative;
}

.file-icon::before {
    content: '📄';
    font-size: 1.2em;
    margin-right: 0.5rem;
}

.file-icon.image::before {
    content: '🖼️';
}

.file-icon.pdf::before {
    content: '📄';
}

.file-icon.doc::before {
    content: '📝';
}

/* Success checkmark animation */
.checkmark {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: block;
    stroke-width: 2;
    stroke: #10b981;
    stroke-miterlimit: 10;
    box-shadow: inset 0px 0px 0px #10b981;
    animation: fill 0.4s ease-in-out 0.4s forwards, scale 0.3s ease-in-out 0.9s both;
}

.checkmark-circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-width: 2;
    stroke-miterlimit: 10;
    stroke: #10b981;
    fill: none;
    animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.checkmark-check {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;
}

@keyframes stroke {
    100% {
        stroke-dashoffset: 0;
    }
}

@keyframes scale {
    0%, 100% {
        transform: none;
    }
    50% {
        transform: scale3d(1.1, 1.1, 1);
    }
}

@keyframes fill {
    100% {
        box-shadow: inset 0px 0px 0px 30px #10b981;
    }
}

/* Responsive improvements */
@media (max-width: 640px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .drop-zone {
        padding: 2rem 1rem;
    }
    
    .text-area-custom {
        min-height: 150px;
    }
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .print-only {
        display: block !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .text-area-custom {
        border: 1px solid #000 !important;
        background: white !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .drop-zone {
        border-color: #000;
        background: #fff;
    }
    
    .gradient-bg {
        background: #000;
    }
    
    button {
        border: 2px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark mode support (if needed in future) */
@media (prefers-color-scheme: dark) {
    .auto-dark {
        background-color: #1f2937;
        color: #f9fafb;
    }
    
    .auto-dark input,
    .auto-dark textarea,
    .auto-dark select {
        background-color: #374151;
        color: #f9fafb;
        border-color: #4b5563;
    }
}
