/* ====================================================================
   Utility & Reset
   ==================================================================== */
.hidden {
    display: none !important;
}

@keyframes simplePulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.7;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ====================================================================
   OCR4all.ai - Styles v8.6 FIXED
   Modern, Clean, Professional Design
   ==================================================================== */

/* ====================================================================
   تحميل الخطوط من Google Fonts (Removed)
   ==================================================================== */
/* Local fonts are now loaded via fonts.css in index.html */

/* ====================================================================
   CSS Variables
   ==================================================================== */
:root {
    /* Colors */
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary-color: #10b981;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    --background: #ffffff;
    --background-secondary: #f9fafb;
    --border-color: #e5e7eb;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --success-color: #10b981;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;

    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-primary);
    background: var(--background-secondary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Arabic/RTL Fonts */
body[dir="rtl"] {
    font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
}

/* Urdu Font */
.urdu-text,
[lang="ur"],
textarea[style*="direction: rtl"] {
    font-family: 'Noto Nastaliq Urdu', 'Jameel Noori Nastaleeq', serif !important;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ====================================================================
   Header
   ==================================================================== */

.header {
    background: var(--background);
    border-bottom: 1px solid var(--border-color);
    padding: 0.6rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    font-size: 1.5rem;
}

.status-online {
    color: #10b981;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    text-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

.status-online::before {
    content: '';
    width: 8px;
    height: 8px;
    background-color: #10b981;
    border-radius: 50%;
    animation: simplePulse 2s infinite;
}

/* Development Notice */
.dev-notice {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: rgba(99, 102, 241, 0.05);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    border: 1px solid rgba(99, 102, 241, 0.1);
    font-weight: 500;
}

.pulse-dot {
    width: 6px;
    height: 6px;
    background-color: var(--secondary-color);
    border-radius: 50%;
    display: inline-block;
    animation: simplePulse 2s infinite;
}

@keyframes simplePulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* Responsive Hide Dev Notice */
@media (max-width: 600px) {
    .dev-notice {
        display: none;
    }
}

/* Language Selector */
.language-selector {
    position: relative;
}

.current-language {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--background-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

.current-language:hover {
    border-color: var(--primary-color);
    background: var(--background);
}

.globe-icon {
    font-size: 1.2rem;
}

.dropdown-arrow {
    font-size: 0.7rem;
    transition: var(--transition);
}

.language-selector.active .dropdown-arrow {
    transform: rotate(180deg);
}

.language-options {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 200px;
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: none;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: var(--transition);
    z-index: 1000;
}

.language-selector.active .language-options {
    display: block !important;
    max-height: 400px;
    opacity: 1;
    overflow-y: auto;
}

.language-option {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

.language-option:hover {
    background: var(--background-secondary);
    color: var(--primary-color);
}

/* ====================================================================
   Main Content
   ==================================================================== */

.main-content {
    padding: 1.5rem 0;
    min-height: calc(100vh - 120px);
}

/* Hero Section */
.hero-section {
    text-align: center;
    margin-bottom: 1rem;
}

.hero-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* OCR Settings */
.ocr-settings {
    background: var(--background);
    border-radius: var(--radius-lg);
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.setting-label {
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
}

.label-icon {
    font-size: 1.2rem;
}

.setting-select {
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    background: var(--background);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
}

.setting-select:hover {
    border-color: var(--primary-color);
}

.setting-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Select with Info Icon */
.select-with-info {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 320px;
}

.select-with-info .setting-select {
    flex: 1;
    min-width: 0;
}

.info-icon {
    font-size: 18px;
    color: #666;
    cursor: help;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #f0f0f0;
    transition: all 0.3s ease;
    user-select: none;
}

.info-icon:hover {
    color: #333;
    background: #e0e0e0;
    transform: scale(1.1);
}

/* Optgroup Styling */
optgroup {
    font-weight: bold;
    font-size: 12px;
    color: #999;
    padding: 8px 0;
    font-style: normal;
}

optgroup option {
    font-weight: normal;
    font-size: 14px;
    color: #333;
    padding-left: 10px;
}

/* Responsive */
@media (max-width: 768px) {
    .select-with-info {
        max-width: 100%;
    }
}

/* Upload Zone */
.upload-section {
    margin-bottom: 1rem;
}

.drop-zone {
    background: var(--background);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.drop-zone:hover {
    border-color: var(--primary-color);
    background: var(--background-secondary);
}

.drop-zone.drag-over {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.05);
    transform: scale(1.02);
}

.drop-zone.processing {
    pointer-events: none;
    opacity: 0.6;
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.upload-icon {
    color: var(--primary-color);
}

.upload-icon svg {
    width: 48px;
    height: 48px;
}

.drop-zone-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.drop-zone-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.supported-formats {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.formats-label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-right: 0.25rem;
}

.format-badge {
    padding: 0.25rem 0.75rem;
    background: var(--background-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* Advanced Settings */
.advanced-settings {
    margin-top: 1rem;
}

/* Tips Tooltip - مخفية افتراضياً */
.tips-tooltip-wrapper {
    position: relative;
    margin-bottom: 1rem;
}

.tips-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: help;
    transition: var(--transition);
}

.tips-trigger:hover {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.tips-icon {
    font-size: 1.25rem;
}

.tips-text {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.tips-popup {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-width: 400px;
    display: none;
    /* مخفية افتراضياً */
}

.tips-popup.hidden {
    display: none;
}

.tips-tooltip-wrapper:hover .tips-popup {
    display: block;
    animation: fadeInDown 0.3s ease;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tip-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.tip-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.tip-item:first-child {
    padding-top: 0;
}

.tip-item strong {
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
}

.tip-item span {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.4;
}

.toggle-option {
    margin-top: 0.75rem;
}

.toggle-label {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    cursor: pointer;
    padding: 1rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
}

.toggle-label:hover {
    background: var(--background-secondary);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.toggle-checkbox {
    display: none;
}

.toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
    background: #ddd;
    border-radius: 13px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-checkbox:checked+.toggle-switch {
    background: var(--primary-color);
}

.toggle-checkbox:checked+.toggle-switch::after {
    left: 25px;
}

.toggle-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.toggle-text strong {
    color: var(--text-primary);
    font-size: 0.95rem;
}

.toggle-text small {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.4;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 3rem 2rem;
    background: var(--background);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    animation: fadeIn 0.3s ease-out;
}

.loading.hidden,
.hero-section.hidden,
.ocr-settings.hidden,
.upload-section.hidden,
.result-section.hidden {
    display: none !important;
}

.loading-content {
    max-width: 400px;
    margin: 0 auto;
}

.loading-spinner {
    width: 56px;
    height: 56px;
    border: 5px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-right-color: var(--primary-light);
    border-radius: 50%;
    animation: spin 0.8s cubic-bezier(0.5, 0, 0.5, 1) infinite;
    margin: 0 auto 1.5rem;
    position: relative;
}

.loading-spinner::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    border: 4px solid transparent;
    border-top-color: var(--primary-light);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: spin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite reverse;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.loading-text {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.loading-subtext {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 1rem;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Loading Progress Bar */
.loading-progress {
    width: 100%;
    height: 6px;
    background: var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    margin-top: 1rem;
}

.loading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light), var(--primary-color));
    background-size: 200% 100%;
    border-radius: 10px;
    animation: progressSlide 2s ease-in-out infinite;
}

@keyframes progressSlide {
    0% {
        transform: translateX(-100%);
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        transform: translateX(100%);
        background-position: 0% 50%;
    }
}

/* Results Section */
.result-section {
    background: var(--background);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    animation: fadeInUp 0.5s ease-out;
}

.result-section.hidden {
    display: none;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-header {
    margin-bottom: 1rem;
}

.result-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.meta-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.meta-value {
    font-size: 0.875rem;
    color: var(--text-primary);
    font-weight: 600;
}

.confidence-badge {
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.confidence-badge::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    transition: width 0.6s ease;
}

.confidence-badge.high {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(16, 185, 129, 0.05));
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.confidence-badge.high::before {
    width: 100%;
}

.confidence-badge.high::after {
    content: '✓';
    font-weight: bold;
    margin-left: 2px;
}

.confidence-badge.medium {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(245, 158, 11, 0.05));
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.confidence-badge.medium::before {
    width: 70%;
}

.confidence-badge.medium::after {
    content: '~';
    font-weight: bold;
}

.confidence-badge.low {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.05));
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.confidence-badge.low::before {
    width: 40%;
}

.confidence-badge.low::after {
    content: '!';
    font-weight: bold;
}

/* شريط Confidence مرئي */
.confidence-bar-container {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.confidence-bar {
    height: 100%;
    border-radius: 10px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.confidence-bar.high {
    background: linear-gradient(90deg, #10b981, #059669);
}

.confidence-bar.medium {
    background: linear-gradient(90deg, #f59e0b, #d97706);
}

.confidence-bar.low {
    background: linear-gradient(90deg, #ef4444, #dc2626);
}

.confidence-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.3),
            transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.badge-azure {
    padding: 0.25rem 0.75rem;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
}

.result-content {
    margin-bottom: 1.5rem;
}

.result-textarea {
    width: 100%;
    min-height: 220px;
    padding: 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    line-height: 1.6;
    resize: vertical;
    font-family: inherit;
    background: var(--background-secondary);
}

.result-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* خطوط مخصصة حسب اللغة المكتشفة */
.result-textarea[data-lang="ar"],
#result-text[data-lang="ar"] {
    font-family: 'Amiri', serif !important;
    direction: rtl;
    text-align: right;
    font-size: 1.1rem;
}

.result-textarea[data-lang="en"],
#result-text[data-lang="en"] {
    font-family: 'Times New Roman', 'Georgia', serif !important;
    direction: ltr;
    text-align: left;
}

.result-textarea[data-lang="ur"],
#result-text[data-lang="ur"] {
    font-family: 'Noto Nastaliq Urdu', serif !important;
    direction: rtl;
    text-align: right;
    font-size: 1.15rem;
    /* الأوردو يحتاج حجم أكبر قليلاً */
}

.result-textarea[data-lang="fa"],
#result-text[data-lang="fa"] {
    font-family: 'Vazirmatn', 'Vazir', sans-serif !important;
    direction: rtl;
    text-align: right;
    font-size: 1.05rem;
}

.result-textarea[data-lang="de"],
#result-text[data-lang="de"] {
    font-family: 'Lora', serif !important;
    direction: ltr;
    text-align: left;
}

.result-textarea[data-lang="fr"],
#result-text[data-lang="fr"] {
    font-family: 'EB Garamond', serif !important;
    direction: ltr;
    text-align: left;
}

.result-textarea[data-lang="pt"],
#result-text[data-lang="pt"] {
    font-family: 'Merriweather', serif !important;
    direction: ltr;
    text-align: left;
}

.result-textarea[data-lang="it"],
#result-text[data-lang="it"] {
    font-family: 'Cormorant Garamond', serif !important;
    direction: ltr;
    text-align: left;
}

.result-textarea[data-lang="ko"],
#result-text[data-lang="ko"] {
    font-family: 'Noto Sans KR', sans-serif !important;
    direction: ltr;
    text-align: left;
}

.result-textarea[data-lang="ja"],
#result-text[data-lang="ja"] {
    font-family: 'Noto Sans JP', sans-serif !important;
    direction: ltr;
    text-align: left;
}

.result-textarea[data-lang="bn"],
#result-text[data-lang="bn"] {
    font-family: 'Tiro Bangla', serif !important;
    direction: ltr;
    text-align: left;
    font-size: 1.1rem;
}

.result-textarea[data-lang="th"],
#result-text[data-lang="th"] {
    font-family: 'Sarabun', sans-serif !important;
    direction: ltr;
    text-align: left;
}

.result-textarea[data-lang="es"],
#result-text[data-lang="es"] {
    font-family: 'Crimson Text', serif !important;
    direction: ltr;
    text-align: left;
}

.result-textarea[data-lang="zh"],
#result-text[data-lang="zh"] {
    font-family: 'Noto Sans SC', sans-serif !important;
    direction: ltr;
    text-align: left;
}

.result-textarea[data-lang="he"],
#result-text[data-lang="he"] {
    font-family: 'Noto Sans Hebrew', sans-serif !important;
    direction: rtl;
    text-align: right;
}

.result-textarea[data-lang="tr"],
#result-text[data-lang="tr"] {
    font-family: 'Open Sans', sans-serif !important;
    direction: ltr;
    text-align: left;
}

/* عرض معلومات الخط */
.font-info {
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 0.875rem;
    color: #666;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.font-info strong {
    color: #333;
    font-weight: 600;
}

.font-info-icon {
    font-size: 1rem;
}

.result-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

.action-btn:hover {
    background: var(--light-bg);
}

.action-btn-primary {
    background: var(--primary-color);
    color: white;
    border: none;
}

.action-btn-primary:hover {
    background: var(--primary-dark);
}

.action-btn-accent {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
}

.action-btn-accent:hover {
    background: #e2e8f0;
    color: #1e293b;
}

/* Smart Fix Button (Magical Gradient) */
.action-btn-magic {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
    color: white;
    border: none;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.action-btn-magic:hover {
    filter: brightness(1.1);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
    transform: translateY(-1px);
}

.action-btn-magic .magic-icon {
    font-size: 1.1em;
}

/* Spinner Animation */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.magic-icon.spinning {
    display: inline-block;
    animation: spin 1s linear infinite;
}

/* Undo State */
.action-btn.is-undo {
    background: #f87171;
    color: white;
    border: none;
}

.action-btn.is-undo:hover {
    background: #ef4444;
}

.action-btn-secondary {
    background: var(--background-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.action-btn-secondary:hover {
    background: var(--background);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Footer */
.footer {
    background: var(--background);
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    margin-top: 4rem;
}

.footer-text {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.footer-separator {
    margin: 0 0.5rem;
    color: var(--text-light);
}

/* Notifications */
.notification {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: var(--success-color);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    font-weight: 600;
    z-index: 9999;
    opacity: 0;
    transform: translateX(400px);
    transition: var(--transition);
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.error-message {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: white;
    max-width: 400px;
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 4px solid var(--error-color);
}

.error-message.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.error-content {
    padding: 1.25rem;
}

.error-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.error-icon {
    font-size: 1.5rem;
}

.error-title {
    flex: 1;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.error-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.error-close:hover {
    background: var(--background-secondary);
    color: var(--text-primary);
}

.error-text {
    color: var(--text-primary);
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.error-details {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: var(--background-secondary);
    border-radius: var(--radius-sm);
}

.error-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.error-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.error-btn.retry {
    background: var(--primary-color);
    color: white;
}

.error-btn.retry:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

/* Tip Messages */
.tip-message {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: white;
    max-width: 350px;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    z-index: 9998;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tip-message.show {
    opacity: 1;
    transform: translateY(0);
}

.tip-message.tip-info {
    border-left: 4px solid var(--primary-color);
}

.tip-message.tip-success {
    border-left: 4px solid var(--success-color);
}

.tip-message.tip-warning {
    border-left: 4px solid var(--warning-color);
}

.tip-message.tip-tip {
    border-left: 4px solid #8b5cf6;
}

.tip-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.tip-icon {
    font-size: 1.25rem;
}

.tip-text {
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 0.95rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .drop-zone {
        padding: 2rem 1rem;
    }

    .result-section {
        padding: 1.5rem;
    }

    .result-actions {
        flex-direction: column;
    }

    .action-btn {
        width: 100%;
        justify-content: center;
    }

    .notification,
    .error-message {
        right: 1rem;
        left: 1rem;
    }
}

/* RTL Support */
body[dir="rtl"] .logo {
    flex-direction: row-reverse;
}

body[dir="rtl"] .current-language,
body[dir="rtl"] .setting-label,
body[dir="rtl"] .action-btn,
body[dir="rtl"] .meta-item {
    flex-direction: row-reverse;
}

body[dir="rtl"] .language-options {
    right: auto;
    left: 0;
}

body[dir="rtl"] .notification,
body[dir="rtl"] .error-message {
    right: auto;
    left: 2rem;
}

@media (max-width: 768px) {

    body[dir="rtl"] .notification,
    body[dir="rtl"] .error-message {
        left: 1rem;
        right: 1rem;
    }
}

/* ====================================
   Image Editor Modal
   ==================================== */

.image-editor-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.image-editor-container {
    background: white;
    border-radius: 12px;
    max-width: 1200px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
}

.image-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid var(--border-color);
}

.image-editor-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-primary);
}

.editor-close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.editor-close-btn:hover {
    background: var(--background-secondary);
    color: var(--text-primary);
}

.image-editor-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.editor-canvas-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    position: relative;
    overflow: auto;
    padding: 20px;
}

#editor-canvas {
    max-width: 100%;
    max-height: 100%;
    border: 2px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    cursor: move;
}

.crop-overlay {
    position: absolute;
    border: 2px dashed var(--primary-color);
    background: rgba(59, 130, 246, 0.1);
    cursor: crosshair;
    pointer-events: none;
}

.editor-controls {
    width: 280px;
    padding: 20px;
    background: white;
    border-left: 1px solid var(--border-color);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.control-group label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.editor-btn {
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    font-weight: 500;
    color: var(--text-primary);
}

.editor-btn:hover {
    background: var(--background-secondary);
    border-color: var(--primary-color);
}

.editor-btn:active {
    transform: scale(0.98);
}

.editor-btn-primary {
    background: var(--primary-color) !important;
    color: white !important;
    border-color: var(--primary-color) !important;
    font-weight: 600;
    font-size: 1rem;
    padding: 12px 16px;
}

.editor-btn-primary:hover {
    background: #2563eb !important;
    box-shadow: var(--shadow-md);
}

.editor-btn-secondary {
    background: white !important;
    color: var(--text-primary) !important;
    border: 2px solid var(--border-color) !important;
}

.editor-btn-secondary:hover {
    background: var(--background-secondary) !important;
    border-color: var(--text-secondary) !important;
}

.editor-actions {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* Responsive */
@media (max-width: 768px) {
    .image-editor-body {
        flex-direction: column;
    }

    .editor-controls {
        width: 100%;
        max-height: 300px;
        border-left: none;
        border-top: 1px solid var(--border-color);
    }

    .editor-canvas-container {
        max-height: 50vh;
    }
}

/* ====================================================================
   Image Preview Modal
   ==================================================================== */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--background-secondary);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
    overflow: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border-color);
}

/* Preview Toolbar */
.preview-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--background-secondary);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.tool-btn {
    background: white;
    border: 1px solid var(--border-color);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.tool-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.tool-btn:hover svg {
    stroke: white;
}

.tool-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.tool-btn.active svg {
    stroke: white;
}

.toolbar-divider {
    width: 1px;
    height: 30px;
    background: var(--border-color);
    margin: 0 0.5rem;
}

.zoom-indicator {
    margin-left: auto;
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-weight: 600;
    color: var(--text-primary);
}

/* Canvas Container */
.canvas-container {
    position: relative;
    width: 100%;
    height: 500px;
    background: #f5f5f5;
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#preview-canvas {
    max-width: 100%;
    max-height: 100%;
    cursor: move;
    transition: transform 0.3s ease;
}

/* Crop Overlay */
.crop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    cursor: crosshair;
}

.crop-box {
    position: absolute;
    border: 2px solid var(--primary-color);
    background: rgba(76, 175, 80, 0.1);
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
}

.crop-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: white;
    border: 2px solid var(--primary-color);
    border-radius: 50%;
}

.crop-handle.nw {
    top: -6px;
    left: -6px;
    cursor: nw-resize;
}

.crop-handle.ne {
    top: -6px;
    right: -6px;
    cursor: ne-resize;
}

.crop-handle.sw {
    bottom: -6px;
    left: -6px;
    cursor: sw-resize;
}

.crop-handle.se {
    bottom: -6px;
    right: -6px;
    cursor: se-resize;
}

/* Modal Buttons */
.btn-primary,
.btn-secondary {
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--background-secondary);
}

/* Responsive Modal */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .modal-header,
    .modal-footer {
        padding: 1rem;
    }

    .canvas-container {
        height: 300px;
    }

    .preview-toolbar {
        padding: 0.75rem;
        gap: 0.25rem;
    }

    .tool-btn {
        width: 36px;
        height: 36px;
    }

    .zoom-indicator {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }
}

/* ====================================================================
   Batch Processing
   ==================================================================== */

/* Batch Queue Section */
.batch-queue-section {
    background: white;
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin: 2rem auto;
    max-width: var(--container-width);
    box-shadow: var(--shadow-md);
}

.batch-queue-section.hidden {
    display: none;
}

.batch-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.batch-header h3 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-primary);
}

.batch-actions {
    display: flex;
    gap: 0.75rem;
}

/* Batch Progress */
.batch-progress {
    background: var(--background-secondary);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.progress-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.progress-text {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.progress-text strong {
    color: var(--text-primary);
    font-size: 1.1rem;
}

.progress-percentage {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

.progress-bar-container {
    width: 100%;
    height: 12px;
    background: #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-dark));
    border-radius: 6px;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 1.5s infinite;
}

/* Batch Files List */
.batch-files-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.5rem;
}

.batch-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: white;
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}

.batch-file-item:hover {
    box-shadow: var(--shadow-sm);
}

.batch-file-item.processing {
    background: #fff9e6;
    border-color: #ffd700;
}

.batch-file-item.completed {
    background: #e8f5e9;
    border-color: var(--success-color);
}

.batch-file-item.error {
    background: #ffebee;
    border-color: var(--error-color);
}

.file-item-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    min-width: 0;
}

.file-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--background-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.file-details {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.file-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
}

.file-status.pending {
    background: #e3f2fd;
    color: #1976d2;
}

.file-status.processing {
    background: #fff9e6;
    color: #f57c00;
}

.file-status.completed {
    background: #e8f5e9;
    color: var(--success-color);
}

.file-status.error {
    background: #ffebee;
    color: var(--error-color);
}

.file-remove-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.file-remove-btn:hover {
    background: var(--background-secondary);
    color: var(--error-color);
}

/* Batch Results Section */
.batch-results-section {
    background: white;
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin: 2rem auto;
    max-width: var(--container-width);
    box-shadow: var(--shadow-md);
}

.batch-results-section.hidden {
    display: none;
}

.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.results-header h3 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-primary);
}

.results-actions {
    display: flex;
    gap: 0.75rem;
}

/* Batch Results Summary */
.batch-results-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.summary-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--background-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.summary-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
}

.summary-icon.success {
    background: var(--success-light);
    color: var(--success-color);
}

.summary-icon.error {
    background: var(--error-light);
    color: var(--error-color);
}

.summary-icon.total {
    background: #e3f2fd;
    color: #1976d2;
}

.summary-info {
    display: flex;
    flex-direction: column;
}

.summary-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.summary-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Batch Results List */
.batch-results-list {
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.batch-result-item {
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem;
    transition: background 0.2s;
}

.batch-result-item:last-child {
    border-bottom: none;
}

.batch-result-item:hover {
    background: var(--background-secondary);
}

.result-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    gap: 1rem;
}

.result-item-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.result-item-title h4 {
    margin: 0;
    font-size: 1rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

.result-status-badge.success {
    background: var(--success-light);
    color: var(--success-color);
}

.result-status-badge.error {
    background: var(--error-light);
    color: var(--error-color);
}

.result-item-actions {
    display: flex;
    gap: 0.5rem;
}

.result-item-btn {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.result-item-btn:hover {
    background: var(--background-secondary);
    border-color: var(--primary-color);
}

.result-item-text {
    max-height: 150px;
    overflow-y: auto;
    padding: 1rem;
    background: var(--background-secondary);
    border-radius: var(--radius-sm);
    font-family: monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Loading Spinner for Batch */
.batch-loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Responsive Batch */
@media (max-width: 768px) {

    .batch-queue-section,
    .batch-results-section {
        padding: 1rem;
    }

    .batch-header,
    .results-header {
        flex-direction: column;
        align-items: stretch;
    }

    .batch-actions,
    .results-actions {
        width: 100%;
        justify-content: stretch;
    }

    .batch-actions button,
    .results-actions button {
        flex: 1;
    }

    .batch-files-list,
    .batch-results-list {
        max-height: 300px;
    }

    .file-item-info {
        gap: 0.5rem;
    }

    .file-status {
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
    }

    .summary-value {
        font-size: 1.5rem;
    }
}

/* RTL Support */
body[dir='rtl'] .logo {
    flex-direction: row-reverse;
}

body[dir='rtl'] .current-language,
body[dir='rtl'] .setting-label,
body[dir='rtl'] .action-btn,
body[dir='rtl'] .meta-item {
    flex-direction: row-reverse;
}

body[dir='rtl'] .language-options {
    right: auto;
    left: 0;
}

body[dir='rtl'] .notification,
body[dir='rtl'] .error-message {
    right: auto;
    left: 2rem;
}

body[dir='rtl'] .tip-content {
    direction: rtl;
}

@media (max-width: 768px) {

    body[dir='rtl'] .notification,
    body[dir='rtl'] .error-message {
        left: 1rem;
        right: 1rem;
    }
}

/* ====================================================================
   Language Mismatch Warning
   ==================================================================== */
.mismatch-warning {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin: 1.5rem 0;
    box-shadow: var(--shadow-sm);
    animation: fadeInDown 0.5s ease;
}

.mismatch-icon {
    font-size: 1.5rem;
    padding-top: 0.1rem;
}

.mismatch-content {
    flex: 1;
}

.mismatch-content p {
    margin-bottom: 0.5rem;
    color: #92400e;
    font-weight: 500;
}

.mismatch-content small {
    display: block;
    color: #b45309;
    font-size: 0.85rem;
    opacity: 0.9;
}

[dir="rtl"] .mismatch-warning {
    flex-direction: row-reverse;
    text-align: right;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ====================================================================
   Try Another Button (v11.5)
   ==================================================================== */
.action-btn-accent {
    background: linear-gradient(135deg, var(--secondary-color), #059669) !important;
    border-color: rgba(16, 185, 129, 0.2) !important;
    color: white !important;
}

.action-btn-accent:hover {
    background: linear-gradient(135deg, #059669, var(--secondary-color)) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

/* Responsive Result UI */
@media (max-width: 768px) {
    .result-section {
        padding: 1.25rem;
    }

    .result-actions {
        flex-direction: column;
        gap: 10px;
    }

    .action-btn {
        width: 100% !important;
        justify-content: center;
    }
}

/* Utils (v14.0) */
.hidden {
    display: none !important;
}

/* Loading UI (v14.0) */
.loading-container {
    text-align: center;
    padding: 3rem 1rem;
    background: white;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    margin: 2rem 0;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(99, 102, 241, 0.1);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    margin: 0 auto 1.5rem;
    animation: spin 1s linear infinite;
}

.loading-text {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.loading-progress-track {
    width: 200px;
    height: 4px;
    background: #f1f5f9;
    border-radius: 10px;
    margin: 0 auto;
    overflow: hidden;
    position: relative;
}

.loading-progress-fill {
    width: 40%;
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 10px;
    position: absolute;
    animation: progressPing 2s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes progressPing {
    0% {
        left: -40%;
    }

    100% {
        left: 140%;
    }
}

/* Recent History (v14.0) */
.history-section {
    margin-bottom: 2.5rem;
    animation: fadeIn 0.5s ease-out;
}

.section-badge {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.history-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
    padding: 0.5rem 0 1.25rem;
    overflow-x: visible;
    /* No more scrolling */
}

/* Scrollbar styles removed as they are no longer needed for the list itself */

.history-item {
    /* Auto width based on grid */
    background: white;
    border: 1px solid #e2e8f0;
    padding: 0.75rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.05);
    min-width: 0;
    /* Fix flex child overflow */
}

.history-item:hover {
    transform: translateY(-3px);
    border-color: var(--primary-color);
    box-shadow: 0 8px 15px -3px rgba(99, 102, 241, 0.15);
}

.history-icon {
    font-size: 1.2rem;
    background: #f8fafc;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    flex-shrink: 0;
}

.history-info {
    flex: 1;
    overflow: hidden;
}

.history-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-meta {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}
/* ====================================================================
   v18.0 FIX: Tab Content & Modal Overlay
   ==================================================================== */

/* CRITICAL: Hide inactive tab content */
.tab-content {
    display: none !important;
}

.tab-content.active {
    display: block !important;
}

/* Result Tabs Styling */
.result-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    align-items: center;
}

.result-tab {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

.result-tab:hover {
    background: var(--background-secondary);
    color: var(--text-primary);
}

.result-tab.active {
    background: var(--primary-color);
    color: white;
}

.tab-icon {
    font-size: 1rem;
}

/* Table Badge */
.table-badge {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.6rem;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: auto;
}

.table-badge.hidden {
    display: none !important;
}

/* Preview Area */
.result-preview-area {
    min-height: 200px;
    padding: 1rem;
    background: var(--background-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    line-height: 1.8;
    overflow-x: auto;
}

.result-preview-area p {
    margin-bottom: 1rem;
}

.result-preview-area table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.9rem;
}

.result-preview-area th,
.result-preview-area td {
    border: 1px solid var(--border-color);
    padding: 0.6rem 0.8rem;
    text-align: right;
}

.result-preview-area th {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
}

.result-preview-area tr:nth-child(even) {
    background: var(--background);
}

.result-preview-area tr:hover {
    background: rgba(99, 102, 241, 0.05);
}

.table-responsive {
    overflow-x: auto;
    margin: 1rem 0;
}

/* Modal Overlay - Hide by default */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex;
}

/* Actions Rows Layout (v18.0) */
.actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    width: 100%;
}

.export-row {
    margin-bottom: 0.75rem;
}

.ai-row {
    margin-top: 0.5rem;
}

/* Make Smart Fix and Try Another buttons larger */
.ai-row .action-btn {
    flex: 1;
    min-width: 150px;
    justify-content: center;
}

/* ====================================================================
   AI File Enhancer Modal (v18.1)
   ==================================================================== */

/* AI Modal Specific Styles */
.ai-modal {
    max-width: 600px;
    width: 95%;
}

.ai-modal .modal-header {
    text-align: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.ai-modal .modal-icon {
    font-size: 2.5rem;
}

.ai-modal .modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-primary);
}

.ai-modal .modal-subtitle {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Upload Area */
.ai-upload-area {
    padding: 2rem;
    text-align: center;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    margin: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    background: var(--background-secondary);
}

.ai-upload-area:hover {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.05);
}

.ai-upload-area .upload-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.ai-upload-area .upload-text {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.ai-upload-area .upload-or {
    color: var(--text-secondary);
    margin: 0.5rem 0;
}

.upload-btn-label {
    display: inline-block;
}

.upload-btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}

.upload-btn:hover {
    background: var(--primary-dark);
}

.ai-upload-area .supported-formats {
    margin-top: 1rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* File Selected State */
.ai-file-selected {
    padding: 1.5rem;
}

.selected-file-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--background-secondary);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
}

.selected-file-info .file-icon {
    font-size: 2rem;
}

.selected-file-info .file-details {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.selected-file-info .file-name {
    font-weight: 600;
    color: var(--text-primary);
}

.selected-file-info .file-size {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.remove-file-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: var(--transition);
}

.remove-file-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* Language Selection */
.ai-language-select {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.ai-language-select label {
    font-weight: 500;
    color: var(--text-primary);
}

.ai-language-select select {
    flex: 1;
    padding: 0.6rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: white;
    font-size: 0.95rem;
}

/* Prompt Editor */
.prompt-editor-section {
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

.prompt-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.prompt-toggle:hover {
    background: var(--background-secondary);
}

.prompt-toggle-icon {
    font-size: 1.1rem;
}

.prompt-arrow {
    margin-left: auto;
    transition: transform 0.3s;
}

.prompt-editor-content {
    padding: 1rem;
    background: var(--background-secondary);
    border-radius: var(--radius-md);
    margin-top: 0.5rem;
}

.prompt-info {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem;
    background: rgba(99, 102, 241, 0.1);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.prompt-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: monospace;
    font-size: 0.85rem;
    resize: vertical;
    min-height: 120px;
}

.prompt-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.75rem;
}

.prompt-reset-btn {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.5rem 1rem;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition);
}

.prompt-reset-btn:hover {
    background: var(--background-secondary);
}

.prompt-status {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
}

/* Modal Footer Actions */
.ai-modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.ai-cancel-btn {
    padding: 0.75rem 1.5rem;
    background: var(--background-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}

.ai-cancel-btn:hover {
    background: var(--border-color);
}

.ai-process-btn {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.ai-process-btn:hover {
    filter: brightness(1.1);
}

.ai-process-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Processing State */
.ai-processing {
    text-align: center;
    padding: 2rem;
}

.ai-processing .spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

/* Result Area */
.ai-result-area {
    padding: 1.5rem;
}

.ai-result-textarea {
    width: 100%;
    min-height: 200px;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    line-height: 1.6;
    resize: vertical;
}

.ai-result-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}
