/* Add Blank Page to PDF — page-specific styles.
   Upload zone (.uz*) and thumbnail grid (.thumbnail-grid, .page-thumbnail,
   .page-number, .page-thumb-skeleton) come from base.css untouched. */

/* ── PDF info panel ──────────────────────────────────────────────────── */
.abp-info-panel {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
    gap: .25rem 1.5rem;
    background: #fafafe;
    border: 1px solid var(--border, #e8ecf0);
    border-radius: 1rem;
    padding: 1.125rem 1.25rem;
    margin-bottom: 1.75rem;
}

.abp-info-row { display: flex; justify-content: space-between; gap: .75rem; padding: .375rem 0; border-bottom: 1px solid #eef1f5; font-size: .8125rem; }
.abp-info-row:nth-last-child(-n+1) { border-bottom: none; }
.abp-info-label { color: #94a3b8; font-weight: 600; }
.abp-info-value { color: #0f172a; font-weight: 600; text-align: right; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Style panel (quantity / size / orientation / color) ─────────────── */
.abp-style-panel {
    background: #fafafe;
    border: 1px solid var(--border, #e8ecf0);
    border-radius: 1rem;
    padding: 1.25rem 1.25rem 1.375rem;
    margin-bottom: 1.5rem;
}

.abp-style-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 1.25rem 1.75rem; }
.abp-style-row + .abp-style-row { margin-top: 1.125rem; }

.abp-field-label { display: block; font-size: .6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #94a3b8; margin-bottom: .5rem; }

.abp-qty-stepper { display: inline-flex; align-items: center; border: 1.5px solid var(--border, #e8ecf0); border-radius: .625rem; background: #fff; overflow: hidden; }
.abp-qty-btn { width: 2.25rem; height: 2.25rem; border: none; background: #fff; color: #475569; font-size: 1.125rem; font-weight: 700; cursor: pointer; font-family: inherit; transition: background .2s; }
.abp-qty-btn:hover { background: #f1f5f9; }
.abp-qty-stepper input { width: 3.25rem; height: 2.25rem; border: none; border-left: 1.5px solid var(--border, #e8ecf0); border-right: 1.5px solid var(--border, #e8ecf0); text-align: center; font-size: .9375rem; font-weight: 700; color: #0f172a; font-family: inherit; -moz-appearance: textfield; }
.abp-qty-stepper input::-webkit-outer-spin-button, .abp-qty-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.abp-select {
    height: 2.25rem;
    padding: 0 2rem 0 .875rem;
    border: 1.5px solid var(--border, #e8ecf0);
    border-radius: .625rem;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right .625rem center;
    font-size: .875rem;
    font-weight: 600;
    color: #0f172a;
    font-family: inherit;
    cursor: pointer;
    appearance: none;
}
.abp-select:focus { outline: none; border-color: var(--indigo, #6366f1); box-shadow: 0 0 0 3px rgba(99, 102, 241, .12); }

.abp-group { display: flex; gap: .5rem; flex-wrap: wrap; transition: opacity .2s; }

.abp-chip-btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .5rem 1rem;
    border-radius: 9999px;
    border: 1.5px solid var(--border, #e8ecf0);
    background: #fff;
    font-size: .8125rem;
    font-weight: 700;
    color: #475569;
    cursor: pointer;
    font-family: inherit;
    transition: all .2s;
}
.abp-chip-btn:hover:not(:disabled) { border-color: #c7d2fe; }
.abp-chip-btn:disabled { cursor: not-allowed; }
.abp-chip-btn.active { background: var(--grad-primary, linear-gradient(135deg, #6366f1, #7c3aed)); border-color: transparent; color: #fff; }

.abp-color-chip { width: .875rem; height: .875rem; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .12); flex-shrink: 0; }

.abp-custom-fields { display: flex; align-items: flex-end; gap: .75rem; flex-wrap: wrap; margin-top: .875rem; }
.abp-custom-fields label { display: flex; flex-direction: column; gap: .375rem; font-size: .75rem; font-weight: 600; color: #64748b; }
.abp-custom-fields input[type="number"] {
    width: 6rem;
    height: 2.25rem;
    padding: 0 .625rem;
    border: 1.5px solid var(--border, #e8ecf0);
    border-radius: .5rem;
    font-size: .875rem;
    font-weight: 600;
    color: #0f172a;
    font-family: inherit;
}
.abp-custom-fields input[type="number"]:focus { outline: none; border-color: var(--indigo, #6366f1); box-shadow: 0 0 0 3px rgba(99, 102, 241, .12); }
.abp-field-error { flex-basis: 100%; color: #dc2626; font-size: .75rem; font-weight: 600; margin: .5rem 0 0; }

/* ── Quick-add actions ────────────────────────────────────────────────── */
.abp-quick-actions { display: flex; gap: .625rem; flex-wrap: wrap; margin-bottom: 1.25rem; }

.abp-quick-btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .5rem 1rem;
    border-radius: 9999px;
    border: 1.5px solid var(--border, #e8ecf0);
    background: #fff;
    font-size: .8125rem;
    font-weight: 700;
    color: var(--indigo, #6366f1);
    cursor: pointer;
    font-family: inherit;
    transition: all .2s;
}
.abp-quick-btn:hover { border-color: #c7d2fe; background: #fafafe; }

/* ── Drag-to-place token ──────────────────────────────────────────────── */
.abp-drag-token {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .5rem 1.125rem .5rem .875rem;
    border-radius: 9999px;
    border: 1.5px dashed var(--indigo, #6366f1);
    background: #eef2ff;
    color: #4338ca;
    font-size: .8125rem;
    font-weight: 700;
    font-family: inherit;
    cursor: grab;
    user-select: none;
    transition: box-shadow .15s, background .15s, opacity .15s;
}
.abp-drag-token:hover { background: #e0e7ff; box-shadow: 0 4px 12px rgba(99, 102, 241, .18); }
.abp-drag-token:focus-visible { outline: 2px solid var(--indigo, #6366f1); outline-offset: 2px; }
.abp-drag-token:active, .abp-drag-token.dragging { cursor: grabbing; opacity: .55; }

/* ── Summary bar ──────────────────────────────────────────────────────── */
.abp-summary-bar { text-align: center; font-size: .8125rem; font-weight: 600; color: #475569; margin: 1.25rem 0; }

/* ── Sequence grid: original-page thumbnails + blank placeholder cards ─ */
#sequenceGrid { position: relative; }

.abp-drop-indicator {
    position: absolute;
    width: 4px;
    border-radius: 9999px;
    background: var(--grad-primary, linear-gradient(135deg, #6366f1, #7c3aed));
    box-shadow: 0 0 0 4px rgba(99, 102, 241, .2);
    pointer-events: none;
    z-index: 5;
    display: none;
}
.abp-drop-indicator.show { display: block; }

.abp-thumb { cursor: default; padding-bottom: 2.25rem; }
.abp-thumb .page-number { display: inline-flex; align-items: center; }
.abp-orig-num { font-weight: 600; text-transform: none; letter-spacing: 0; opacity: .85; }

.abp-insert-btn {
    position: absolute;
    left: 50%;
    bottom: .5rem;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .3rem .625rem;
    border-radius: 9999px;
    border: 1px solid rgba(99, 102, 241, .2);
    background: rgba(255, 255, 255, .92);
    color: var(--indigo, #6366f1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, .08);
    font-size: .625rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    opacity: .85;
    transition: opacity .2s, transform .2s, background .2s, color .2s;
    white-space: nowrap;
}
.abp-thumb:hover .abp-insert-btn,
.abp-thumb:focus-within .abp-insert-btn,
.abp-insert-btn:hover,
.abp-insert-btn:focus-visible {
    opacity: 1;
}
.abp-insert-btn:hover { background: var(--grad-primary, linear-gradient(135deg, #6366f1, #7c3aed)); color: #fff; border-color: transparent; }
.abp-insert-btn span { display: none; }

.abp-lead-insert {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .375rem;
    aspect-ratio: 1/1.414;
    border: 2px dashed var(--border, #e8ecf0);
    border-radius: .75rem;
    background: #fafafe;
    color: #94a3b8;
    font-size: .6875rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all .2s;
}
.abp-lead-insert:hover, .abp-lead-insert:focus-visible { border-color: var(--indigo, #6366f1); color: var(--indigo, #6366f1); background: #eff6ff; outline: none; }

.abp-blank-card { border-style: dashed; border-color: #c7d2fe; background: #fafafe; }
.abp-blank-card:hover { border-color: var(--indigo, #6366f1); }

.abp-blank-swatch {
    position: relative;
    aspect-ratio: 1/1.414;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    border-bottom: 1px solid #eef1f5;
}

.abp-blank-label { font-size: .6875rem; font-weight: 700; color: #94a3b8; text-transform: uppercase; letter-spacing: .04em; }

.abp-blank-caption { padding: .5rem .625rem 0; font-size: .625rem; font-weight: 600; color: #64748b; text-align: center; line-height: 1.4; }

.abp-remove-btn {
    position: absolute;
    top: .5rem;
    right: .5rem;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    border: none;
    background: #fff;
    color: #dc2626;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .12);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.abp-remove-btn:hover { background: #fef2f2; }

/* ── Processing dashboard ─────────────────────────────────────────────── */
.abp-dashboard {
    max-width: 26rem;
    margin: 1.25rem auto 0;
    background: #fafafe;
    border: 1px solid var(--border, #e8ecf0);
    border-radius: 1rem;
    padding: 1rem 1.25rem;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: .875rem 1.25rem;
}
.abp-dash-stat { text-align: left; }
.abp-dash-stat-label { display: block; font-size: .625rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: #94a3b8; margin-bottom: .2rem; }
.abp-dash-stat-value { display: block; font-size: .9375rem; font-weight: 700; color: #0f172a; }

/* ── Toasts ───────────────────────────────────────────────────────────── */
#toastHost { position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%); z-index: 999; display: flex; flex-direction: column; gap: .5rem; align-items: center; pointer-events: none; }

.abp-toast {
    background: #0f172a;
    color: #fff;
    font-size: .8125rem;
    font-weight: 600;
    padding: .75rem 1.25rem;
    border-radius: .75rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
    opacity: 0;
    transform: translateY(.5rem);
    transition: opacity .25s, transform .25s;
}
.abp-toast.show { opacity: 1; transform: translateY(0); }
.abp-toast-error { background: #dc2626; }

@media (max-width: 640px) {
    .abp-dashboard { grid-template-columns: 1fr 1fr; }
    .abp-info-panel { grid-template-columns: 1fr 1fr; }
    .abp-insert-btn span { display: inline; }
}
