/* ==========================================
   PDF to HTML Tool - Styling
   متوافق مع تصميم PDF to EPS
   ========================================== */

/* ===== Variables ===== */
:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary: #f3f4f6;
    --secondary-hover: #e5e7eb;
    --text: #1f2937;
    --text-light: #6b7280;
    --border: #e5e7eb;
    --bg-light: #f9fafb;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.1);
}

/* ===== Main Container ===== */
.tool-wrapper {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}



/* ===== File Info ===== */
.file-info {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto 20px;
    display: none;
}
.file-details {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.file-details span:first-child {
    font-size: 24px;
}
.file-details strong {
    font-weight: 600;
    color: var(--text);
}
.file-details .file-size {
    font-size: 13px;
    color: var(--text-light);
}
.file-remove {
    margin-left: auto;
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 18px;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.15s;
}
.file-remove:hover {
    background: #fee2e2;
}

/* ===== Options Panel (مطابق لـ .tool-settings) ===== */
.options-panel {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto 20px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-sizing: border-box;
    box-shadow: var(--shadow);
    display: none;
}
.options-panel h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 16px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px 32px;
    align-items: start;
}
.option-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.option-group label {
    font-weight: 500;
    font-size: 14px;
    color: var(--text);
}
.option-group select,
.option-group input[type="text"],
.option-group input[type="range"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}
.option-group select:focus,
.option-group input[type="text"]:focus,
.option-group input[type="range"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.option-group input[type="range"] {
    padding: 0;
    background: transparent;
    cursor: pointer;
}
.option-group .range-value {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
}
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}
.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}
.checkbox-group label {
    font-weight: 400;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
}

/* ===== Action Buttons ===== */
/* =====================================================
   Action Buttons داخل Output Section
   ===================================================== */
.output-section .output-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 16px;
    flex-wrap: wrap;
}

.output-section .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    border: none;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    box-shadow: var(--shadow);
}

/* ===== زر التحميل (Download) ===== */
.output-section .btn-download {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff !important; /* تأكيد اللون الأبيض */
}

.output-section .btn-download:hover {
    background: linear-gradient(135deg, #059669, #047857);
    color: #ffffff !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.output-section .btn-download:active {
    transform: translateY(0) scale(0.96);
}

.output-section .btn-download:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ===== زر النسخ (Copy) ===== */
.output-section .btn-copy {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff !important; /* تأكيد اللون الأبيض */
}

.output-section .btn-copy:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    color: #ffffff !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.output-section .btn-copy:active {
    transform: translateY(0) scale(0.96);
}

.output-section .btn-copy:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ===== أيقونات الأزرار ===== */
.output-section .btn i {
    font-size: 16px;
    color: inherit !important; /* تأكيد أن الأيقونة تأخذ لون النص */
}

/* ===== حالة النجاح عند النسخ ===== */
.output-section .btn-copy.copied {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #ffffff !important;
}

.output-section .btn-copy.copied:hover {
    background: linear-gradient(135deg, #16a34a, #15803d);
    color: #ffffff !important;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
    .output-section .output-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .output-section .btn {
        justify-content: center;
        width: 100%;
    }
}

/* ===== Progress Bar ===== */
.progress-container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto 16px;
    position: relative;
    height: 24px;
    background: var(--border);
    border-radius: 30px;
    overflow: hidden;
    display: none;
}
.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), #4f46e5);
    border-radius: 30px;
    transition: width 0.3s ease;
}
.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
}

/* ===== Messages ===== */
.message {
    width: 100%;
    max-width: 1100px;
    margin: 12px auto;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    display: none;
    align-items: center;
    gap: 8px;
    box-sizing: border-box;
}
.message-success {
    background: #d1fae5;
    color: #065f46;
    border-left: 4px solid #10b981;
}
.message-error {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid #ef4444;
}
.loading {
    width: 100%;
    max-width: 1100px;
    margin: 12px auto;
    display: none;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #f0f9ff;
    border-radius: 8px;
    color: #1e40af;
    font-size: 14px;
    border-left: 4px solid #3b82f6;
    box-sizing: border-box;
}
.loading span {
    font-size: 20px;
}

/* ===== Output Section ===== */
.output-section {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto 20px;
    display: none;
}
.output-section h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.output-preview {
    background: #fafafa;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    max-height: 400px;
    overflow: auto;
    font-size: 12px;
    font-family: monospace;
    white-space: pre-wrap;
    word-break: break-all;
    box-shadow: var(--shadow);
}
.output-preview code {
    font-family: inherit;
    background: transparent;
}

/* ===== Smart Funnel (إخفاء في البداية) ===== */
.smart-funnel {
    display: none;
}
.smart-funnel.show {
    display: block;
}
.smart-funnel.hidden {
    display: none;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .tool-wrapper {
        padding: 0 12px;
    }
    .upload-area {
        padding: 30px 16px;
    }
    .upload-text {
        font-size: 18px;
    }
    .options-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .action-buttons {
        flex-direction: column;
        align-items: stretch;
    }
    .action-buttons .btn {
        justify-content: center;
        width: 100%;
    }
    .file-details {
        flex-wrap: wrap;
        gap: 8px;
    }
    .file-remove {
        margin-left: 0;
    }
    .output-preview {
        max-height: 300px;
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .upload-icon {
        font-size: 36px;
    }
    .upload-text {
        font-size: 16px;
    }
    .upload-hint {
        font-size: 13px;
    }
    .upload-btn {
        padding: 8px 18px;
        font-size: 13px;
    }
}