/* ============================================================
   PDF Converter — Frontend CSS  (ConvertAPI v2)
   Naming convention: BEM-lite, prefix pdfconv-
   Modifier separator: -- (double dash)
   ============================================================ */

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

.pdfconv-wrap {
    max-width: 560px;
    margin: 2rem auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    color: #1e293b;
    line-height: 1.5;
}

.pdfconv-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0 0 1.5rem;
    color: #0f172a;
}

/* ── Notices (shortcode fallback) ────────────────────────── */
.pdfconv-notice {
    padding: .75rem 1rem;
    border-radius: 8px;
    font-size: .9rem;
    margin-bottom: 1rem;
    border-width: 1px;
    border-style: solid;
}
.pdfconv-notice a { font-weight: 600; }
.pdfconv-notice--warn  { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.pdfconv-notice--error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.pdfconv-notice--info  { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }

/* ── Step visibility ──────────────────────────────────────── */
.pdfconv-step[hidden] { display: none !important; }

/* ── Dropzone ────────────────────────────────────────────── */
.pdfconv-dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: 16px;
    padding: 3rem 2rem;
    text-align: center;
    background: #f8fafc;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    outline: none;
}
.pdfconv-dropzone:hover,
.pdfconv-dropzone:focus,
.pdfconv-dropzone.is-drag-over {
    border-color: #3b82f6;
    background: #eff6ff;
}
.pdfconv-dz-icon { color: #94a3b8; margin-bottom: .75rem; }
.pdfconv-dz-icon svg { display: inline-block; }
.pdfconv-dz-title { font-size: 1.05rem; font-weight: 600; color: #1e293b; margin: 0 0 .25rem; }
.pdfconv-dz-or    { color: #94a3b8; margin: .4rem 0; font-size: .9rem; }
.pdfconv-dz-note  { font-size: .8rem; color: #94a3b8; margin-top: .9rem; margin-bottom: 0; }
#pdfconv-file-input { display: none; }

/* ── File card ───────────────────────────────────────────── */
.pdfconv-file-card {
    display: flex;
    align-items: center;
    gap: .75rem;
    background: #f1f5f9;
    border-radius: 10px;
    padding: .8rem 1rem;
    margin-bottom: 1.25rem;
}
.pdfconv-file-icon { font-size: 1.5rem; flex-shrink: 0; }
.pdfconv-file-meta { flex: 1; min-width: 0; }
.pdfconv-file-name {
    display: block;
    font-weight: 600;
    font-size: .9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #1e293b;
}
.pdfconv-file-size { display: block; font-size: .78rem; color: #64748b; margin-top: 2px; }
.pdfconv-file-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    font-size: 1rem;
    padding: 4px 8px;
    border-radius: 6px;
    line-height: 1;
    transition: background .15s, color .15s;
}
.pdfconv-file-remove:hover { background: #fee2e2; color: #dc2626; }

/* ── Format fieldset ─────────────────────────────────────── */
.pdfconv-fieldset { border: none; padding: 0; margin: 0 0 1.25rem; }
.pdfconv-legend   { font-weight: 600; font-size: .9rem; color: #475569; margin-bottom: .75rem; display: block; }

.pdfconv-format-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.pdfconv-format-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.25rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    user-select: none;
    position: relative;
}
.pdfconv-format-card:hover { border-color: #93c5fd; }
/* :has() — hỗ trợ Chrome 105+, Firefox 121+, Safari 15.4+ */
.pdfconv-format-card:has(input:checked) { border-color: #2563eb; background: #eff6ff; }
/* Fallback cho trình duyệt cũ: JS thêm class .is-selected */
.pdfconv-format-card.is-selected { border-color: #2563eb; background: #eff6ff; }

.pdfconv-format-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0; height: 0;
}
.pdfconv-format-ico  { margin-bottom: .5rem; }
.pdfconv-format-name { font-weight: 700; color: #1e293b; font-size: .95rem; }
.pdfconv-format-ext  { font-size: .75rem; color: #94a3b8; }

/* ── OCR row ─────────────────────────────────────────────── */
.pdfconv-ocr-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem 1rem;
    margin-bottom: 1.5rem;
    cursor: pointer;
}
/* Switch track + thumb */
.pdfconv-switch { flex-shrink: 0; display: inline-block; position: relative; width: 40px; height: 22px; }
.pdfconv-switch input[type="checkbox"] { position: absolute; opacity: 0; width: 0; height: 0; }
.pdfconv-switch-track {
    position: absolute;
    inset: 0;
    background: #cbd5e1;
    border-radius: 11px;
    transition: background .2s;
}
.pdfconv-switch-thumb {
    position: absolute;
    width: 16px; height: 16px;
    background: #fff;
    border-radius: 50%;
    top: 3px; left: 3px;
    transition: left .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.pdfconv-switch input:checked + .pdfconv-switch-track { background: #2563eb; }
.pdfconv-switch input:checked + .pdfconv-switch-track .pdfconv-switch-thumb { left: 21px; }

.pdfconv-ocr-label { font-size: .9rem; color: #475569; }
.pdfconv-badge {
    background: #dbeafe; color: #1d4ed8;
    font-size: .68rem; font-weight: 700;
    padding: 1px 5px; border-radius: 4px;
    letter-spacing: .03em; vertical-align: 2px;
}
.pdfconv-ocr-tip { font-size: .78rem; color: #94a3b8; width: 100%; }

/* ── Buttons ─────────────────────────────────────────────── */
.pdfconv-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .6rem 1.4rem;
    border-radius: 8px;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    text-decoration: none;
    transition: background .15s, border-color .15s, color .15s, transform .1s;
    line-height: 1;
    white-space: nowrap;
}
.pdfconv-btn:active { transform: scale(.97); }

.pdfconv-btn--primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.pdfconv-btn--primary:hover { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }

.pdfconv-btn--ghost { background: transparent; color: #64748b; border-color: #e2e8f0; }
.pdfconv-btn--ghost:hover { background: #f1f5f9; color: #475569; }

.pdfconv-btn--download { background: #16a34a; color: #fff; border-color: #16a34a; }
.pdfconv-btn--download:hover { background: #15803d; border-color: #15803d; color: #fff; }

.pdfconv-btn--lg { padding: .75rem 2rem; font-size: 1rem; border-radius: 10px; }

.pdfconv-actions { display: flex; justify-content: flex-end; margin-top: .5rem; }

/* ── Loading ─────────────────────────────────────────────── */
.pdfconv-loading-wrap { text-align: center; padding: 3rem 1rem; }

.pdfconv-spinner {
    width: 52px; height: 52px;
    margin: 0 auto 1.25rem;
    animation: pdfconv-rotate .9s linear infinite;
}
.pdfconv-spinner svg { width: 52px; height: 52px; display: block; }
.pdfconv-spinner circle {
    stroke: #2563eb;
    stroke-dasharray: 80, 200;
    stroke-dashoffset: 0;
    stroke-linecap: round;
    animation: pdfconv-dash 1.5s ease-in-out infinite;
}
@keyframes pdfconv-rotate { to { transform: rotate(360deg); } }
@keyframes pdfconv-dash {
    0%   { stroke-dasharray: 1,   200; stroke-dashoffset: 0;    }
    50%  { stroke-dasharray: 90,  200; stroke-dashoffset: -35;  }
    100% { stroke-dasharray: 90,  200; stroke-dashoffset: -124; }
}

.pdfconv-loading-text { font-weight: 600; color: #1e293b; margin: 0 0 .75rem; }
.pdfconv-loading-sub  { font-size: .8rem; color: #94a3b8; margin-top: .75rem; }

.pdfconv-progress {
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
    max-width: 320px;
    margin: 0 auto;
}
.pdfconv-progress-fill {
    height: 100%;
    background: #2563eb;
    border-radius: 3px;
    width: 0;
    transition: width .5s ease;
}

/* ── Done ────────────────────────────────────────────────── */
.pdfconv-done-wrap { text-align: center; padding: 2.5rem 1rem; }
.pdfconv-done-icon { color: #16a34a; margin-bottom: .5rem; }
.pdfconv-done-icon svg { display: inline-block; }
.pdfconv-done-title { font-size: 1.3rem; font-weight: 700; color: #0f172a; margin: 0 0 .4rem; }
.pdfconv-done-sub   { color: #64748b; margin: 0 0 1.5rem; }
.pdfconv-done-wrap .pdfconv-btn { display: block; max-width: 260px; margin: .6rem auto; }

/* ── Alert ───────────────────────────────────────────────── */
.pdfconv-alert {
    border-radius: 10px;
    padding: .85rem 1.1rem;
    margin-top: 1rem;
    font-size: .9rem;
    border-width: 1px;
    border-style: solid;
}
.pdfconv-alert--error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #dc2626;
}
