/* ============================================================
   AddiPress Listings — submission form.
   Uses theme variables (--apl-*) with safe fallbacks, so it looks
   consistent with AddiListo but also works with any other theme.
   ============================================================ */

.apl-form,
.apl-form__gate,
.apl-form__success {
    --f-primary: var(--apl-primary, #4f46e5);
    --f-primary-600: var(--apl-primary-600, #4338ca);
    --f-ink: var(--apl-ink, #0f172a);
    --f-muted: var(--apl-muted, #64748b);
    --f-line: var(--apl-line, #e2e8f0);
    --f-bg: var(--apl-bg, #fff);
    --f-radius: var(--apl-radius, 14px);
    max-width: 760px;
    margin: 0 auto;
    font-family: var(--apl-font, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
    color: var(--f-ink);
}

/* Steps */
.apl-form__steps { display: flex; gap: 8px; list-style: none; padding: 0; margin: 0 0 24px; counter-reset: step; }
.apl-form__steps li { flex: 1; text-align: center; font-size: 13px; font-weight: 600; color: var(--f-muted); padding: 12px 6px 10px; border-bottom: 3px solid var(--f-line); position: relative; }
.apl-form__steps li::before { counter-increment: step; content: counter(step); display: inline-flex; width: 22px; height: 22px; border-radius: 999px; background: var(--f-line); color: #fff; align-items: center; justify-content: center; font-size: 12px; margin-right: 6px; vertical-align: middle; }
.apl-form__steps li.is-active { color: var(--f-ink); border-bottom-color: var(--f-primary); }
.apl-form__steps li.is-active::before { background: var(--f-primary); }
.apl-form__steps li.is-done::before { background: var(--apl-success, #16a34a); content: "✓"; }

/* Panels */
.apl-form__panel { display: none; border: 0; padding: 0; margin: 0; min-width: 0; }
.apl-form__panel.is-active { display: block; animation: apl-fade .2s ease; }
@keyframes apl-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Fields */
.apl-field { margin-bottom: 18px; }
.apl-field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.apl-field label small { font-weight: 400; color: var(--f-muted); }
.apl-field input,
.apl-field select,
.apl-field textarea {
    width: 100%; padding: 11px 14px; border: 1px solid var(--f-line); border-radius: 10px;
    font-size: 15px; background: var(--f-bg); color: var(--f-ink); font-family: inherit;
}
.apl-field input:focus,
.apl-field select:focus,
.apl-field textarea:focus { outline: none; border-color: var(--f-primary); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.apl-field textarea { resize: vertical; }
.apl-field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }

/* Upload preview */
.apl-uploads { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin-top: 12px; }
.apl-upload { position: relative; margin: 0; border-radius: 10px; overflow: hidden; border: 1px solid var(--f-line); aspect-ratio: 1; }
.apl-upload img { width: 100%; height: 100%; object-fit: cover; }
.apl-upload--main { outline: 2px solid var(--f-primary); }
.apl-upload__tag { position: absolute; bottom: 4px; left: 4px; background: var(--f-primary); color: #fff; font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 999px; }

/* Consent */
.apl-consent { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; color: var(--f-muted); margin: 8px 0 20px; }
.apl-consent input { margin-top: 3px; }

/* Navigation */
.apl-form__nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; }

/* Buttons (fallback when the theme has no .apl-btn) */
.apl-form .apl-btn,
.apl-form__gate .apl-btn,
.apl-form__success .apl-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 20px; border: 1px solid transparent; border-radius: 999px;
    font-weight: 600; font-size: 15px; cursor: pointer; text-decoration: none;
    background: var(--f-line); color: var(--f-ink);
}
.apl-btn--primary { background: var(--f-primary); color: #fff; }
.apl-btn--primary:hover { background: var(--f-primary-600); }
.apl-btn--ghost { background: transparent; border-color: var(--f-line); color: var(--f-muted); }
.apl-btn--submit { min-width: 200px; }

/* Errors / gate / success */
.apl-form__errors { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; border-radius: 10px; padding: 12px 16px; margin-bottom: 20px; }
.apl-form__errors ul { margin: 0; padding-left: 18px; }
.apl-form__gate, .apl-form__success { text-align: center; padding: 40px 20px; background: var(--f-bg); border: 1px solid var(--f-line); border-radius: var(--f-radius); display: grid; gap: 14px; justify-items: center; }
.apl-form__success-ico { width: 56px; height: 56px; border-radius: 999px; background: var(--apl-success, #16a34a); color: #fff; font-size: 28px; display: flex; align-items: center; justify-content: center; }

@media (max-width: 560px) {
    .apl-form__steps li { font-size: 0; padding: 10px 4px; }
    .apl-form__steps li::before { margin: 0; font-size: 13px; }
    .apl-form__nav { flex-direction: column-reverse; }
    .apl-form__nav .apl-btn { width: 100%; }
}

/* --- Package selection (monetization) --- */
.apl-form__pkg-title { display: block; font-size: 14px; font-weight: 700; margin-bottom: 10px; }
.apl-packages { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 8px; }
.apl-package { position: relative; display: grid; gap: 2px; padding: 14px; border: 1px solid var(--f-line, #e2e8f0); border-radius: 12px; cursor: pointer; }
.apl-package input { position: absolute; top: 12px; right: 12px; }
.apl-package:has(input:checked) { border-color: var(--f-primary, #4f46e5); box-shadow: 0 0 0 2px var(--f-primary, #4f46e5) inset; }
.apl-package__name { font-weight: 700; }
.apl-package__price { font-size: 20px; font-weight: 800; color: var(--f-primary, #4f46e5); }
.apl-package__meta { font-size: 12px; color: var(--f-muted, #64748b); }

/* Photo manager — reorder, remove, pick main (Phase 26) */
.apl-uploads{display:flex;flex-wrap:wrap;gap:10px;margin-top:12px}
.apl-upload{position:relative;width:110px;height:88px;margin:0;border-radius:10px;overflow:hidden;border:1px solid #e2e8f0;background:#f8fafc;cursor:grab}
.apl-upload.is-dragging{opacity:.5}
.apl-upload img{width:100%;height:100%;object-fit:cover;display:block}
.apl-upload__tag{position:absolute;top:5px;left:5px;background:rgba(15,23,42,.78);color:#fff;font-size:10px;font-weight:800;padding:2px 7px;border-radius:999px}
.apl-upload--main .apl-upload__tag{background:#16a34a}
.apl-upload__rm{position:absolute;top:4px;right:4px;width:22px;height:22px;border:0;border-radius:999px;background:rgba(15,23,42,.72);color:#fff;font-size:11px;cursor:pointer;line-height:1}
.apl-upload__rm:hover{background:#dc2626}
.apl-upload__main-btn{position:absolute;left:0;right:0;bottom:0;border:0;background:rgba(15,23,42,.72);color:#fff;font-size:10px;font-weight:700;padding:4px 0;cursor:pointer;opacity:0;transition:.15s}
.apl-upload:hover .apl-upload__main-btn{opacity:1}
