/* ===================================
   OcrImagetoText.css - OCR Tool Styles
   =================================== */

/* ===================================
   Hero Section
   =================================== */
.ocr-hero {
    padding: 2rem 0;
    text-align: center;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

.hero-badge i {
    font-size: 1rem;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* ===================================
   OCR Section
   =================================== */
.ocr-section {
    padding: 0 0 4rem;
}

.ocr-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 4rem;
}

/* ===================================
   OCR Panels
   =================================== */
.ocr-panel {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.panel-icon {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.panel-title {
    flex: 1;
}

.panel-title h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.panel-title span {
    font-size: 0.8125rem;
    opacity: 0.85;
}

.panel-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-action {
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
}

.btn-action:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

.btn-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.panel-body {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* ===================================
   Upload Area
   =================================== */
.upload-area {
    position: relative;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-xl);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    background: var(--bg-body);
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-area:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.03);
}

.upload-area.drag-over {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
    transform: scale(1.01);
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.upload-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: white;
    margin-bottom: 0.5rem;
}

.upload-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.upload-content p {
    color: var(--text-secondary);
    margin: 0;
}

.upload-hint {
    font-size: 0.8125rem;
    color: var(--text-muted);
    padding: 0.375rem 0.75rem;
    background: var(--bg-card);
    border-radius: var(--radius-full);
}

.file-input {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

/* ===================================
   Image Preview
   =================================== */
.image-preview-container {
    border: 2px solid var(--border-color);
    border-radius: var(--radius-xl);
    overflow: hidden;
    background: var(--bg-body);
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
}

.file-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 250px;
}

.btn-remove {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-remove:hover {
    background: var(--danger);
    color: white;
}

.image-preview {
    padding: 1rem;
    min-height: 200px;
    max-height: 300px;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: repeating-conic-gradient(#f3f4f6 0% 25%, transparent 0% 50%) 50% / 20px 20px;
}

.image-preview img {
    max-width: 100%;
    max-height: 280px;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

.image-info {
    display: flex;
    gap: 1.5rem;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.image-info span {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.image-info i {
    color: var(--text-muted);
}

/* ===================================
   Language Select
   =================================== */
.language-select-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.language-select-wrapper .form-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.language-select-wrapper .form-label i {
    color: var(--primary);
}

.language-select-wrapper .form-select {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-lg);
    border: 2px solid var(--border-color);
    font-size: 0.9375rem;
    transition: all var(--transition-fast);
}

.language-select-wrapper .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

/* ===================================
   Extract Button
   =================================== */
.btn-extract {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    margin-top: auto;
}

.btn-extract:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.35);
}

.btn-extract:active:not(:disabled) {
    transform: translateY(0);
}

.btn-extract:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-extract i {
    font-size: 1.25rem;
}

/* ===================================
   OCR Progress
   =================================== */
.ocr-progress {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: rgba(99, 102, 241, 0.05);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: var(--radius-lg);
}

.progress-spinner {
    flex-shrink: 0;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(99, 102, 241, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.progress-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.progress-status {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.progress-bar-wrapper {
    height: 8px;
    background: rgba(99, 102, 241, 0.15);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: var(--radius-full);
    transition: width 0.3s ease;
}

.progress-percent {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--primary);
}

/* ===================================
   Result Area
   =================================== */
.result-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 300px;
    transition: opacity var(--transition-normal);
}

.result-textarea {
    width: 100%;
    flex: 1;
    min-height: 300px;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    font-family: 'Inter', sans-serif;
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--text-primary);
    background: var(--bg-body);
    resize: vertical;
    transition: all var(--transition-fast);
}

.result-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.result-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: var(--text-muted);
    pointer-events: none;
    background: var(--bg-body);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
}

.result-placeholder i {
    font-size: 3rem;
    opacity: 0.5;
}

.result-placeholder p {
    font-size: 0.9375rem;
    margin: 0;
    text-align: center;
    max-width: 250px;
}

/* ===================================
   Confidence Score
   =================================== */
.confidence-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-body);
    border-radius: var(--radius-lg);
}

.confidence-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}

.confidence-label i {
    color: var(--primary);
}

.confidence-bar {
    flex: 1;
    height: 10px;
    background: var(--border-color);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.5s ease, background 0.3s ease;
}

.confidence-fill.high {
    background: linear-gradient(90deg, #22c55e 0%, #16a34a 100%);
}

.confidence-fill.medium {
    background: linear-gradient(90deg, #f59e0b 0%, #d97706 100%);
}

.confidence-fill.low {
    background: linear-gradient(90deg, #ef4444 0%, #dc2626 100%);
}

.confidence-value {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text-primary);
    min-width: 45px;
    text-align: right;
}

/* ===================================
   Features Section
   =================================== */
.ocr-features {
    margin-bottom: 4rem;
}

.ocr-features .feature-card {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius-xl);
    text-align: center;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
    height: 100%;
}

.ocr-features .feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.ocr-features .feature-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin: 0 auto 1.25rem;
}

.ocr-features .feature-card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.ocr-features .feature-card p {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.6;
}

/* ===================================
   How To Section
   =================================== */
.ocr-howto {
    margin-bottom: 4rem;
}

.ocr-howto .section-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2.5rem;
}

.howto-steps {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
}

.howto-step {
    text-align: center;
    position: relative;
}

.howto-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 28px;
    left: calc(50% + 40px);
    width: calc(100% - 80px);
    height: 2px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
    opacity: 0.3;
}

.step-number {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 auto 1.25rem;
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.3);
}

.step-content h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.step-content p {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

/* ===================================
   FAQ Section
   =================================== */
.ocr-faq {
    margin-bottom: 2rem;
}

.ocr-faq .section-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2rem;
}

.ocr-faq .accordion-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg) !important;
    margin-bottom: 1rem;
    overflow: hidden;
}

.ocr-faq .accordion-button {
    padding: 1.25rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-card);
    box-shadow: none;
}

.ocr-faq .accordion-button:not(.collapsed) {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.ocr-faq .accordion-button:focus {
    box-shadow: none;
    border-color: transparent;
}

.ocr-faq .accordion-button::after {
    background-size: 1rem;
}

.ocr-faq .accordion-body {
    padding: 0 1.5rem 1.25rem;
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* ===================================
   Dark Mode
   =================================== */
[data-theme="dark"] .ocr-panel,
.dark-mode .ocr-panel {
    background: var(--bg-card);
}

[data-theme="dark"] .upload-area,
.dark-mode .upload-area {
    background: #1e293b;
    border-color: var(--border-color);
}

[data-theme="dark"] .upload-area:hover,
.dark-mode .upload-area:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

[data-theme="dark"] .upload-hint,
.dark-mode .upload-hint {
    background: #334155;
}

[data-theme="dark"] .image-preview-container,
.dark-mode .image-preview-container {
    border-color: var(--border-color);
}

[data-theme="dark"] .preview-header,
[data-theme="dark"] .image-info,
.dark-mode .preview-header,
.dark-mode .image-info {
    background: #1e293b;
    border-color: var(--border-color);
}

[data-theme="dark"] .image-preview,
.dark-mode .image-preview {
    background: repeating-conic-gradient(#334155 0% 25%, #1e293b 0% 50%) 50% / 20px 20px;
}

[data-theme="dark"] .result-textarea,
.dark-mode .result-textarea {
    background: #1e293b;
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .result-placeholder,
.dark-mode .result-placeholder {
    background: #1e293b;
    border-color: var(--border-color);
}

[data-theme="dark"] .confidence-wrapper,
.dark-mode .confidence-wrapper {
    background: #1e293b;
}

[data-theme="dark"] .confidence-bar,
.dark-mode .confidence-bar {
    background: #334155;
}

[data-theme="dark"] .ocr-features .feature-card,
.dark-mode .ocr-features .feature-card {
    background: var(--bg-card);
}

[data-theme="dark"] .ocr-faq .accordion-item,
.dark-mode .ocr-faq .accordion-item {
    background: var(--bg-card);
    border-color: var(--border-color);
}

[data-theme="dark"] .ocr-faq .accordion-button,
.dark-mode .ocr-faq .accordion-button {
    background: var(--bg-card);
    color: var(--text-primary);
}

[data-theme="dark"] .ocr-faq .accordion-button:not(.collapsed),
.dark-mode .ocr-faq .accordion-button:not(.collapsed) {
    background: rgba(99, 102, 241, 0.1);
}

[data-theme="dark"] .ocr-progress,
.dark-mode .ocr-progress {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.2);
}

/* ===================================
   Responsive Styles
   =================================== */
@media (max-width: 1199.98px) {
    .ocr-wrapper {
        grid-template-columns: 1fr;
    }

    .howto-steps {
        grid-template-columns: repeat(2, 1fr);
    }

    .howto-step:not(:last-child)::after {
        display: none;
    }
}

@media (max-width: 991.98px) {
    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }
}

@media (max-width: 767.98px) {
    .ocr-hero {
        padding: 1.5rem 0;
    }

    .hero-title {
        font-size: 1.75rem;
    }

    .panel-header {
        padding: 1rem 1.25rem;
    }

    .panel-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }

    .panel-title h2 {
        font-size: 1.125rem;
    }

    .panel-body {
        padding: 1.25rem;
    }

    .upload-area {
        padding: 2rem 1.5rem;
        min-height: 220px;
    }

    .upload-icon {
        width: 64px;
        height: 64px;
        font-size: 2rem;
    }

    .upload-content h3 {
        font-size: 1.125rem;
    }

    .howto-steps {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .howto-step {
        display: flex;
        align-items: flex-start;
        text-align: left;
        gap: 1rem;
    }

    .step-number {
        width: 48px;
        height: 48px;
        font-size: 1.25rem;
        margin: 0;
        flex-shrink: 0;
    }

    .step-content {
        flex: 1;
    }

    .ocr-features .feature-card {
        padding: 1.5rem;
    }

    .ocr-features .feature-icon {
        width: 56px;
        height: 56px;
        font-size: 1.5rem;
    }
}

@media (max-width: 575.98px) {
    .hero-title {
        font-size: 1.5rem;
    }

    .panel-actions {
        gap: 0.375rem;
    }

    .btn-action {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .result-textarea {
        min-height: 250px;
    }

    .confidence-wrapper {
        flex-wrap: wrap;
    }

    .confidence-bar {
        width: 100%;
        order: 1;
    }

    .confidence-value {
        order: 0;
    }

    .ocr-faq .accordion-button {
        padding: 1rem 1.25rem;
        font-size: 0.9375rem;
    }

    .ocr-faq .accordion-body {
        padding: 0 1.25rem 1rem;
        font-size: 0.875rem;
    }
}

/* ===================================
   Animations
   =================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ocr-panel {
    animation: fadeIn 0.5s ease-out;
}

.ocr-upload-panel {
    animation-delay: 0.1s;
}

.ocr-result-panel {
    animation-delay: 0.2s;
}

/* ===================================
   Print Styles
   =================================== */
@media print {
    .ocr-hero,
    .ocr-features,
    .ocr-howto,
    .ocr-faq,
    .panel-actions,
    .btn-extract,
    .upload-area,
    .ocr-progress {
        display: none !important;
    }

    .ocr-wrapper {
        grid-template-columns: 1fr;
    }

    .ocr-panel {
        box-shadow: none;
        border: 1px solid #ddd;
    }

    .result-textarea {
        border: 1px solid #ddd;
        min-height: auto;
    }
}