/* ============================================================
   Ask The Market — Frontend Styles v2.1
   No dependency on Foundation or Bootstrap.
   ============================================================ */

:root {
    --atm-purple:  #362f8c;
    --atm-green:   #438d83;
    --atm-orange:  #e07b30;
    --atm-red:     #c0392b;
    --atm-border:  #ddd;
    --atm-bg:      #f8f8f8;
    --atm-text:    #222;
    --atm-radius:  12px;
    --atm-shadow:  0 2px 12px rgba(0,0,0,0.08);
}

/* ── Colour utilities ── */
.atm-purple { color: var(--atm-purple); }
.atm-green  { color: var(--atm-green); }
.atm-orange { color: var(--atm-orange); }
.atm-red    { color: var(--atm-red); }

/* ── Panel ── */
.atm-panel {
    background: #fff;
    border: 1px solid var(--atm-border);
    border-radius: var(--atm-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--atm-shadow);
}
.atm-panel__title {
    font-size: 1.1rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 0 0 1rem;
}
.atm-panel__add {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--atm-border);
}

/* ── Two-column layout ── */
.atm-two-col {
    display: flex;
    gap: 1.5rem;
    align-items: stretch;
    margin-bottom: 0;
}
.atm-two-col__left  { flex: 1; min-width: 0; }
.atm-two-col__right { flex: 1; min-width: 0; }

@media ( max-width: 768px ) {
    .atm-two-col { flex-direction: column; }
}

/* ── Guide price ── */
.atm-guide-price {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--atm-text);
    margin: 0.25rem 0 1rem;
    line-height: 1;
}

/* ── Detail grid ── */
.atm-detail-grid {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
}
.atm-detail-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.15rem;
}
.atm-detail-item i {
    width: 1.4rem;
    text-align: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}

/* ── Map ── */
.atm-map { border-radius: var(--atm-radius); overflow: hidden; }
.atm-map--large { width: 100%; height: 400px; }

/* ── Agent logo grid — 5 per row, 2 rows max ── */
.atm-agents-logo-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.75rem;
}
.atm-agent-tile {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    border: 1px solid var(--atm-border);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    padding: 6px;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.atm-agent-tile:hover {
    border-color: var(--atm-green);
    box-shadow: 0 0 0 2px rgba(67,141,131,0.2);
}
.atm-agent-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    cursor: pointer;
}
.atm-agent-selected {
    outline: 3px solid var(--atm-green);
    border-radius: 4px;
}

/* Fallback grid for rate-my-agent page */
.atm-agents-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
}
.atm-agent-logo {
    flex: 0 0 calc(25% - 0.75rem);
    display: flex;
    align-items: center;
    justify-content: center;
}

@media ( max-width: 640px ) {
    .atm-agents-logo-grid { grid-template-columns: repeat(3, 1fr); }
    .atm-agent-logo { flex: 0 0 calc(50% - 0.5rem); }
}

/* ── Property row (my-market) ── */
.atm-property-row {
    display: flex;
    gap: 1rem;
    align-items: stretch;
    padding: 1rem 0;
    border-bottom: 1px solid var(--atm-border);
}
.atm-property-row:last-of-type { border-bottom: none; }
.atm-property-row--compact {
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.atm-property-map {
    flex: 0 0 120px;
    height: 80px;
    border-radius: 10px;
    border: 1px solid var(--atm-border);
    overflow: hidden;
}
.atm-property-info { flex: 1; min-width: 0; }
.atm-property-header {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 0.5rem;
}
.atm-property-address {
    font-size: 1.1rem;
    text-transform: uppercase;
    color: var(--atm-text);
    line-height: 1.3;
}
.atm-property-meta  { font-size: 0.95rem; color: #555; margin: 0.3rem 0; }
.atm-property-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.4rem;
    font-size: 0.9rem;
}

/* ── DEFCON ── */
.atm-defcon { flex: 0 0 100px; }
.atm-defcon img { width: 100%; display: block; }

/* ── Interest badge ── */
.atm-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--atm-purple);
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    margin-right: 0.3rem;
}
.atm-interest-count { display: flex; align-items: center; font-weight: 600; }

/* ── List row ── */
.atm-list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--atm-border);
    font-size: 1.1rem;
}
.atm-list-row:last-child { border-bottom: none; }
.atm-list-row--stacked   { flex-direction: column; align-items: flex-start; }
.atm-list-row__main      { display: flex; justify-content: space-between; width: 100%; }

/* ── Links ── */
.atm-link-purple { color: var(--atm-purple); text-decoration: none; font-weight: 600; }
.atm-link-green  { color: var(--atm-green);  text-decoration: none; font-weight: 600; }
.atm-link-purple:hover, .atm-link-green:hover { text-decoration: underline; }
.atm-delete-link { color: #999; font-size: 1rem; text-decoration: none; flex-shrink: 0; transition: color 0.2s; }
.atm-delete-link:hover { color: var(--atm-red); }

/* ── Buttons ── */
.atm-btn {
    display: inline-block;
    padding: 0.5rem 1.2rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.2s;
}
.atm-btn:hover      { opacity: 0.85; }
.atm-btn:disabled   { opacity: 0.4; cursor: not-allowed; }
.atm-btn--green     { background: var(--atm-green);  color: #fff; }
.atm-btn--purple    { background: var(--atm-purple); color: #fff; }
.atm-btn--secondary { background: #eee; color: #444; }

/* ── Stats (match-em-up) ── */
.atm-stats { display: flex; gap: 1.5rem; flex-wrap: wrap; margin: 1rem 0; }
.atm-stat  { display: flex; flex-direction: column; align-items: center; background: var(--atm-bg); border-radius: 10px; padding: 1rem 1.5rem; min-width: 120px; font-size: 1rem; }
.atm-stat__num { font-size: 2.5rem; font-weight: 700; color: var(--atm-green); line-height: 1; }

/* ── Tables ── */
.atm-table { width: 100%; border-collapse: collapse; font-size: 1rem; }
.atm-table th,
.atm-table td { padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--atm-border); text-align: left; }
.atm-table th { font-weight: 700; background: var(--atm-bg); }

/* ── Agent cards (rate-my-agent) ── */
.atm-agents-list { display: flex; flex-direction: column; gap: 1rem; }
.atm-agent-card  { display: flex; align-items: center; gap: 1rem; padding: 1rem; border: 1px solid var(--atm-border); border-radius: 10px; flex-wrap: wrap; }
.atm-agent-card__logo    { max-height: 50px; max-width: 120px; object-fit: contain; }
.atm-agent-card__info    { flex: 1; min-width: 200px; }
.atm-agent-card__ratings { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 0.4rem; font-size: 1rem; }
.atm-agent-card__action  { flex-shrink: 0; }

/* ── Star ratings ── */
.atm-stars-container { display: inline-flex; }
.atm-star-wrap { position: relative; display: inline-block; font-size: 1.2rem; color: #ddd; }
.atm-star-fill { position: absolute; top: 0; left: 0; overflow: hidden; color: #f5a623; white-space: nowrap; }

.atm-star-input { display: flex; flex-direction: row-reverse; justify-content: flex-end; gap: 4px; margin-bottom: 1rem; }
.atm-star-input input { display: none; }
.atm-star-input label { font-size: 1.8rem; color: #ddd; cursor: pointer; transition: color 0.15s; }
.atm-star-input input:checked ~ label,
.atm-star-input label:hover,
.atm-star-input label:hover ~ label { color: #f5a623; }

/* ── Modal ── */
.atm-modal { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; }
.atm-modal__overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.5); }
.atm-modal__box { position: relative; background: #fff; border-radius: var(--atm-radius); padding: 2rem; width: 90%; max-width: 480px; box-shadow: 0 8px 40px rgba(0,0,0,0.2); }
.atm-modal__header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.atm-modal__header h5 { margin: 0; font-size: 1.2rem; }
.atm-modal__close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: #888; line-height: 1; padding: 0; }
.atm-modal__footer { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--atm-border); }

/* ── Forms ── */
.atm-search-form { max-width: 500px; }
.atm-form-row { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 1rem; }
.atm-form-row label { font-weight: 600; font-size: 1rem; }
.atm-form-row input { padding: 0.5rem 0.75rem; border: 1px solid var(--atm-border); border-radius: 6px; font-size: 1rem; width: 100%; box-sizing: border-box; }
.atm-form-row input:focus { outline: none; border-color: var(--atm-green); box-shadow: 0 0 0 2px rgba(67,141,131,0.2); }

/* ── Notices ── */
.atm-notice       { color: #666; font-style: italic; padding: 0.5rem 0; font-size: 1rem; }
.atm-notice-small { font-size: 0.9rem; color: #999; }

/* ── Responsive ── */
@media ( max-width: 640px ) {
    .atm-property-row { flex-direction: column; }
    .atm-property-map { flex: none; width: 100%; height: 140px; }
    .atm-defcon       { flex: none; width: 80px; }
    .atm-modal__box   { padding: 1.25rem; }
    .atm-stats        { gap: 0.75rem; }
}

/* ── My Market layout ────────────────────────────────────────────────────────── */
.atm-my-market { width: 100%; }

/* Equal-height panels in two-col rows */
.atm-two-col--top { align-items: stretch; }
.atm-panel--full-height { height: 100%; box-sizing: border-box; }

/* Count badge in panel title */
.atm-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.6rem;
    height: 1.6rem;
    border-radius: 999px;
    background: var(--atm-purple);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0 0.4rem;
    margin-left: 0.4rem;
    vertical-align: middle;
}
.atm-count-badge--green { background: var(--atm-green); }

/* ── Market card (buyer/seller property) ── */
.atm-market-card {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 1rem 0;
    border-bottom: 1px solid var(--atm-border);
}
.atm-market-card:last-of-type { border-bottom: none; }

.atm-market-card__map {
    flex: 0 0 130px;
    height: 110px;
    border-radius: 10px;
    border: 1px solid var(--atm-border);
    overflow: hidden;
    background: var(--atm-bg);
}
.atm-defcon-sm {
    flex: 0 0 80px;
}
.atm-defcon-sm img { width: 100%; display: block; border-radius: 8px; }

.atm-market-card__body  { flex: 1; min-width: 0; }
.atm-market-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}
.atm-market-card__address {
    font-size: 1.2rem;
    text-transform: uppercase;
    color: var(--atm-text);
    line-height: 1.3;
}
.atm-market-card__meta {
    font-size: 1.05rem;
    color: #555;
    margin-bottom: 0.5rem;
}
.atm-market-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.4rem;
    font-size: 1rem;
}

/* Small button variant */
.atm-btn--sm {
    padding: 0.35rem 0.85rem;
    font-size: 0.9rem;
}

/* ── Alert rows ── */
.atm-alert-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--atm-border);
}
.atm-alert-row:last-child { border-bottom: none; }
.atm-alert-row__info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}
.atm-alert-row__postcode { font-size: 1rem; color: #888; }
.atm-alert-row__actions  { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; }

/* Match quality pill */
.atm-match-pill {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
}
.atm-match-pill.atm-green  { background: var(--atm-green); }
.atm-match-pill.atm-orange { background: var(--atm-orange); }
.atm-match-pill.atm-red    { background: var(--atm-red); }

/* ── List row right-align helper ── */
.atm-list-row__right { display: flex; align-items: center; gap: 0.5rem; }

/* ── Places grid ── */
.atm-places-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}
.atm-place-chip {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.9rem;
    background: var(--atm-bg);
    border-radius: 8px;
    border: 1px solid var(--atm-border);
    font-size: 1.1rem;
    flex-wrap: wrap;
}
.atm-place-chip__name   { font-weight: 600; flex: 1; }
.atm-place-chip__detail { font-size: 1rem; color: #555; }

/* ── Valuation Results ───────────────────────────────────────────────────────── */
.atm-val-price-block {
    margin: 1rem 0;
}
.atm-val-label {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #888;
    margin-bottom: 0.25rem;
}
.atm-val-price {
    font-size: 2.8rem;
    font-weight: 700;
    color: var(--atm-green);
    line-height: 1;
}
.atm-val-date {
    font-size: 1.1rem;
    color: #666;
    margin-top: 0.35rem;
}
.atm-val-ctas {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
    align-items: center;
}
.atm-btn--lg {
    padding: 0.6rem 1.25rem;
    font-size: 1rem;
    text-align: center;
    white-space: nowrap;
}
.atm-val-cta-note {
    font-size: 1rem;
    color: #888;
    margin: 0;
}
.atm-val-table td,
.atm-val-table th {
    font-size: 1.1rem;
    padding: 0.75rem 0.8rem;
}

/* ── 75/25 two-col variant (valuation map) ── */
.atm-two-col--75 .atm-two-col__left  { flex: 3; }
.atm-two-col--75 .atm-two-col__right { flex: 1; min-width: 260px; }
