/**
 * property-form.css
 * Shared styles for add-property.html and edit-property.html.
 * Depends on: tokens.css, portal.css, layout.css (loaded first).
 */

/* ── Page layout ──────────────────────────────────────────────────────────── */
.pf-layout {
    max-width: 780px;
    margin: 0 auto;
    padding: 2rem 1.25rem 4rem;
}
.pf-hero { margin-bottom: 2rem; }
.pf-breadcrumb {
    font-size: .8rem;
    color: var(--p-text-muted);
    margin-bottom: .5rem;
}
.pf-breadcrumb a { color: var(--p-accent); text-decoration: none; }
.pf-breadcrumb a:hover { text-decoration: underline; }
.pf-hero h1 {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--p-primary);
    margin: 0 0 .3rem;
}
.pf-hero p {
    font-size: .95rem;
    color: var(--p-text-muted);
    margin: 0;
}

/* ── Section cards ────────────────────────────────────────────────────────── */
.pf-section {
    background: var(--p-surface);
    border: 1.5px solid var(--p-border);
    border-radius: var(--p-r-lg);
    margin-bottom: 1.25rem;
    overflow: hidden;
    box-shadow: var(--p-shadow-sm);
    transition: box-shadow var(--p-transition);
}
.pf-section:focus-within {
    border-color: var(--p-accent);
    box-shadow: 0 0 0 3px rgba(5,150,105,.1), var(--p-shadow-md);
}
.pf-section-header {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .85rem 1.25rem;
    background: linear-gradient(135deg, var(--p-primary) 0%, #2a4a7f 100%);
    color: #fff;
    user-select: none;
}
.pf-section-icon { font-size: 1rem; line-height: 1; flex-shrink: 0; }
.pf-section-title {
    font-size: .88rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.pf-section-body { padding: 1.25rem; }

/* ── Type selector ────────────────────────────────────────────────────────── */
.pf-type-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .6rem;
}
.pf-type-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .35rem;
    padding: .75rem .4rem;
    border: 2px solid var(--p-border);
    border-radius: var(--p-r-md);
    background: var(--p-surface);
    cursor: pointer;
    transition: all var(--p-transition);
    font-family: var(--p-font);
    font-size: .78rem;
    font-weight: 600;
    color: var(--p-text-body);
    text-align: center;
}
.pf-type-btn .pf-type-icon { font-size: 1.6rem; line-height: 1; }
.pf-type-btn:hover {
    border-color: var(--p-accent);
    background: #ecfdf5;
    color: var(--p-accent-dark);
}
.pf-type-btn.selected {
    border-color: var(--p-accent);
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    color: var(--p-accent-dark);
    box-shadow: 0 0 0 3px rgba(5,150,105,.15);
}

/* ── Deal toggle ──────────────────────────────────────────────────────────── */
.pf-deal-toggle {
    display: flex;
    border: 2px solid var(--p-border);
    border-radius: var(--p-r-md);
    overflow: hidden;
    width: fit-content;
}
.pf-deal-btn {
    flex: 1;
    padding: .55rem 1.4rem;
    border: none;
    background: var(--p-surface);
    cursor: pointer;
    font-family: var(--p-font);
    font-size: .88rem;
    font-weight: 600;
    color: var(--p-text-muted);
    transition: all var(--p-transition);
}
.pf-deal-btn:first-child { border-right: 1.5px solid var(--p-border); }
.pf-deal-btn.selected {
    background: var(--p-gradient-primary);
    color: #fff;
}

/* ── Form grid ────────────────────────────────────────────────────────────── */
.pf-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .85rem;
}
.pf-row.three { grid-template-columns: 1fr 1fr 1fr; }
.pf-mb { margin-bottom: .85rem; }
.pf-group {
    display: flex;
    flex-direction: column;
    gap: .3rem;
}
@media (max-width: 560px) {
    .pf-row, .pf-row.three { grid-template-columns: 1fr; }
    .pf-type-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Labels & inputs ──────────────────────────────────────────────────────── */
.pf-label {
    font-size: .82rem;
    font-weight: 600;
    color: var(--p-text-heading);
}
.pf-label .req { color: var(--p-accent); }
.pf-label .hint { font-weight: 400; color: var(--p-text-muted); font-size: .78rem; }

.pf-input, .pf-select, .pf-textarea {
    padding: .6rem .85rem;
    border: 1.5px solid var(--p-border);
    border-radius: var(--p-r-md);
    font-family: var(--p-font);
    font-size: .9rem;
    color: var(--p-text-body);
    background: var(--p-surface);
    transition: border-color var(--p-transition), box-shadow var(--p-transition);
    width: 100%;
    box-sizing: border-box;
}
.pf-input:focus, .pf-select:focus, .pf-textarea:focus {
    outline: none;
    border-color: var(--p-accent);
    box-shadow: 0 0 0 3px rgba(5,150,105,.12);
}
.pf-input::placeholder, .pf-textarea::placeholder { color: var(--p-text-muted); }
.pf-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .75rem center;
    padding-right: 2rem;
}
.pf-textarea { resize: vertical; min-height: 100px; }
.pf-char-count { font-size: .75rem; color: var(--p-text-muted); text-align: right; margin-top: -.1rem; }
.pf-note { font-size: .78rem; color: var(--p-text-muted); margin-top: .2rem; }
.pf-divider { height: 1px; background: var(--p-border); margin: 1rem 0; }

/* ── Price display ────────────────────────────────────────────────────────── */
.pf-price-display {
    padding: .4rem .85rem;
    background: #ecfdf5;
    border: 1px solid #6ee7b7;
    border-radius: var(--p-r-sm);
    font-size: .85rem;
    font-weight: 700;
    color: var(--p-accent-dark);
    display: none;
}
.pf-price-display.show { display: block; }

/* ── Toggle switch ────────────────────────────────────────────────────────── */
.pf-toggle-wrap {
    display: flex;
    align-items: center;
    gap: .6rem;
    cursor: pointer;
    user-select: none;
}
.pf-toggle { position: relative; width: 40px; height: 22px; flex-shrink: 0; }
.pf-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.pf-toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--p-border);
    border-radius: 22px;
    transition: background var(--p-transition);
    cursor: pointer;
}
.pf-toggle-slider::before {
    content: '';
    position: absolute;
    left: 3px; top: 3px;
    width: 16px; height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform var(--p-transition);
    box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.pf-toggle input:checked + .pf-toggle-slider { background: var(--p-accent); }
.pf-toggle input:checked + .pf-toggle-slider::before { transform: translateX(18px); }
.pf-toggle-label { font-size: .9rem; font-weight: 600; color: var(--p-text-body); }
.pf-toggle-sub { font-size: .78rem; color: var(--p-text-muted); margin-left: .25rem; }

/* ── Collapsible ──────────────────────────────────────────────────────────── */
.pf-collapse { display: none; }
.pf-collapse.open { display: block; }
.pf-collapse-inner {
    padding-top: 1rem;
    border-top: 1px solid var(--p-border);
    margin-top: 1rem;
}

/* ── Installment calc ─────────────────────────────────────────────────────── */
.pf-inst-calc {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .75rem 1rem;
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border: 1px solid #6ee7b7;
    border-radius: var(--p-r-md);
    margin-top: .75rem;
}
.pf-inst-calc-label { font-size: .85rem; color: var(--p-accent-dark); }
.pf-inst-calc-value { font-size: 1rem; font-weight: 800; color: var(--p-accent-dark); margin-left: auto; }

/* ── Coordinates hint ─────────────────────────────────────────────────────── */
.pf-coords-hint { font-size: .78rem; color: var(--p-text-muted); margin-top: .2rem; }
.pf-coords-hint a { color: var(--p-accent); }

/* ── Upload zones ─────────────────────────────────────────────────────────── */
.pf-upload-zone {
    border: 2px dashed var(--p-border);
    border-radius: var(--p-r-md);
    padding: 1.5rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--p-transition);
    background: var(--p-surface-2);
    position: relative;
}
.pf-upload-zone:hover,
.pf-upload-zone.dragover {
    border-color: var(--p-accent);
    background: #ecfdf5;
}
.pf-upload-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}
.pf-upload-icon { font-size: 2rem; margin-bottom: .4rem; }
.pf-upload-title { font-size: .9rem; font-weight: 700; color: var(--p-text-heading); }
.pf-upload-sub { font-size: .78rem; color: var(--p-text-muted); margin-top: .2rem; }
.pf-upload-sub span { color: var(--p-accent); font-weight: 600; }

/* ── Image preview grid ───────────────────────────────────────────────────── */
.pf-img-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: .6rem;
    margin-top: .85rem;
}
.pf-img-item {
    position: relative;
    aspect-ratio: 4/3;
    border-radius: var(--p-r-sm);
    overflow: hidden;
    border: 1.5px solid var(--p-border);
}
.pf-img-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pf-img-del {
    position: absolute;
    top: 3px; right: 3px;
    width: 20px; height: 20px;
    background: rgba(0,0,0,.6);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: .7rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background var(--p-transition);
    text-decoration: none;
}
.pf-img-del:hover { background: #e11d48; }
.pf-img-badge {
    position: absolute;
    bottom: 3px; left: 3px;
    background: rgba(5,150,105,.9);
    color: #fff;
    font-size: .6rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
}

/* ── Document list ────────────────────────────────────────────────────────── */
.pf-doc-list {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    margin-top: .75rem;
}
.pf-doc-item {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .6rem .85rem;
    background: var(--p-surface-2);
    border: 1px solid var(--p-border);
    border-radius: var(--p-r-md);
    font-size: .85rem;
}
.pf-doc-icon { font-size: 1.1rem; flex-shrink: 0; }
.pf-doc-name { flex: 1; color: var(--p-text-body); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-doc-size { color: var(--p-text-muted); font-size: .75rem; flex-shrink: 0; }
.pf-doc-del {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--p-text-muted);
    font-size: .85rem;
    padding: .2rem;
    border-radius: var(--p-r-sm);
    transition: color var(--p-transition);
    flex-shrink: 0;
    text-decoration: none;
}
.pf-doc-del:hover { color: #e11d48; }

/* ── Progress bar ─────────────────────────────────────────────────────────── */
.pf-progress-wrap {
    display: none;
    margin-top: 1rem;
    padding: 1rem;
    background: var(--p-surface-2);
    border: 1px solid var(--p-border);
    border-radius: var(--p-r-md);
}
.pf-progress-wrap.show { display: block; }
.pf-progress-label { font-size: .85rem; font-weight: 600; color: var(--p-text-body); margin-bottom: .5rem; }
.pf-progress-bar-wrap { height: 6px; background: var(--p-border); border-radius: 3px; overflow: hidden; }
.pf-progress-bar { height: 100%; background: var(--p-gradient-primary); border-radius: 3px; transition: width .3s ease; width: 0%; }
.pf-progress-steps { font-size: .78rem; color: var(--p-text-muted); margin-top: .35rem; }

/* ── Submit area ──────────────────────────────────────────────────────────── */
.pf-submit-area {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1.5px solid var(--p-border);
    flex-wrap: wrap;
}
.pf-cancel { color: var(--p-text-muted); text-decoration: none; font-size: .9rem; }
.pf-cancel:hover { color: var(--p-text-body); }
.pf-submit-btn {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .85rem 2rem;
    background: var(--p-gradient-primary);
    color: #fff;
    border: none;
    border-radius: var(--p-r-md);
    font-family: var(--p-font);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--p-shadow-glow);
    transition: all var(--p-transition);
    position: relative;
    overflow: hidden;
}
.pf-submit-btn::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 60%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.15), transparent);
    transform: translateX(-100%);
}
.pf-submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    filter: brightness(1.08);
    box-shadow: var(--p-shadow-glow-hover);
}
.pf-submit-btn:hover:not(:disabled)::before { animation: portal-shine .5s ease forwards; }
.pf-submit-btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }

/* Draft button */
.pf-draft-btn {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .8rem 1.5rem;
    background: #fff;
    color: var(--p-primary);
    border: 1.5px solid var(--p-primary);
    border-radius: var(--p-r-md);
    font-family: var(--p-font);
    font-size: .95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--p-transition);
}
.pf-draft-btn:hover:not(:disabled) { background: #f0f6ff; }
.pf-draft-btn:disabled { opacity: .6; cursor: not-allowed; }

/* ── SEO character counters ────────────────────────────────────────────────── */
.pf-seo-bar {
    height: 4px;
    background: var(--p-border);
    border-radius: 2px;
    margin: .4rem 0 .25rem;
    overflow: hidden;
}
.pf-seo-bar-fill {
    height: 100%;
    border-radius: 2px;
    width: 0%;
    transition: width .2s, background .2s;
    background: #22c55e;
}
.pf-seo-bar-fill.warn  { background: #f59e0b; }
.pf-seo-bar-fill.over  { background: #ef4444; }
.pf-seo-hint {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .78rem;
    color: var(--p-text-muted);
}
.pf-seo-status { font-weight: 600; }
.pf-seo-status.good  { color: #16a34a; }
.pf-seo-status.warn  { color: #d97706; }
.pf-seo-status.over  { color: #dc2626; }

/* ── Error banner ─────────────────────────────────────────────────────────── */
.pf-form-error {
    padding: .7rem 1rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--p-r-md);
    color: #b91c1c;
    font-size: .88rem;
    display: none;
    margin-bottom: 1rem;
}
.pf-form-error.show { display: block; }

/* ── Success screen ───────────────────────────────────────────────────────── */
.pf-success { text-align: center; padding: 3rem 1.5rem; display: none; }
.pf-success.show { display: block; }
.pf-success-icon { font-size: 3.5rem; margin-bottom: 1rem; }
.pf-success h2 { font-size: 1.5rem; font-weight: 800; color: var(--p-primary); margin: 0 0 .5rem; }
.pf-success p { color: var(--p-text-muted); margin: 0 0 1.5rem; }
.pf-success-actions { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; }
