@import url('/common/css/site.css');

.tool-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem 4rem;
}

/* Breadcrumb */
.tool-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.tool-breadcrumb a {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 500;
}

.tool-breadcrumb a:hover {
    text-decoration: underline;
}

.tool-breadcrumb .separator {
    opacity: 0.5;
}

/* Hero — split layout */
.tool-hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: start;
    padding: 3rem 0 4rem;
}

.tool-hero-left .section-label {
    display: inline-block;
    margin-bottom: 0.85rem;
    color: var(--accent-primary);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.tool-hero-left h1 {
    font-size: clamp(2rem, 4vw, 3rem);
    color: var(--text-primary);
    line-height: 1.15;
    margin-bottom: 1rem;
}

.tool-hero-desc {
    font-size: 1.1rem;
    color: var(--text-secondary);
    line-height: 1.7;
    max-width: 520px;
    margin-bottom: 2rem;
}

.tool-trust-inline {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
}

.tool-trust-inline li {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.88rem;
    color: var(--text-muted);
    font-weight: 500;
}

.tool-trust-inline li::before {
    content: '✓';
    color: var(--accent-primary);
    font-weight: 700;
}

/* Workspace (right side of hero) */
.tool-workspace {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.tool-workspace .file-drop-zone {
    min-height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2rem;
    border: 2px dashed rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.02);
    transition: all 0.25s ease;
    cursor: pointer;
    text-align: center;
}

.tool-workspace .file-drop-zone:hover,
.tool-workspace .file-drop-zone.dragover {
    border-color: var(--accent-primary);
    background: rgba(0, 212, 170, 0.04);
}

.tool-workspace .file-drop-zone .drop-icon {
    font-size: 2.5rem;
    opacity: 0.6;
}

.tool-workspace .file-drop-zone p {
    color: var(--text-secondary);
    font-size: 1rem;
}

.tool-workspace .file-drop-zone .btn {
    margin-top: 0.5rem;
}

.tool-workspace .tool-options {
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.tool-workspace .tool-options h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.tool-workspace .option-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.tool-workspace .option-group label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.85rem;
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.tool-workspace .option-group label:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.tool-workspace .option-group input[type="radio"],
.tool-workspace .option-group input[type="checkbox"] {
    accent-color: var(--accent-primary);
    width: 16px;
    height: 16px;
}

.tool-workspace .option-group input[type="text"],
.tool-workspace .option-group input[type="password"] {
    width: 100%;
    padding: 0.85rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.tool-workspace .option-group input[type="text"]:focus,
.tool-workspace .option-group input[type="password"]:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: rgba(0, 212, 170, 0.05);
}

.tool-workspace .option-group input[type="text"]::placeholder,
.tool-workspace .option-group input[type="password"]::placeholder {
    color: var(--text-muted);
}

.tool-workspace .option-group input[type="range"] {
    width: 100%;
    height: 6px;
    appearance: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    margin: 0.5rem 0;
}

.tool-workspace .option-group input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--accent-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 212, 170, 0.5);
}

.tool-workspace .option-group input[type="color"] {
    width: 50px;
    height: 36px;
    padding: 2px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.tool-workspace .btn.primary {
    width: 100%;
    margin-top: 0.5rem;
}

.tool-workspace .file-item {
    display: flex;
    justify-content: space-between;
    padding: 0.6rem 0.85rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Success state */
.btn.success {
    background: linear-gradient(135deg, #00d4aa, #00b894) !important;
    color: #000 !important;
    pointer-events: none;
}

/* Merge file items */
.merge-file-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    background: rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.merge-file-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-subtle);
}

.merge-file-item .drag-handle {
    cursor: grab;
    color: var(--text-muted);
    font-size: 1.2rem;
}

.merge-file-item .drag-handle:active { cursor: grabbing; }

.merge-file-item .file-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--accent-gradient);
    color: #000;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 50%;
    flex-shrink: 0;
}

.merge-file-item .file-info {
    flex-grow: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.merge-file-item .file-name {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.merge-file-item .file-details {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.merge-file-item .remove-btn {
    color: var(--accent-secondary);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    transition: all 0.2s ease;
}

.merge-file-item .remove-btn:hover {
    color: #ff4444;
    transform: scale(1.1);
}

.sortable-ghost {
    opacity: 0.4;
    background: rgba(0, 212, 170, 0.15);
    border: 1px dashed var(--accent-primary);
}

/* Page selector */
.page-selector h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

#page-checkboxes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
}

.page-checkbox {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.page-checkbox:hover { background: rgba(255, 255, 255, 0.1); }

.page-checkbox input {
    margin-right: 0.5rem;
    accent-color: var(--accent-primary);
    width: 16px;
    height: 16px;
}

.page-checkbox label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
}

/* Page order list (rearrange) */
#page-order-list {
    min-height: 80px;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
}

.page-order-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
}

.page-order-item:hover { background: rgba(255, 255, 255, 0.1); }
.page-order-item .drag-handle { cursor: grab; color: var(--text-muted); font-size: 1.2rem; }
.page-order-item .drag-handle:active { cursor: grabbing; }
.page-order-item .page-number { flex-grow: 1; color: var(--text-secondary); }
.page-order-item .remove-btn { color: var(--accent-secondary); cursor: pointer; transition: all 0.2s ease; }
.page-order-item .remove-btn:hover { color: #ff4444; transform: scale(1.1); }

/* Signature upload */
.signature-upload h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.signature-upload input[type="file"] {
    width: 100%;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
}

/* How it works */
.how-it-works {
    padding: 3rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.how-it-works h2 {
    font-size: clamp(1.5rem, 2.5vw, 2rem);
    color: var(--text-primary);
    margin-bottom: 2rem;
}

.steps-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: step;
}

.step-item {
    position: relative;
    padding: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    counter-increment: step;
}

.step-item::before {
    content: counter(step);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--accent-gradient);
    color: #000;
    font-size: 0.9rem;
    font-weight: 700;
    border-radius: 50%;
    margin-bottom: 1rem;
}

.step-item strong {
    display: block;
    color: var(--text-primary);
    font-size: 1.05rem;
    margin-bottom: 0.4rem;
}

.step-item p {
    color: var(--text-secondary);
    font-size: 0.92rem;
    line-height: 1.6;
}

/* Related workflow suggestions */
.next-steps {
    padding: 3rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.next-steps h2 {
    font-size: clamp(1.5rem, 2.5vw, 2rem);
    color: var(--text-primary);
    margin-bottom: 2rem;
}

.workflow-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
}

.workflow-card {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    text-decoration: none;
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.workflow-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-accent);
    box-shadow: var(--glow-accent);
}

.workflow-card strong {
    color: var(--text-primary);
    font-size: 1.05rem;
}

.workflow-card span {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Privacy explainer */
.privacy-explainer {
    padding: 3rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.privacy-explainer h2 {
    font-size: clamp(1.5rem, 2.5vw, 2rem);
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

.privacy-explainer ul {
    list-style: none;
    padding: 0;
    margin: 0 0 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.privacy-explainer li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-secondary);
    font-size: 1rem;
}

.privacy-explainer li::before {
    content: '🛡️';
    font-size: 1.1rem;
}

.privacy-explainer details {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
}

.privacy-explainer summary {
    cursor: pointer;
    color: var(--accent-primary);
    font-weight: 600;
    font-size: 0.95rem;
}

.privacy-explainer details p {
    margin-top: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.92rem;
    line-height: 1.7;
}

/* FAQ */
.faq {
    padding: 3rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.faq h2 {
    font-size: clamp(1.5rem, 2.5vw, 2rem);
    color: var(--text-primary);
    margin-bottom: 2rem;
}

.faq-item {
    margin-bottom: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    transition: border-color 0.2s ease;
}

.faq-item[open] {
    border-color: var(--border-accent);
}

.faq-item summary {
    cursor: pointer;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1rem;
    line-height: 1.5;
}

.faq-item p {
    margin-top: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.7;
}

.pdf-error-banner {
    background: rgba(255, 107, 107, 0.12);
    color: #ff8a8a;
    border: 1px solid rgba(255, 107, 107, 0.35);
    border-radius: var(--radius-sm);
    padding: 0.8rem 0.9rem;
    font-size: 0.92rem;
}

.pdf-progress-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.45rem;
}

.pdf-progress-track {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    overflow: hidden;
}

.pdf-progress-fill {
    display: block;
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, #00d4aa, #00b4d8);
    transition: width 0.2s ease;
}

.extract-images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.extract-image-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.extract-image-card img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: contain;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.05);
}

.extract-image-meta {
    display: grid;
    gap: 0.2rem;
}

.extract-image-meta strong {
    color: var(--text-primary);
    font-size: 0.95rem;
}

.extract-image-meta span {
    color: var(--text-secondary);
    font-size: 0.84rem;
}

.crop-preview-wrap {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.6rem;
    background: rgba(255, 255, 255, 0.03);
}

.crop-preview-stage {
    position: relative;
    width: 100%;
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.28);
}

.crop-preview-stage canvas {
    max-width: 100%;
    max-height: 70vh;
    display: block;
}

.crop-rect {
    position: absolute;
    border: 2px solid #00d4aa;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.35);
    touch-action: none;
    cursor: move;
}

.crop-handle {
    position: absolute;
    width: 14px;
    height: 14px;
    right: -8px;
    bottom: -8px;
    border-radius: 50%;
    background: #00d4aa;
    border: 2px solid #0b0c0f;
    cursor: nwse-resize;
}

.tool-options .option-group select {
    width: 100%;
    min-height: 44px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    padding: 0.5rem 0.65rem;
}

/* Responsive */
@media (max-width: 900px) {
    .tool-hero {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 2rem 0 3rem;
    }

    .tool-hero-right {
        order: -1;
    }

    .tool-page {
        padding: 0 1.25rem 3rem;
    }
}

@media (max-width: 480px) {
    .steps-list {
        grid-template-columns: 1fr;
    }

    .workflow-grid {
        grid-template-columns: 1fr;
    }

    .tool-trust-inline {
        flex-direction: column;
        gap: 0.4rem;
    }

    .tool-workspace {
        padding: 1.25rem;
    }
}
