/* ============================================================
   AI Text Cleaner  —  Frontend/Shortcode stylesheet
   Design inspired by tran.com.au/page-similiarity-checker/
   ============================================================ */

/* ── Reset scope ── */
.atc-wrap *,
.atc-wrap *::before,
.atc-wrap *::after {
    box-sizing: border-box;
}

/* ── Tokens ── */
.atc-wrap {
    --atc-blue:       #2563eb;
    --atc-blue-dark:  #1d4ed8;
    --atc-blue-light: #eff6ff;
    --atc-blue-mid:   #bfdbfe;
    --atc-green:      #16a34a;
    --atc-green-bg:   #f0fdf4;
    --atc-amber:      #d97706;
    --atc-amber-bg:   #fffbeb;
    --atc-amber-hl:   rgba(253, 224, 71, 0.45);
    --atc-text:       #111827;
    --atc-muted:      #6b7280;
    --atc-border:     #e5e7eb;
    --atc-bg:         #f9fafb;
    --atc-white:      #ffffff;
    --atc-radius:     12px;
    --atc-shadow:     0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
    --atc-shadow-sm:  0 1px 2px rgba(0,0,0,.05);

    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--atc-text);
    max-width: 1160px;
    margin: 0 auto;
    padding: 28px 16px 52px;
}

/* ── Header ── */
.atc-header {
    margin-bottom: 24px;
}
.atc-header-inner {
    display: flex;
    align-items: center;
    gap: 14px;
}
.atc-header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--atc-blue), #7c3aed);
    color: #fff;
    font-size: 20px;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(37,99,235,.35);
}
.atc-title {
    margin: 0 0 2px !important;
    padding: 0 !important;
    font-size: 22px !important;
    font-weight: 700 !important;
    color: var(--atc-text) !important;
    line-height: 1.25 !important;
    border: none !important;
}
.atc-subtitle {
    margin: 0 !important;
    font-size: 14px !important;
    color: var(--atc-muted) !important;
    line-height: 1.4 !important;
}

/* ── Card base ── */
.atc-card {
    background: var(--atc-white);
    border: 1px solid var(--atc-border);
    border-radius: var(--atc-radius);
    box-shadow: var(--atc-shadow);
    margin-bottom: 16px;
}

/* ── Options card ── */
.atc-opts-card {
    padding: 20px 24px 16px;
}
.atc-card-row-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--atc-muted);
    margin-bottom: 16px;
}
.atc-opts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 48px;
}
@media (max-width: 640px) {
    .atc-opts-grid { grid-template-columns: 1fr; gap: 16px 0; }
}
.atc-opts-col {
    display: flex;
    flex-direction: column;
    gap: 9px;
}
.atc-opts-group-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--atc-blue);
    margin-bottom: 4px;
}

/* Checkbox row */
.atc-opt {
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    user-select: none;
    font-size: 13.5px;
    color: var(--atc-text);
    line-height: 1.4;
}
.atc-opt input[type="checkbox"] { display: none; }
.atc-chk {
    flex-shrink: 0;
    width: 17px;
    height: 17px;
    border: 2px solid var(--atc-border);
    border-radius: 4px;
    background: var(--atc-white);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .13s, border-color .13s, box-shadow .13s;
}
.atc-opt input:checked + .atc-chk {
    background: var(--atc-blue);
    border-color: var(--atc-blue);
    box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
.atc-opt input:checked + .atc-chk::after {
    content: '';
    display: block;
    width: 4px;
    height: 8px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg) translate(-1px,-1px);
}
.atc-opt-text { flex: 1; }
.atc-tip {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1.5px solid var(--atc-border);
    background: var(--atc-bg);
    color: var(--atc-muted);
    font-size: 10px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: help;
    line-height: 1;
}

.atc-quicklinks {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    font-size: 12px;
    color: var(--atc-muted);
}
.atc-dot { color: var(--atc-border); }
.atc-textlink {
    background: none;
    border: none;
    padding: 0;
    color: var(--atc-blue);
    font-size: 12px;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-color: transparent;
    transition: text-decoration-color .15s;
}
.atc-textlink:hover { text-decoration-color: var(--atc-blue); }

/* ── Editor card ── */
.atc-editor-card { overflow: hidden; }
.atc-panes {
    display: flex;
    align-items: stretch;
    /* Fixed height required — min-height alone lets children grow
       infinitely, preventing scroll in the hl-layer div. */
    height: 460px;
}

/* Pane */
.atc-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    /* Must be hidden so that the child flex column is constrained
       and the textarea / hl-layer scroll within it. */
    overflow: hidden;
}
.atc-pane-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 16px;
    border-bottom: 1px solid var(--atc-border);
    background: var(--atc-bg);
    gap: 8px;
}
.atc-pane-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--atc-muted);
}
.atc-out-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Ghost button */
.atc-ghost-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: var(--atc-white);
    border: 1px solid var(--atc-border);
    border-radius: 6px;
    color: var(--atc-muted);
    font-size: 11.5px;
    font-family: inherit;
    cursor: pointer;
    transition: all .15s;
    line-height: 1;
    white-space: nowrap;
}
.atc-ghost-btn:hover:not(:disabled) {
    border-color: var(--atc-blue);
    color: var(--atc-blue);
    background: var(--atc-blue-light);
}
.atc-ghost-btn:disabled {
    opacity: .38;
    cursor: not-allowed;
}
.atc-ghost-btn.atc-hl-active {
    border-color: var(--atc-amber);
    color: var(--atc-amber);
    background: var(--atc-amber-bg);
}
.atc-ghost-btn.atc-copied {
    border-color: var(--atc-green);
    color: var(--atc-green);
    background: var(--atc-green-bg);
}

/* Textareas */
#atc-input,
#atc-output {
    flex: 1;
    min-height: 0;
    width: 100%;
    padding: 14px 16px;
    border: none;
    outline: none;
    resize: none;
    font-size: 14px;
    line-height: 1.75;
    color: var(--atc-text);
    background: transparent;
    font-family: Georgia, 'Times New Roman', serif;
    overflow-y: auto;
}
#atc-input::placeholder,
#atc-output::placeholder {
    color: var(--atc-muted);
    opacity: .55;
}
#atc-output { color: #1a5c38; }

/* Output wrap — flex column; textarea scrolls within */
.atc-out-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Input wrap — same structure, houses textarea + hl-layer */
.atc-in-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.atc-in-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}
/* hl-layer is a plain scrollable div — NO absolute positioning, NO pointer-events override */
.atc-hl-layer {
    flex: 1;
    min-height: 0;
    padding: 14px 16px;
    font-size: 14px;
    line-height: 1.75;
    font-family: Georgia, 'Times New Roman', serif;
    color: var(--atc-text);
    overflow-y: auto;
    overflow-x: hidden;
    white-space: pre-wrap;
    word-break: break-word;
    background: var(--atc-white);
    cursor: text;
}
.atc-hl-layer mark {
    background: rgba(254, 202, 202, 0.6);
    color: #991b1b;
    border-radius: 3px;
    padding: 1px 3px;
}

/* Pane footer */
.atc-pane-foot {
    padding: 7px 16px;
    border-top: 1px solid var(--atc-border);
    background: var(--atc-bg);
    font-size: 11.5px;
    color: var(--atc-muted);
    font-variant-numeric: tabular-nums;
}

/* ── Middle controls column ── */
.atc-mid {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 12px;
    border-left: 1px solid var(--atc-border);
    border-right: 1px solid var(--atc-border);
    background: var(--atc-bg);
    flex-shrink: 0;
    width: 88px;
}
.atc-btn-primary {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 8px;
    width: 64px;
    background: var(--atc-blue);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: .05em;
    cursor: pointer;
    transition: background .15s, transform .12s, box-shadow .15s;
    box-shadow: 0 4px 12px rgba(37,99,235,.35);
    line-height: 1;
}
.atc-btn-primary:hover {
    background: var(--atc-blue-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(37,99,235,.45);
}
.atc-btn-primary:active { transform: translateY(0); }

.atc-btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--atc-border);
    background: var(--atc-white);
    color: var(--atc-muted);
    cursor: pointer;
    transition: all .15s;
}
.atc-btn-icon:hover {
    border-color: var(--atc-blue);
    color: var(--atc-blue);
    background: var(--atc-blue-light);
}

/* ── Stats bar ── */
.atc-stats {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 16px;
    padding: 13px 18px;
    background: var(--atc-white);
    border: 1px solid var(--atc-border);
    border-radius: var(--atc-radius);
    box-shadow: var(--atc-shadow-sm);
    font-size: 13.5px;
}
.atc-stat-main {
    color: var(--atc-text);
    font-weight: 500;
}
.atc-stat-main strong { color: var(--atc-blue); }
.atc-stat-main .atc-stat-zero strong { color: var(--atc-green); }
.atc-stat-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}
.atc-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--atc-blue-light);
    border: 1px solid var(--atc-blue-mid);
    font-size: 12px;
    color: var(--atc-blue);
    white-space: nowrap;
}
.atc-pill b { font-weight: 700; }

/* ── Utilities ── */
.atc-hidden { display: none !important; }

/* Admin-only note */
.atc-admin-note {
    margin-top: 16px !important;
    font-size: 13px !important;
    color: #888 !important;
}

/* ── Responsive ── */
@media (max-width: 680px) {
    .atc-panes {
        flex-direction: column;
        height: auto;         /* on mobile, stack vertically — no fixed height */
    }
    .atc-pane {
        height: 300px;        /* each pane gets its own fixed height when stacked */
        overflow: hidden;
    }
    .atc-mid {
        flex-direction: row;
        width: 100%;
        border-left: none;
        border-right: none;
        border-top: 1px solid var(--atc-border);
        border-bottom: 1px solid var(--atc-border);
        padding: 10px 16px;
        justify-content: center;
    }
    .atc-btn-primary { flex-direction: row; width: auto; padding: 10px 20px; }
}
