/* ════════════════════════════════════════════════════════════
   Tool pages — QR Generator, AI Detector, WhatsApp Link
   ════════════════════════════════════════════════════════════ */

.section--tool {
    padding-top: clamp(40px, 5vw, 64px);
    padding-bottom: clamp(64px, 8vw, 96px);
}

/* ── Two-column tool layout ────────────────────────────────── */
.tool-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(32px, 5vw, 64px);
    align-items: start;
    max-width: var(--max);
    margin: 0 auto;
}

/* ── Config panel (left) ───────────────────────────────────── */
.tool-config {
    background: var(--paper);
    border: 2px solid var(--ink);
    border-radius: 0;
    padding: clamp(24px, 3vw, 36px);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.tool-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tool-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.tool-input,
.tool-select {
    width: 100%;
    padding: 12px 14px;
    min-height: 44px;
    border: 2px solid var(--ink);
    border-radius: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--mono);
    font-size: 14px;
    transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
    -webkit-appearance: none;
    appearance: none;
}

.tool-input:focus,
.tool-select:focus {
    outline: none;
    border-color: var(--ink);
    background: var(--bone-2);
    box-shadow: 4px 4px 0 var(--ink);
}

.tool-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23787774' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
    cursor: pointer;
}

.tool-input::placeholder {
    color: var(--muted-2);
}

textarea.tool-input {
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
}

.tool-color {
    width: 100%;
    height: 44px;
    border: 2px solid var(--ink);
    border-radius: 0;
    cursor: pointer;
    background: var(--paper);
    padding: 4px;
}

.tool-color::-webkit-color-swatch-wrapper { padding: 0; }
.tool-color::-webkit-color-swatch { border: none; border-radius: 0; }
.tool-color::-moz-color-swatch { border: none; border-radius: 0; }

.tool-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.tool-divider {
    height: 2px;
    background: var(--ink);
    margin: 4px 0;
}

.tool-section-title {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted-2);
}

.tool-generate-btn {
    margin-top: 8px;
    min-height: 48px;
    font-size: 14px;
}

/* ── Preview panel (right) ─────────────────────────────────── */
.tool-preview {
    position: sticky;
    top: 88px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

.tool-preview__canvas {
    width: 100%;
    background: var(--paper);
    border: 2px solid var(--ink);
    border-radius: 0;
    padding: clamp(24px, 3vw, 40px);
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.tool-preview__canvas canvas,
.tool-preview__canvas img {
    max-width: 100%;
    height: auto;
    border-radius: 0;
}

.tool-preview__placeholder {
    text-align: center;
    color: var(--muted);
}

.tool-preview__icon {
    font-size: 48px;
    color: var(--muted-2);
    display: block;
    margin-bottom: 16px;
}

.tool-preview__placeholder p {
    font-size: 14px;
    color: var(--muted);
}

.tool-preview__hint {
    font-size: 12px !important;
    color: var(--muted-2) !important;
    margin-top: 4px;
}

.tool-download {
    width: 100%;
    background: var(--bone);
    border: 2px solid var(--ink);
    border-radius: 0;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.tool-download__label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.tool-download__btns {
    display: flex;
    gap: 8px;
}

/* ── AI Detector specific ──────────────────────────────────── */
.ai-dropzone {
    width: 100%;
    min-height: 280px;
    border: 2px dashed var(--ink);
    border-radius: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
    background: var(--bone-2);
}

.ai-dropzone:hover,
.ai-dropzone.is-dragover {
    border-color: var(--ink);
    background: var(--bone);
    box-shadow: 4px 4px 0 var(--ink);
}

.ai-dropzone__icon {
    font-size: 48px;
    color: var(--muted-2);
}

.ai-dropzone__text {
    font-size: 14px;
    color: var(--muted);
}

.ai-dropzone__hint {
    font-size: 12px;
    color: var(--muted-2);
}

.ai-dropzone__browse {
    margin-top: 8px;
}

.ai-preview {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.ai-preview__image {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--bone);
}

.ai-result {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ai-result__score {
    display: flex;
    align-items: center;
    gap: 20px;
}

.ai-result__gauge {
    position: relative;
    width: 120px;
    height: 120px;
    flex-shrink: 0;
}

.ai-result__gauge svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.ai-result__gauge-bg {
    fill: none;
    stroke: var(--line);
    stroke-width: 8;
}

.ai-result__gauge-fill {
    fill: none;
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 1.2s var(--ease);
}

.ai-result__gauge-text {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.ai-result__gauge-value {
    font-size: 24px;
    line-height: 1;
    font-family: var(--display);
    font-synthesis: none;
}

.ai-result__gauge-label {
    font-size: 10px;
    color: var(--muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-top: 2px;
}

.ai-result__verdict {
    flex: 1;
}

.ai-result__verdict-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 700;
    padding: 8px 16px;
    border-radius: 999px;
    margin-bottom: 8px;
}

.ai-result__verdict-badge--ai {
    background: var(--pale-red);
    color: var(--red-text);
}
.ai-result__verdict-badge--likely-ai {
    background: var(--pale-yellow);
    color: var(--yellow-text);
}
.ai-result__verdict-badge--uncertain {
    background: var(--bone);
    color: var(--muted);
}
.ai-result__verdict-badge--likely-real {
    background: var(--pale-blue);
    color: var(--blue-text);
}
.ai-result__verdict-badge--real {
    background: var(--pale-green);
    color: var(--green-text);
}

.ai-result__verdict-desc {
    font-size: 13px;
    color: var(--muted);
    line-height: 1.6;
}

.ai-result__details {
    background: var(--bone);
    border: 2px solid var(--ink);
    border-radius: 0;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ai-result__detail-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    font-size: 13px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
}

.ai-result__detail-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.ai-result__detail-label {
    color: var(--muted);
    font-weight: 500;
    flex-shrink: 0;
}

.ai-result__detail-value {
    color: var(--ink);
    text-align: right;
    font-weight: 500;
}

.ai-result__reasons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-result__reason {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    color: var(--ink-soft);
    line-height: 1.5;
    padding: 10px 14px;
    background: var(--bone-2);
    border-radius: 0;
    border-left: 4px solid var(--line);
}

.ai-result__reason--strong { border-left-color: var(--red-text); }
.ai-result__reason--moderate { border-left-color: var(--yellow-text); }
.ai-result__reason--weak { border-left-color: var(--blue-text); }

.ai-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 48px;
    text-align: center;
}

.ai-loading__spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--line);
    border-top-color: var(--ink);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.ai-loading__text {
    font-size: 14px;
    color: var(--muted);
}

/* ── WhatsApp Link Generator specific ──────────────────────── */
.wa-result {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.wa-result__link-box {
    background: var(--bone);
    border: 2px solid var(--ink);
    border-radius: 0;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wa-result__link-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.wa-result__link-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.wa-result__link-input {
    flex: 1;
    padding: 12px 14px;
    border: 2px solid var(--ink);
    border-radius: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--mono);
    font-size: 13px;
    min-height: 44px;
    overflow-x: auto;
}

.wa-result__link-input:focus {
    outline: none;
    border-color: var(--ink);
}

.wa-result__copy-btn {
    padding: 0 20px;
    white-space: nowrap;
}

.wa-result__qr {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--bone-2);
    border-radius: 0;
    border: 2px solid var(--ink);
}

.wa-result__qr-img {
    width: 100px;
    height: 100px;
    border-radius: 0;
}

.wa-result__qr-text {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.5;
}

.wa-pixel-fields {
    background: var(--bone-2);
    border: 2px solid var(--ink);
    border-radius: 0;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.wa-pixel-fields__title {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.wa-pixel-fields__title .wa-pixel-toggle {
    margin-left: auto;
    position: relative;
    width: 36px;
    height: 20px;
    background: var(--line);
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s var(--ease);
}

.wa-pixel-fields__title .wa-pixel-toggle.is-on {
    background: var(--ink);
}

.wa-pixel-fields__title .wa-pixel-toggle::after {
    content: '';
    position: absolute;
    top: 2px; left: 2px;
    width: 16px; height: 16px;
    background: var(--paper);
    border-radius: 50%;
    transition: transform 0.2s var(--ease);
}

.wa-pixel-fields__title .wa-pixel-toggle.is-on::after {
    transform: translateX(16px);
}

.wa-pixel-fields__body {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.wa-pixel-fields__body[hidden] { display: none; }

/* ── Country code selector ─────────────────────────────────── */
.wa-phone-row {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 10px;
}

.wa-country-select {
    padding: 12px 10px;
    min-height: 44px;
    border: 2px solid var(--ink);
    border-radius: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--mono);
    font-size: 13px;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23787774' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 26px;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 860px) {
    .tool-layout {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    .tool-preview {
        position: static;
    }
    .tool-preview__canvas {
        min-height: 300px;
    }
}

@media (max-width: 640px) {
    .tool-row {
        grid-template-columns: 1fr;
    }
    .wa-phone-row {
        grid-template-columns: 1fr;
    }
    .tool-download {
        flex-direction: column;
        align-items: stretch;
    }
    .tool-download__btns {
        justify-content: center;
    }
    .ai-result__score {
        flex-direction: column;
        text-align: center;
    }
    .ai-dropzone {
        min-height: 200px;
        padding: 20px 16px;
    }
    .ai-dropzone__icon {
        font-size: 36px;
    }
    .ai-result__gauge {
        width: 100px;
        height: 100px;
    }
    .ai-result__gauge-value {
        font-size: 24px !important;
    }
    .ai-result__gauge-label {
        font-size: 9px !important;
    }
    .ai-result__reasons {
        padding: 14px 16px;
    }
    .ai-result__reason {
        font-size: 12px;
        padding: 10px 12px;
    }
    .ai-result__details {
        padding: 14px 16px;
    }
    .ai-result__detail-label,
    .ai-result__detail-value {
        font-size: 11px;
    }
    .wa-pixel-toggle {
        width: 44px;
        height: 26px;
    }
    .wa-pixel-toggle.is-on::after {
        transform: translateX(18px);
    }
    .wa-result__link-input {
        font-size: 12px;
    }
    .wa-result__qr {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 12px;
    }
}

@media (max-width: 420px) {
    .ai-preview {
        grid-template-columns: 1fr;
    }
    .ai-preview__image {
        width: 100%;
        max-height: 240px;
    }
    .tool-preview__canvas {
        min-height: 240px;
    }
}

/* ── Toast notification ────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--ink);
    color: var(--paper);
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.01em;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s var(--ease), transform 0.25s var(--ease), visibility 0.25s;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    max-width: 90vw;
}
.toast.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}
.toast__icon {
    font-size: 14px;
    flex-shrink: 0;
}
@media (max-width: 640px) {
    .toast {
        bottom: 16px;
        font-size: 12px;
        padding: 10px 16px;
    }
}

/* ── Copy button feedback ──────────────────────────────────── */
.copy-btn {
    transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.copy-btn.is-copied {
    background: var(--pale-green) !important;
    color: var(--green-text) !important;
    border-color: var(--pale-green) !important;
}

/* ── QR Decoder ────────────────────────────────────────────── */
.qrd-mode-tabs {
    display: flex;
    gap: 0;
    border: 2px solid var(--ink);
    border-radius: 0;
    overflow: hidden;
    margin-bottom: 20px;
}
.qrd-mode-tab {
    flex: 1;
    padding: 10px 16px;
    background: var(--paper);
    border: none;
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
    cursor: pointer;
    transition: background 0.15s var(--ease), color 0.15s var(--ease);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
}
.qrd-mode-tab + .qrd-mode-tab {
    border-left: 2px solid var(--ink);
}
.qrd-mode-tab.is-active {
    background: var(--ink);
    color: var(--paper);
}
.qrd-mode-tab:hover:not(.is-active) {
    background: var(--bone-2);
    color: var(--ink);
}

.qrd-panel { display: none; }
.qrd-panel.is-active { display: block; }

.qrd-dropzone {
    border: 2px dashed var(--ink);
    border-radius: 0;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
    background: var(--bone-2);
}
.qrd-dropzone:hover,
.qrd-dropzone.is-dragover {
    border-color: var(--ink);
    background: var(--bone);
    box-shadow: 4px 4px 0 var(--ink);
}
.qrd-dropzone__icon {
    font-size: 40px;
    margin-bottom: 12px;
    display: block;
}
.qrd-dropzone__text {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 4px;
}
.qrd-dropzone__hint {
    font-size: 12px;
    color: var(--muted);
}

.qrd-camera-wrap {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    background: #000;
    aspect-ratio: 4/3;
    max-width: 400px;
    margin: 0 auto;
}
.qrd-camera-wrap video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.qrd-camera-frame {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 60%; aspect-ratio: 1;
    border: 2px solid rgba(255,255,255,0.7);
    border-radius: 8px;
    pointer-events: none;
    box-shadow: 0 0 0 9999px rgba(0,0,0,0.3);
}
.qrd-camera-frame::before,
.qrd-camera-frame::after {
    content: '';
    position: absolute;
    width: 20px; height: 20px;
    border: 3px solid var(--paper);
}
.qrd-camera-frame::before {
    top: -2px; left: -2px;
    border-right: none; border-bottom: none;
    border-radius: 8px 0 0 0;
}
.qrd-camera-frame::after {
    bottom: -2px; right: -2px;
    border-left: none; border-top: none;
    border-radius: 0 0 8px 0;
}
.qrd-camera-placeholder {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--muted-2);
    font-size: 13px;
    gap: 8px;
    background: var(--bone-2);
}

.qrd-result {
    margin-top: 20px;
    padding: 20px;
    background: var(--paper);
    border: 2px solid var(--ink);
    border-radius: 0;
    display: none;
}
.qrd-result.is-visible { display: block; }
.qrd-result__label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted-2);
    margin-bottom: 10px;
}
.qrd-result__content {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}
.qrd-result__text {
    flex: 1;
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
    word-break: break-all;
    line-height: 1.5;
    background: var(--bone-2);
    padding: 12px 14px;
    border-radius: 0;
    border: 2px solid var(--ink);
    min-height: 44px;
    display: flex;
    align-items: center;
}
.qrd-result__text a {
    color: var(--blue-text);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.qrd-result__actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}
.qrd-result__type {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--pale-blue);
    color: var(--blue-text);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 10px;
}
.qrd-result__error {
    padding: 14px 16px;
    background: var(--pale-red);
    color: var(--red-text);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
}

@media (max-width: 640px) {
    .qrd-result__content {
        flex-direction: column;
    }
    .qrd-result__actions {
        width: 100%;
    }
    .qrd-result__actions .btn {
        flex: 1;
        justify-content: center;
    }
    .qrd-mode-tab {
        font-size: 12px;
        padding: 10px 8px;
    }
    .qrd-dropzone {
        padding: 28px 16px;
    }
}
