/* =========================================
   🔥 Tool Layout (Centered - أهم تعديل)
========================================= */
.tool-wrapper {
    max-width: 950px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* =========================================
   Card System
========================================= */
.tool-settings,
.file-box,
.output-section,
.progress-container,
.success-message,
.error-message {
    background: #ffffff;
    border-radius: 1rem;
    box-shadow: var(--shadow);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    border: 1px solid #f1f5f9;
}

/* =========================================
   File Box
========================================= */
.file-box {
    transition: 0.2s;
}

.file-box:hover {
    box-shadow: 0 8px 20px rgba(0,0,0,0.05);
}

.file-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
}

.file-icon {
    font-size: 1.4rem;
    color: var(--primary);
}

.file-name {
    flex: 1;
    font-weight: 600;
    color: #0f172a;
    font-size: 0.9rem;
    word-break: break-all;
}

.file-size {
    font-size: 0.75rem;
    color: #64748b;
    background: #f1f5f9;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
}

.remove-file {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 1.1rem;
    transition: 0.2s;
}

.remove-file:hover {
    color: var(--error);
}

/* =========================================
   Options Section
========================================= */
.tool-settings h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #1e293b;
}

.options-grid {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.option-group {
    flex: 1;
    min-width: 220px;
}

.option-group label {
    font-weight: 600;
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 0.3rem;
    display: block;
}

/* Inputs */
.option-select {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    font-size: 0.85rem;
    transition: 0.2s;
}

.option-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(44,125,160,0.1);
}

/* Checkbox */
.option-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.4rem;
    font-size: 0.85rem;
}

.option-checkbox input {
    accent-color: var(--primary);
}

/* =========================================
   Progress Bar
========================================= */
.progress-container {
    height: 1.8rem;
    padding: 0;
    overflow: hidden;
    position: relative;
    border-radius: 999px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    transition: width 0.3s ease;
}

.progress-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: #1e293b;
}

/* =========================================
   Messages
========================================= */
.success-message {
    background: #ecfdf5;
    color: #059669;
    border-left: 4px solid #10b981;
}

.error-message {
    background: #fee2e2;
    color: #dc2626;
    border-left: 4px solid #ef4444;
}

/* =========================================
   Loading
========================================= */
.loading {
    text-align: center;
    padding: 1rem;
}

.loading-spinner {
    font-size: 1.5rem;
    animation: spin 1s linear infinite;
    color: var(--primary);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* =========================================
   Output Section
========================================= */
.output-section {
    margin-top: 2rem;
}

.section-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Markdown Viewer */
.markdown-preview {
    background: #0f172a;
    color: #e2e8f0;
    border-radius: 0.75rem;
    padding: 1rem;
    max-height: 400px;
    min-height: 200px;   /* 🔥 ده أهم سطر */
    display: block;
    overflow: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    border: 1px solid #1e293b;
}

.markdown-preview:empty::before {
    content: "Markdown content will appear here...";
    color: #94a3b8;
    font-style: italic;
}

/* =========================================
   Buttons
========================================= */
.action-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

.btn {
    border-radius: 999px;
    padding: 0.55rem 1.3rem;
    font-size: 0.85rem;
    transition: 0.2s;
}

.btn:hover {
    transform: translateY(-1px);
}

/* =========================================
   Responsive
========================================= */
@media (max-width: 640px) {

    .tool-wrapper {
        padding: 0 0.75rem;
    }

    .options-grid {
        flex-direction: column;
        gap: 1rem;
    }

    .action-buttons {
        justify-content: center;
    }

    .file-row {
        flex-direction: column;
        align-items: flex-start;
    }
}