/* ===============================
   Hide by default (clean)
=============================== */

.tool-wrapper [data-tool-action-buttons],
.tool-wrapper [data-tool-options-section],
.tool-wrapper [data-tool-files-container],
.tool-wrapper [data-tool-add-more-files] {
    display: none;
}


/* ===============================
   Show when visible
=============================== */

.tool-wrapper [data-tool-options-section].visible,
.tool-wrapper [data-tool-files-container].visible,
.tool-wrapper [data-tool-add-more-files].visible {
    display: block;
}

/* الأزرار */
.tool-wrapper [data-tool-action-buttons].visible {
    display: flex;
}


/* ===============================
   Upload always clickable
=============================== */

.upload-area {
    position: relative;
    z-index: 20;
}
.options-section {
            background: #f8fafc;
            border-radius: 1.5rem;
            padding: 1.5rem;
            margin: 1.5rem 0 2rem 0;
            border: 1px solid #e2e8f0;
        }
        .options-title {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            font-size: 1.2rem;
            font-weight: 600;
            color: #0f172a;
            margin-bottom: 1.2rem;
        }
        .options-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
            gap: 1.5rem;
        }
        .option-group {
            display: flex;
            flex-direction: column;
            gap: 0.6rem;
        }
        .option-label {
            font-weight: 600;
            color: #1e293b;
            font-size: 0.85rem;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }
        .option-select, .option-input {
            background: white;
            border: 1px solid #cbd5e1;
            border-radius: 1rem;
            padding: 0.6rem 1rem;
            font-size: 0.9rem;
            transition: 0.2s;
        }
        .option-select:focus, .option-input:focus {
            outline: none;
            border-color: #3b82f6;
            box-shadow: 0 0 0 3px rgba(59,130,246,0.2);
        }
        .checkbox-group {
            display: flex;
            align-items: center;
            gap: 0.6rem;
            margin: 0.3rem 0;
        }
        .checkbox-group label {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            cursor: pointer;
            font-weight: normal;
            color: #1e293b;
        }
        /* files grid */
        .files-container {
            display: flex;
            flex-wrap: wrap;
            gap: 1rem;
            margin: 1.8rem 0 1.5rem 0;
            min-height: 100px;
        }
        .file-card {
            background: #ffffff;
            border-radius: 1.2rem;
            padding: 0.8rem 1rem;
            width: 200px;
            display: flex;
            flex-direction: column;
            gap: 0.5rem;
            box-shadow: 0 2px 6px rgba(0,0,0,0.05);
            border: 1px solid #e9edf2;
            transition: 0.1s ease;
            position: relative;
        }
        .file-card:hover {
            border-color: #bfdbfe;
            transform: translateY(-2px);
        }
        .file-name {
            font-weight: 600;
            font-size: 0.85rem;
            word-break: break-word;
            color: #0f172a;
            display: flex;
            align-items: center;
            gap: 0.4rem;
        }
        .file-meta {
            font-size: 0.7rem;
            color: #5b6e8c;
            display: flex;
            justify-content: space-between;
        }
        .remove-file {
            background: #fee2e2;
            color: #b91c1c;
            border: none;
            border-radius: 2rem;
            padding: 0.2rem 0.6rem;
            font-size: 0.7rem;
            cursor: pointer;
            font-weight: 600;
            transition: 0.1s;
            align-self: flex-end;
        }
        .remove-file:hover {
            background: #fecaca;
        }
        /* action buttons */
        .action-buttons {
            display: flex;
            justify-content: flex-end;
            gap: 1rem;
            margin-top: 0.5rem;
            flex-wrap: wrap;
        }
        .btn {
            padding: 0.7rem 1.5rem;
            border-radius: 2rem;
            font-weight: 600;
            border: none;
            cursor: pointer;
            font-size: 0.9rem;
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
            transition: 0.2s;
        }
        .btn-secondary {
            background: #e2e8f0;
            color: #1e293b;
        }
        .btn-secondary:hover {
            background: #cbd5e1;
        }
        .btn-primary {
            background: #3b82f6;
            color: white;
            box-shadow: 0 2px 6px rgba(0,0,0,0.1);
        }
        .btn-primary:hover {
            background: #2563eb;
            transform: translateY(-1px);
        }
        /* toast & loading */
        .toast {
            position: fixed;
            bottom: 2rem;
            left: 50%;
            transform: translateX(-50%) scale(0.9);
            background: #1e293b;
            color: white;
            padding: 0.8rem 1.6rem;
            border-radius: 3rem;
            font-size: 0.85rem;
            font-weight: 500;
            opacity: 0;
            visibility: hidden;
            transition: all 0.2s ease;
            z-index: 1000;
            box-shadow: 0 10px 20px rgba(0,0,0,0.2);
            white-space: nowrap;
        }
        .toast.show {
            opacity: 1;
            visibility: visible;
            transform: translateX(-50%) scale(1);
        }
        .loading {
            display: none;
            text-align: center;
            background: #ffffffdd;
            backdrop-filter: blur(4px);
            padding: 1rem;
            border-radius: 2rem;
            margin: 0.5rem 0;
            color: #2563eb;
            font-weight: 500;
            gap: 0.6rem;
            align-items: center;
            justify-content: center;
        }
        .loading-spinner {
            animation: spin 1s linear infinite;
        }
        @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
        .error-message {
            display: none;
            background: #fee2e2;
            color: #b91c1c;
            padding: 0.8rem;
            border-radius: 1rem;
            margin: 0.8rem 0;
            font-size: 0.85rem;
            text-align: center;
            border-left: 4px solid #ef4444;
        }
        @media (max-width: 680px) {
            .tool-wrapper[data-tool="merge-pdf-text-test"] {
                padding: 1.5rem;
            }
            .files-container {
                justify-content: center;
            }
        }
        
        