/* Image to Text Converter - Custom Styles */

/* Animations and Keyframes */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%,
    100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes bounce {
    0%,
    20%,
    53%,
    80%,
    100% {
        transform: translate3d(0, 0, 0);
    }
    40%,
    43% {
        transform: translate3d(0, -10px, 0);
    }
    70% {
        transform: translate3d(0, -5px, 0);
    }
    90% {
        transform: translate3d(0, -2px, 0);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

@keyframes progressPulse {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Page Animation - Only for tool content, not site header */
.tool-page-content {
    animation: fadeIn 0.6s ease-out;
}

/* Tool Header Animations - Only for the tool's own header, not site header */
.tool-page-content .text-center h1 {
    animation: slideIn 0.8s ease-out 0.2s both;
}

.tool-page-content .text-center p {
    animation: slideIn 0.8s ease-out 0.4s both;
}

.tool-page-content .flex.flex-wrap {
    animation: slideIn 0.8s ease-out 0.6s both;
}

/* Quick Action Buttons */
.quick-action {
    position: relative;
    overflow: hidden;
}

.quick-action::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.6s;
}

.quick-action:hover::before {
    left: 100%;
}

.quick-action:hover {
    transform: translateY(-2px);
}

.quick-action:active {
    transform: translateY(0) scale(0.98);
}

/* Drop Zone Enhancements */
#dropZone {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

#dropZone::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(147, 51, 234, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

#dropZone:hover::before,
#dropZone.dragover::before {
    opacity: 1;
}

#dropZone.dragover {
    border-color: #3b82f6;
    background-color: #dbeafe;
    transform: scale(1.02);
}

#dropZone.processing {
    background: linear-gradient(45deg, #f3f4f6, #e5e7eb, #f3f4f6, #e5e7eb);
    background-size: 200% 200%;
    animation: shimmer 2s infinite linear;
}

/* Batch Drop Zone */
#batchDropZone {
    position: relative;
    transition: all 0.3s ease;
}

#batchDropZone.dragover {
    border-color: #10b981;
    background-color: #d1fae5;
    transform: scale(1.02);
}

/* Image Preview Enhancements */
#imagePreview {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

#imagePreview img {
    max-width: 100%;
    max-height: 400px;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: transform 0.3s ease;
}

#imagePreview img:hover {
    transform: scale(1.05);
    cursor: zoom-in;
}

/* Image Info Cards */
#imageInfo {
    animation: fadeIn 0.5s ease-out;
}

/* Progress Bars */
.progress-container {
    position: relative;
    overflow: hidden;
}

#progressBar,
#ocrProgressBar {
    position: relative;
    overflow: hidden;
}

#progressBar::after,
#ocrProgressBar::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background-image: linear-gradient(-45deg, rgba(255, 255, 255, 0.2) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0.2) 75%, transparent 75%, transparent);
    background-size: 50px 50px;
    animation: shimmer 2s infinite linear;
}

/* Processing Status */
#processingStatus {
    animation: slideIn 0.5s ease-out;
}

#processingStatus .animate-spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

#confidenceScore {
    animation: progressPulse 2s infinite ease-in-out;
}

/* Results Section Animation */
#resultsSection {
    animation: fadeIn 0.6s ease-out;
}

#resultsSection > * {
    animation: slideIn 0.5s ease-out;
}

/* Text Statistics Cards */
#textStats .text-center {
    transition: all 0.3s ease;
}

#textStats .text-center:hover {
    transform: translateY(-2px);
    background-color: rgba(249, 250, 251, 0.8);
    border-radius: 8px;
    padding: 16px;
    margin: -16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

#textStats .text-2xl {
    transition: all 0.3s ease;
}

#textStats .text-center:hover .text-2xl {
    transform: scale(1.1);
}

/* Export Buttons */
.export-btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.export-btn::before {
    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: all 0.5s ease;
}

.export-btn:hover::before {
    width: 300px;
    height: 300px;
}

.export-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
}

.export-btn:active {
    transform: translateY(0);
}

/* Batch Processing */
.batch-item {
    position: relative;
    transition: all 0.3s ease;
    animation: slideIn 0.5s ease-out;
}

.batch-item:hover {
    transform: translateX(4px);
    background-color: rgba(249, 250, 251, 0.8);
}

.batch-item.processing {
    background: linear-gradient(45deg, #dbeafe, #bfdbfe, #dbeafe, #bfdbfe);
    background-size: 200% 200%;
    animation: shimmer 2s infinite linear;
}

.batch-item.completed {
    background-color: #d1fae5;
    border-color: #10b981;
}

.batch-item.error {
    background-color: #fee2e2;
    border-color: #ef4444;
}

/* Batch Progress */
.batch-progress {
    position: relative;
    overflow: hidden;
}

.batch-progress-bar {
    transition: width 0.5s ease;
}

/* Buttons Enhancements */
button:not(:disabled) {
    transition: all 0.2s ease;
}

button:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

button:not(:disabled):active {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Primary Buttons */
.bg-blue-600:not(:disabled):hover {
    background-color: #1d4ed8;
}

.bg-green-600:not(:disabled):hover {
    background-color: #059669;
}

.bg-purple-600:not(:disabled):hover {
    background-color: #7c2d12;
}

.bg-orange-600:not(:disabled):hover {
    background-color: #ea580c;
}

/* Form Inputs */
input[type="file"] {
    transition: all 0.3s ease;
}

select,
input[type="checkbox"] {
    transition: all 0.2s ease;
}

select:focus,
input[type="checkbox"]:focus {
    transform: scale(1.02);
}

textarea {
    transition: all 0.3s ease;
}

textarea:focus {
    transform: scale(1.01);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Toast Notifications */
#toast {
    z-index: 1000;
}

#toast.show {
    transform: translateX(0);
}

#toast .bg-white {
    animation: slideIn 0.5s ease-out;
}

/* Success Toast */
#toast.success #toastIcon {
    background-color: #10b981;
    color: white;
}

/* Error Toast */
#toast.error #toastIcon {
    background-color: #ef4444;
    color: white;
}

/* Info Toast */
#toast.info #toastIcon {
    background-color: #3b82f6;
    color: white;
}

/* Warning Toast */
#toast.warning #toastIcon {
    background-color: #f59e0b;
    color: white;
}

/* Feature Cards */
.bg-white.rounded-2xl {
    transition: all 0.3s ease;
}

.bg-white.rounded-2xl:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.bg-white.rounded-2xl .w-16.h-16 {
    transition: all 0.3s ease;
}

.bg-white.rounded-2xl:hover .w-16.h-16 {
    transform: scale(1.1) rotate(5deg);
}

/* Loading States */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.4), transparent);
    animation: shimmer 1.5s infinite;
}

/* Confidence Meter */
.confidence-meter {
    position: relative;
    background: conic-gradient(from 0deg, #ef4444 0deg 108deg, #f59e0b 108deg 180deg, #10b981 180deg 360deg);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.confidence-meter::before {
    content: "";
    position: absolute;
    width: 80%;
    height: 80%;
    background: white;
    border-radius: 50%;
}

.confidence-score {
    position: relative;
    z-index: 1;
    font-weight: bold;
    font-size: 14px;
}

/* Responsive Enhancements */
@media (max-width: 768px) {
    .quick-action {
        padding: 12px;
    }

    .quick-action svg {
        width: 20px;
        height: 20px;
    }

    #dropZone,
    #batchDropZone {
        padding: 24px 16px;
    }

    .export-btn {
        padding: 16px 12px;
    }

    #imagePreview img {
        max-height: 250px;
    }

    #extractedText {
        height: 200px;
    }
}

@media (max-width: 640px) {
    .grid.grid-cols-2.md\\:grid-cols-4 {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .export-btn {
        padding: 12px 8px;
    }

    .export-btn svg {
        width: 16px;
        height: 16px;
    }

    .text-4xl.md\\:text-5xl {
        font-size: 2rem;
    }

    .bg-white.rounded-3xl {
        border-radius: 1.5rem;
        padding: 24px 16px;
    }
}

/* Accessibility Enhancements */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Focus Styles */
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .bg-gradient-to-br {
        background: #ffffff;
    }

    .border-dashed {
        border-width: 3px;
    }

    button {
        border: 2px solid currentColor;
    }
}

/* Print Styles */
@media print {
    .min-h-screen {
        background: white !important;
    }

    button,
    .quick-action,
    #dropZone,
    #batchDropZone {
        display: none !important;
    }

    #resultsSection {
        display: block !important;
    }

    #extractedText {
        border: 2px solid #000 !important;
        background: white !important;
    }
}

/* Custom Scrollbar */
#extractedText::-webkit-scrollbar {
    width: 8px;
}

#extractedText::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

#extractedText::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

#extractedText::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Utility Classes */
.fade-in {
    animation: fadeIn 0.5s ease-out;
}

.slide-in {
    animation: slideIn 0.5s ease-out;
}

.bounce-in {
    animation: bounce 1s ease-out;
}

.processing-shimmer {
    background: linear-gradient(45deg, #f3f4f6, #e5e7eb, #f3f4f6, #e5e7eb);
    background-size: 200% 200%;
    animation: shimmer 2s infinite linear;
}

.pulse-glow {
    animation: progressPulse 2s infinite ease-in-out;
}

/* Status Indicators */
.status-success {
    background-color: #10b981;
    color: white;
}

.status-error {
    background-color: #ef4444;
    color: white;
}

.status-warning {
    background-color: #f59e0b;
    color: white;
}

.status-info {
    background-color: #3b82f6;
    color: white;
}

/* File Type Icons */
.file-icon-jpg,
.file-icon-jpeg {
    color: #ef4444;
}

.file-icon-png {
    color: #10b981;
}

.file-icon-gif {
    color: #f59e0b;
}

.file-icon-webp {
    color: #8b5cf6;
}

.file-icon-bmp {
    color: #06b6d4;
}

.file-icon-tiff {
    color: #ec4899;
}

.file-icon-svg {
    color: #84cc16;
}
