/* =============================================================================
   FYSH — Property photo upload + postcode lookup
   CR: fysh-phase4b-uploadui-2026-06-22
   CR: fysh-property-broadband-2026-10-21 — broadband connection control styles
   Mobile-first. Loaded on listing-create.php and listing-edit.php
   alongside vendor.css.
============================================================================= */

/* ── Photo grid — gallery of existing photos ───────────────────────────── */
.pu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.pu-tile {
    position: relative;
    aspect-ratio: 4 / 3;
    border-radius: 10px;
    overflow: hidden;
    background: #EDF2F8;
    border: 2px solid transparent;
    transition: border-color 0.15s ease, transform 0.1s ease;
}

.pu-tile img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}

.pu-tile--cover {
    border-color: #C9A84C;
    box-shadow: 0 2px 12px rgba(201, 168, 76, 0.28);
}

/* Cover badge */
.pu-cover-flag {
    position: absolute; top: 8px; left: 8px;
    display: inline-flex; align-items: center; gap: 4px;
    background: #C9A84C; color: #0F2340;
    font-size: 10px; font-weight: 700;
    padding: 3px 8px; border-radius: 20px;
    letter-spacing: 0.04em; text-transform: uppercase;
    pointer-events: none;
}
.pu-cover-flag i { font-size: 11px; }

/* Tile action overlay — visible on hover (desktop) and always at the bottom (mobile) */
.pu-tile-actions {
    position: absolute; bottom: 0; left: 0; right: 0;
    display: flex; gap: 6px; padding: 8px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7) 40%);
    opacity: 1;
}
@media (hover: hover) and (pointer: fine) {
    .pu-tile-actions { opacity: 0; transition: opacity 0.15s ease; }
    .pu-tile:hover .pu-tile-actions,
    .pu-tile:focus-within .pu-tile-actions { opacity: 1; }
}

.pu-act {
    flex: 1;
    background: rgba(255, 255, 255, 0.96);
    border: none; border-radius: 5px;
    padding: 8px 4px;
    font-size: 11px; font-weight: 600;
    color: #0F2340; cursor: pointer;
    font-family: inherit;
    display: inline-flex; align-items: center; justify-content: center; gap: 4px;
    min-height: 36px; /* mobile tap target */
    transition: background-color 0.1s;
}
.pu-act:hover { background: #fff; }
.pu-act:active { transform: scale(0.97); }
.pu-act--star { color: #B8901E; }
.pu-act--star.is-active {
    background: #C9A84C; color: #0F2340;
    pointer-events: none;
}
.pu-act--del  { color: #A32D2D; }
.pu-act i { font-size: 14px; }

/* ── Upload dropzone ───────────────────────────────────────────────────── */
.pu-dropzone {
    border: 2px dashed #D5D9DF;
    border-radius: 12px;
    padding: 28px 16px;
    text-align: center;
    background: #FDFCFA;
    transition: border-color 0.15s ease, background-color 0.15s ease;
    position: relative;
}
.pu-dropzone.is-dragover {
    border-color: #C9A84C;
    background: #FAF4E1;
}
.pu-dropzone__icon {
    font-size: 38px; color: #C9A84C;
    display: block; line-height: 1;
    margin-bottom: 10px;
}
.pu-dropzone__title {
    font-size: 14px; font-weight: 600; color: #0F2340;
    margin: 0 0 4px;
}
.pu-dropzone__hint {
    font-size: 12px; color: #6B7A8D; margin: 0 0 14px;
}

/* Action buttons inside dropzone */
.pu-actions {
    display: flex; gap: 10px; flex-wrap: wrap;
    justify-content: center;
}
.pu-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 44px;
    padding: 0 18px;
    font-size: 14px; font-weight: 600;
    border-radius: 8px; border: none; cursor: pointer;
    font-family: inherit;
    text-decoration: none;
    transition: opacity 0.15s, background-color 0.15s;
}
.pu-btn--primary { background: #0F2340; color: #fff; }
.pu-btn--ghost   { background: #fff; color: #0F2340; border: 1px solid #D5D9DF; }
.pu-btn:hover    { opacity: 0.92; }
.pu-btn:active   { transform: scale(0.98); }
.pu-btn i { font-size: 17px; }

/* Camera button — mobile-only on devices that support capture */
@media (min-width: 700px) {
    .pu-btn--camera { display: none; }
}

/* ── Preview tray — before upload ──────────────────────────────────────── */
.pu-preview {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #E2E8F0;
    text-align: left;
}
.pu-preview[hidden] { display: none; }
.pu-preview__heading {
    font-size: 12px; font-weight: 600; color: #0F2340;
    margin: 0 0 10px;
}

.pu-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
    margin-bottom: 14px;
}

.pu-prev-tile {
    position: relative;
    aspect-ratio: 1;
    border-radius: 7px; overflow: hidden;
    background: #EDF2F8;
}
.pu-prev-tile img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.pu-prev-tile__remove {
    position: absolute; top: 4px; right: 4px;
    width: 24px; height: 24px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: #fff; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; line-height: 1;
    padding: 0;
}
.pu-prev-tile__remove:hover { background: rgba(232, 73, 73, 0.95); }
.pu-prev-tile__size {
    position: absolute; bottom: 3px; left: 3px;
    background: rgba(0, 0, 0, 0.6); color: #fff;
    font-size: 9px; padding: 1px 5px; border-radius: 3px;
    font-weight: 500;
}

.pu-prev-actions {
    display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end;
}

/* ── Postcode lookup ───────────────────────────────────────────────────── */
.postcode-group {
    display: flex; gap: 6px; align-items: stretch;
}
.postcode-group input { flex: 1; min-width: 0; }
.postcode-lookup-btn {
    flex-shrink: 0;
    background: #1E5BA8; color: #fff;
    border: none; border-radius: 6px;
    padding: 0 16px;
    font-size: 13px; font-weight: 600;
    font-family: inherit;
    cursor: pointer; min-height: 40px;
    display: inline-flex; align-items: center; gap: 5px;
    transition: opacity 0.15s;
}
.postcode-lookup-btn:hover:not(:disabled) { opacity: 0.9; }
.postcode-lookup-btn:disabled {
    background: #C5C9CF; cursor: not-allowed;
}
.postcode-lookup-btn i { font-size: 15px; }
.postcode-lookup-btn .pc-spinner {
    width: 13px; height: 13px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: pc-spin 0.7s linear infinite;
}
@keyframes pc-spin { to { transform: rotate(360deg); } }

.postcode-status {
    font-size: 12px; margin-top: 6px; min-height: 16px;
}
.postcode-status[data-state="ok"]    { color: #3B6D11; }
.postcode-status[data-state="error"] { color: #A32D2D; }
.postcode-status[data-state="busy"]  { color: #6B7A8D; }

/* Mobile: stack postcode lookup button below input */
@media (max-width: 480px) {
    .postcode-group { flex-direction: column; }
    .postcode-lookup-btn {
        justify-content: center;
        padding: 10px 16px;
    }
}

/* ── A11y: visually-hidden file input ──────────────────────────────────── */
.pu-input-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ── Photo policy acceptance (Layer 1 safeguard) ───────────────────────── */
/* CR: fysh-photo-safeguards-l1-2026-10-03 */
.pu-policy {
    border: 1px solid #E2E8F0;
    border-radius: 4px;
    background: #F8FAFC;
    padding: 14px 16px;
    margin-bottom: 16px;
}
.pu-policy__title {
    display: flex; align-items: center; gap: 6px;
    font-size: 13px; font-weight: 700; color: #0F2340;
    margin: 0 0 8px;
}
.pu-policy__title i { font-size: 16px; color: #1E5BA8; }
.pu-policy__list {
    margin: 0 0 12px; padding-left: 18px;
    font-size: 12px; color: #4A5A6B; line-height: 1.5;
}
.pu-policy__list li { margin-bottom: 3px; }
.pu-policy__accept {
    display: flex; align-items: flex-start; gap: 8px;
    font-size: 13px; color: #0F2340; cursor: pointer;
}
.pu-policy__accept input {
    margin-top: 2px; width: 16px; height: 16px; flex-shrink: 0;
}

/* Before the policy box is ticked the dropzone is dimmed as a hint, but it stays
   usable so Choose photos responds. The acceptance is enforced at submit time by
   photo-policy.js and again on the server. CR: fysh-photo-safeguards-l3-2026-10-03 */
.pu-policy-pending .pu-dropzone {
    opacity: 0.7;
}

/* ── Moderation status flag on a photo tile (Layer 2) ──────────────────── */
/* CR: fysh-photo-safeguards-l2-2026-10-03 */
.pu-status-flag {
    position: absolute; top: 8px; left: 8px;
    display: inline-flex; align-items: center; gap: 4px;
    color: #fff;
    font-size: 10px; font-weight: 700;
    padding: 3px 8px; border-radius: 20px;
    letter-spacing: 0.03em; text-transform: uppercase;
    pointer-events: none;
}
.pu-status-flag i { font-size: 11px; }
.pu-status--pending  { background: #1E5BA8; }
.pu-status--review   { background: #B8901E; }
.pu-status--rejected { background: #A32D2D; }

/* A photo awaiting or failing moderation is dimmed and cannot be the cover. */
.pu-tile--held img { opacity: 0.6; }
.pu-tile--held { border-color: #E2E8F0; }

/* ── Reduced motion ────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .pu-tile, .pu-act, .pu-btn, .pu-dropzone { transition: none; }
    .pc-spinner { animation: none; }
}

/* ── Broadband connection control (Features & amenities) ───────────────────
   CR: fysh-property-broadband-2026-10-21 — a checkbox for an active broadband
   service and a single-select connection type, shown only when active. */
.bb-field {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}
.bb-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    cursor: pointer;
}
.bb-toggle input { accent-color: #1E5BA8; }
.bb-types {
    margin: 10px 0 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
}
.bb-types[hidden] { display: none; }
.bb-types__label {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    margin-right: 2px;
}
.bb-type {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    cursor: pointer;
}
.bb-type input { accent-color: #1E5BA8; }
