/* =====================================================
   PDF to JSON Tool - Additional Styles
   ===================================================== */

/* تنسيق حاوية الإخراج JSON */
.json-container {
    background: var(--bg-light, #f9fafb);
    padding: 1rem;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid var(--border, #e5e7eb);
}

/* قسم النتيجة (result-section) */
.result-section {
    margin-top: 24px;
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border, #e5e7eb);
    padding: 20px;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.result-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text, #111827);
    display: flex;
    align-items: center;
    gap: 8px;
}

.result-actions {
    display: flex;
    gap: 12px;
}

/* Action buttons inside tool-settings */
.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 20px;
    justify-content: center;
}

.btn {
    padding: 10px 20px;
    border-radius: 40px;
    font-weight: 600;
    transition: 0.2s;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary, #00008B);
    color: white;
}

.btn-primary:hover {
    background: #1e40af;
    transform: translateY(-1px);
}

.btn-success {
    background: var(--success, #10b981);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-secondary {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #334155;
}

.btn-secondary:hover {
    background: #e2e8f0;
}

/* Progress & messages inside tool-settings */
.progress-container {
    margin-top: 20px;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary, #00008B);
    width: 0%;
    transition: width 0.3s;
}

.progress-text {
    font-size: 13px;
    color: #4b5563;
    text-align: center;
    margin-top: 8px;
}

.success-message {
    margin-top: 16px;
    padding: 10px;
    background: #d1fae5;
    color: #065f46;
    border-radius: 8px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.error-message {
    margin-top: 16px;
    padding: 10px;
    background: #fee2e2;
    color: #991b1b;
    border-radius: 8px;
    text-align: center;
}

/* Drag-over effect for upload-area */
.upload-area.drag-over {
    border-color: var(--primary, #00008B) !important;
    background-color: rgba(0, 0, 139, 0.05) !important;
    box-shadow: 0 0 0 3px rgba(0, 0, 139, 0.2);
}

/* Responsive fine-tuning */
@media (max-width: 768px) {
    .preview-toolbar {
        gap: 8px;
    }
    .tool-settings {
        padding: 16px;
    }
    .file-row {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* استجابة للشاشات الصغيرة */
@media (max-width: 640px) {
    .result-header {
        flex-direction: column;
        align-items: stretch;
    }
    .result-actions {
        justify-content: center;
    }
}

/* ===== Page Selection Group ===== */
.page-selection-group {
    margin: 16px 0 20px;
    padding: 16px;
    background: var(--bg-light, #f9fafb);
    border-radius: 12px;
    border: 1px solid var(--border, #e5e7eb);
}

.page-selection-group label {
    font-weight: 600;
    font-size: 14px;
    color: var(--text, #1f2937);
    display: flex;
    align-items: center;
    gap: 10px;
}

.badge {
    display: inline-block;
    background: var(--primary, #2563eb);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    padding: 0 12px;
    border-radius: 20px;
    line-height: 24px;
    min-width: 40px;
    text-align: center;
}

.page-selection-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 8px;
}

.page-selection-controls input[data-tool-pages] {
    flex: 1;
    min-width: 180px;
    padding: 8px 12px;
    border: 1px solid var(--border-dark, #d1d5db);
    border-radius: 6px;
    font-size: 14px;
    background: var(--bg-white, #ffffff);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.page-selection-controls input[data-tool-pages]:focus {
    outline: none;
    border-color: var(--primary, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.page-selection-buttons {
    display: flex;
    gap: 6px;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
    border-radius: 6px;
}

.page-selection-hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-light, #6b7280);
}

.page-selection-hint i {
    margin-right: 4px;
}

/* ===== Thumbnails Section ===== */
.thumbnails-section {
    margin: 20px 0;
    display: none;
}

.thumbnails-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.thumbnails-header h4 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    color: var(--text, #1f2937);
}

.thumbnails-info {
    font-size: 12px;
    color: var(--text-light, #6b7280);
}

/* ===== Warning Message ===== */
.warning-message {
    max-width: var(--container-max, 720px);
    margin: 0 auto 16px;
    padding: 12px 16px;
    background: #fef3c7;
    color: #92400e;
    border-left: 4px solid #f59e0b;
    border-radius: 8px;
    font-size: 14px;
    display: none;
    align-items: center;
    gap: 8px;
}