/* =========================================================
   TOOLS FULL-PAGE LAYOUT
   Shared by merge-tool.html, split-tool.html, compress-tool.html,
   convert-tool.html. Uses the same [data-theme] variables defined
   in style.css, so light/dark both work automatically.
========================================================= */

.mtool-header {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding-bottom: 28px;
    margin-bottom: 28px;
    border-bottom: 1px solid var(--hairline);
    flex-wrap: wrap;
}

.mtool-icon {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: var(--accent-gradient);
}

.mtool-icon svg {
    width: 26px;
    height: 26px;
    fill: none;
    stroke: #fff;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.mtool-header-text {
    flex: 1 1 320px;
    min-width: 240px;
}

.mtool-header-text h1 {
    font-size: 26px;
    font-weight: 800;
    color: var(--text-heading);
    margin-bottom: 4px;
}

.mtool-header-text > p {
    font-size: 14.5px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.mtool-subnote {
    font-size: 13px;
    color: var(--text-muted);
}

.mtool-badges {
    display: flex;
    flex: 1 1 100%;
    width: 100%;
    justify-content: center;
    align-items: center;
    gap: 34px;
    flex-wrap: wrap;
    margin: 4px auto 0;
}

.mtool-badge {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mtool-badge-icon {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(108, 91, 255, 0.12);
}

.mtool-badge-icon svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: var(--accent-purple);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.mtool-badge strong {
    display: block;
    font-size: 13.5px;
    color: var(--text-primary);
}

.mtool-badge span {
    font-size: 12px;
    color: var(--text-muted);
}

/* ===== layout: main column + settings sidebar ===== */

.mtool-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 24px;
    align-items: start;
}

.mtool-main { min-width: 0; }

/* ===== dropzone ===== */

.mtool-dropzone {
    border: 2px dashed var(--upload-inner-border);
    border-radius: 16px;
    background: var(--upload-bg);
    padding: 56px 24px;
    text-align: center;
    margin-bottom: 22px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.mtool-dropzone.dragging {
    border-color: var(--upload-drag-border);
    box-shadow: var(--upload-drag-shadow);
}

.mtool-dropzone-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mtool-dropzone-icon svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: var(--accent-purple);
    stroke-width: 1.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.mtool-dropzone-title {
    font-size: 17px;
    font-weight: 650;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.mtool-dropzone-or {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.mtool-choose-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    background: var(--accent-gradient);
    color: #fff;
    font-size: 14px;
    font-weight: 650;
    cursor: pointer;
}

.mtool-choose-btn:hover { filter: brightness(1.08); }

.mtool-choose-btn svg {
    width: 16px; height: 16px;
    fill: none; stroke: #fff;
    stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
}

.mtool-dropzone-hint {
    font-size: 12.5px;
    color: var(--text-muted);
    margin-top: 14px;
}

/* ===== file list ===== */

.mtool-files-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.mtool-files-header span {
    font-size: 14.5px;
    font-weight: 650;
    color: var(--text-primary);
}

.mtool-clear-all {
    font-size: 13px;
    color: var(--purple-text);
    text-decoration: none;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font-family: inherit;
    cursor: pointer;
}

.mtool-clear-all:hover { text-decoration: underline; }

.mtool-file-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 22px;
}

.mtool-file-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border-softer);
    border-radius: 12px;
    background: var(--card-bg-alt);
}

.mtool-drag-handle {
    color: var(--text-muted);
    cursor: grab;
    font-size: 15px;
    user-select: none;
}

.mtool-file-icon {
    flex-shrink: 0;
    width: 34px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: linear-gradient(160deg, #ff6a6a, #e6394a);
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.mtool-file-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mtool-file-info strong {
    font-size: 13.5px;
    color: var(--text-primary);
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mtool-file-info span {
    font-size: 12px;
    color: var(--text-muted);
}

.mtool-icon-btn {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
}

.mtool-icon-btn:hover {
    background: var(--input-bg);
    color: var(--text-primary);
}

.mtool-icon-btn svg {
    width: 16px; height: 16px;
    fill: none; stroke: currentColor;
    stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}

.mtool-empty-hint {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    padding: 6px 0 18px;
}

/* ===== settings sidebar ===== */

.mtool-settings {
    border: 1px solid var(--border-softer);
    border-radius: 16px;
    background: var(--card-bg);
    box-shadow: var(--card-shadow);
    padding: 22px;
    position: sticky;
    top: 90px;
}

.mtool-settings h4 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-heading);
    margin-bottom: 18px;
}

.mtool-setting-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--hairline);
}

.mtool-setting-row.select {
    cursor: pointer;
    align-items: center;
}

.mtool-setting-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(108, 91, 255, 0.12);
}

.mtool-setting-icon svg {
    width: 15px; height: 15px;
    fill: none; stroke: var(--accent-purple);
    stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}

.mtool-setting-row strong {
    display: block;
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 600;
}

.mtool-setting-row span {
    font-size: 11.5px;
    color: var(--text-muted);
}

.mtool-chevron {
    margin-left: auto;
    width: 14px; height: 14px;
    fill: none; stroke: var(--text-muted);
    stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

.mtool-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--hairline);
}

.mtool-toggle-row strong {
    display: block;
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 600;
}

.mtool-toggle-row span {
    font-size: 11.5px;
    color: var(--text-muted);
}

.mtool-switch {
    position: relative;
    flex-shrink: 0;
    width: 38px;
    height: 22px;
}

.mtool-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.mtool-switch span {
    position: absolute;
    inset: 0;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 999px;
    transition: background 0.15s ease;
}

.mtool-switch span::before {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    left: 2px;
    top: 2px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.15s ease;
}

.mtool-switch input:checked + span {
    background: var(--accent-gradient);
    border-color: transparent;
}

.mtool-switch input:checked + span::before {
    transform: translateX(16px);
}

.mtool-merge-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
    padding: 13px 18px;
    border: none;
    border-radius: 10px;
    background: var(--accent-gradient);
    color: #fff;
    font-size: 14.5px;
    font-weight: 700;
    cursor: pointer;
}

.mtool-merge-btn:hover { filter: brightness(1.08); }
.mtool-merge-btn:disabled { opacity: 0.45; cursor: not-allowed; filter: none; }

.mtool-merge-btn svg {
    width: 16px; height: 16px;
    fill: none; stroke: #fff;
    stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
}

.mtool-secure-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 16px;
    font-size: 11.5px;
    color: var(--text-muted);
    line-height: 1.5;
}

.mtool-secure-note svg {
    flex-shrink: 0;
    width: 15px; height: 15px;
    margin-top: 1px;
    fill: none; stroke: var(--text-muted);
    stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}

/* Shared alignment override: keep security copy centered on every PDF tool. */
.mtool-secure-note {
    justify-content: center;
    align-items: center;
    text-align: center;
    width: 100%;
}

/* ===== bottom trust strip ===== */

.mtool-trust-strip {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--hairline);
}

.mtool-trust-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mtool-trust-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(108, 91, 255, 0.12);
}

.mtool-trust-icon svg {
    width: 18px; height: 18px;
    fill: none; stroke: var(--accent-purple);
    stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

.mtool-trust-item strong {
    display: block;
    font-size: 13.5px;
    color: var(--text-primary);
}

.mtool-trust-item span {
    font-size: 12px;
    color: var(--text-muted);
}

/* ===== tool-specific option cards (compress levels / split modes) ===== */

.mtool-option-label {
    font-size: 13px;
    font-weight: 650;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.mtool-option-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 22px;
}

.mtool-option-card {
    position: relative;
    display: block;
    padding: 14px;
    border: 1.5px solid var(--border-softer);
    border-radius: 12px;
    background: var(--card-bg-alt);
    cursor: pointer;
}

.mtool-option-card input { position: absolute; opacity: 0; }

.mtool-option-card.active {
    border-color: var(--accent-purple);
    background: rgba(108, 91, 255, 0.08);
}

.mtool-option-card strong {
    display: block;
    font-size: 13.5px;
    color: var(--text-primary);
    margin-bottom: 3px;
}

.mtool-option-card span {
    font-size: 12px;
    color: var(--text-muted);
}

.mtool-input {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--input-border);
    border-radius: 10px;
    background: var(--input-bg);
    color: var(--text-primary);
    font-size: 13.5px;
    margin-bottom: 8px;
}

.mtool-input-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* ===== convert type grid (choose target format) ===== */

.mtool-type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
    margin-bottom: 22px;
}

.mtool-type-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 10px;
    border: 1.5px solid var(--border-softer);
    border-radius: 12px;
    background: var(--card-bg-alt);
    cursor: pointer;
    text-align: center;
}

.mtool-type-card:hover,
.mtool-type-card.active {
    border-color: var(--accent-purple);
    background: rgba(108, 91, 255, 0.08);
}

.mtool-type-icon {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(108, 91, 255, 0.14);
}

.mtool-type-icon svg {
    width: 17px; height: 17px;
    fill: none; stroke: var(--accent-purple);
    stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}

.mtool-type-card strong {
    font-size: 12.5px;
    color: var(--text-primary);
}

/* ===== processing / progress state (shown after submit) ===== */

.mtool-progress-view { text-align: center; padding: 40px 10px; }

.mtool-progress-icon {
    width: 60px; height: 60px;
    margin: 0 auto 18px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: rgba(108, 91, 255, 0.14);
}

.mtool-progress-icon svg {
    width: 26px; height: 26px;
    fill: none; stroke: var(--accent-purple);
    stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

.mtool-progress-title {
    font-size: 16px; font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.mtool-progress-sub {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 22px;
}

.mtool-progress-track {
    height: 8px;
    border-radius: 999px;
    background: var(--input-bg);
    overflow: hidden;
    margin-bottom: 8px;
}

.mtool-progress-fill {
    height: 100%;
    border-radius: 999px;
    background: var(--accent-gradient);
    transition: width 0.25s ease;
}

.mtool-progress-pct {
    font-size: 12.5px;
    color: var(--text-muted);
}

.mtool-error-banner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid rgba(255, 100, 124, 0.35);
    border-radius: 10px;
    background: rgba(255, 100, 124, 0.08);
    color: #ff647c;
    font-size: 13px;
    margin-bottom: 18px;
}

/* ===== responsive ===== */

@media (max-width: 900px) {
    .mtool-layout { grid-template-columns: 1fr; }
    .mtool-settings { position: static; }
    .mtool-badges { margin-left: 0; }
    .mtool-trust-strip { grid-template-columns: 1fr; }
}

/* ===== CRITICAL: utility class used everywhere to toggle visibility.
   (This was missing — the bug that caused every "hidden" section to
   render stacked on top of each other.) ===== */
.hidden {
    display: none !important;
}

/* ===== step-by-step processing checklist (shown during the progress view) ===== */
.mtool-step-list {
    text-align: left;
    max-width: 360px;
    margin: 24px auto 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mtool-step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 4px;
    opacity: 0.4;
    transform: translateY(2px);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.mtool-step.active {
    opacity: 1;
    transform: translateY(0);
}

.mtool-step-check {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1.5px solid var(--border-softer);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.25s ease, border-color 0.25s ease;
}

.mtool-step-check svg {
    width: 11px;
    height: 11px;
    fill: none;
    stroke: #fff;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.mtool-step.active .mtool-step-check {
    border-color: transparent;
}

.mtool-step.pending .mtool-step-check {
    background: var(--accent-gradient);
    animation: mtool-step-pulse 1s ease-in-out infinite;
}

.mtool-step.done .mtool-step-check {
    background: #2ee6a6;
}

.mtool-step.done .mtool-step-check svg {
    opacity: 1;
}

@keyframes mtool-step-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
}

.mtool-step-label {
    flex: 1;
    font-size: 13px;
    color: var(--text-secondary);
}

.mtool-step.active .mtool-step-label {
    color: var(--text-primary);
}

.mtool-step-status {
    font-size: 12px;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.mtool-step.done .mtool-step-status {
    opacity: 1;
    color: #2ee6a6;
}