/* ==========================================================================
   Dealer Grid  –  assets/dealer-grid.css   v1.5
   Self-contained. No dependency on listings.css.
   ========================================================================== */

/* ── Wrapper ─────────────────────────────────────────────────────────── */
.pms-dg-wrap {
    margin: 1.5em 0;
    font-family: inherit;
}

/* ── Region filter ───────────────────────────────────────────────────── */
.pms-dg-region-filter {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem 1.4rem;
    margin-bottom: 1.1rem;
    padding: .75rem 1rem;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
}

.pms-dg-region-label {
    display: flex;
    align-items: center;
    gap: .45rem;
    font-size: .875rem;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    color: inherit;
    opacity: .75;
    transition: opacity .15s;
}
.pms-dg-region-label:hover { opacity: 1; }

/* Native radio — visually hidden, replaced by a custom circle */
.pms-dg-region-radio {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.35);
    border-radius: 50%;
    flex-shrink: 0;
    position: relative;
    cursor: pointer;
    transition: border-color .15s;
}
.pms-dg-region-radio::after {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    background: #7c3aed;
    opacity: 0;
    transition: opacity .15s;
}
.pms-dg-region-radio:checked {
    border-color: #7c3aed;
}
.pms-dg-region-radio:checked::after {
    opacity: 1;
}
.pms-dg-region-label:has(.pms-dg-region-radio:checked) {
    opacity: 1;
    font-weight: 600;
}

/* ── Search bar ──────────────────────────────────────────────────────── */
.pms-dg-controls {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.pms-dg-search {
    flex: 1 1 200px;
    padding: .5rem .9rem;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    color: inherit;
    font-size: .9rem;
    outline: none;
    transition: border-color .2s;
}
.pms-dg-search::placeholder { opacity: .45; }
.pms-dg-search:focus         { border-color: rgba(255,255,255,0.4); }

.pms-dg-count {
    font-size: .8rem;
    opacity: .5;
    white-space: nowrap;
}

/* ── Grid ────────────────────────────────────────────────────────────── */
.pms-dg-grid {
    display: grid !important;
    gap: 16px;
    width: 100%;
    /* column count set via inline style on the element */
}

/* Responsive overrides — narrower screens reduce columns */
@media (max-width: 1100px) {
    .pms-dg-cols-4 { grid-template-columns: repeat(3, 1fr) !important; }
}
@media (max-width: 900px) {
    .pms-dg-cols-3,
    .pms-dg-cols-4 { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (max-width: 540px) {
    .pms-dg-cols-2,
    .pms-dg-cols-3,
    .pms-dg-cols-4 { grid-template-columns: 1fr !important; }
}

/* ── Card ────────────────────────────────────────────────────────────── */
.pms-dg-card {
    display: flex;
    flex-direction: column;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.08);
    background: transparent;
    cursor: pointer;
    transition: border-color .2s, box-shadow .2s;
}
.pms-dg-card:hover {
    border-color: rgba(255,255,255,0.22);
    box-shadow: 0 4px 20px rgba(0,0,0,0.18);
}
.pms-dg-card:focus-visible {
    outline: 2px solid rgba(255,255,255,0.4);
    outline-offset: 2px;
}

/* Image */
.pms-dg-card-img-link {
    display: block;
    text-decoration: none;
}
.pms-dg-card-img {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: rgba(255,255,255,0.04);
}
.pms-dg-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
    transition: transform .3s ease;
}
.pms-dg-card:hover .pms-dg-card-img img {
    transform: scale(1.04);
}

/* Body */
.pms-dg-card-body {
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.pms-dg-card-name-link {
    text-decoration: none;
    color: inherit;
}
.pms-dg-card-name {
    margin: 0 0 2px;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.3;
    color: inherit;
}
.pms-dg-card-name-link:hover .pms-dg-card-name { opacity: .75; }

/* Badge */
.pms-dg-badge {
    display: inline-block;
    align-self: flex-start;
    padding: .2em .75em;
    border-radius: 4px;
    background: #7c3aed;
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    line-height: 1.7;
    margin-bottom: 4px;
}

.pms-dg-badge--admin {
    background: #b91c1c; /* red — distinct from the purple Dealer badge */
}


.pms-dg-field {
    margin: 0;
    font-size: .875rem;
    line-height: 1.4;
    display: flex;
    flex-wrap: wrap;
    gap: 0 6px;
    align-items: baseline;
}

.pms-dg-field-label {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    opacity: .5;
    white-space: nowrap;
}

.pms-dg-field-value {
    color: inherit;
    word-break: break-all;
}

.pms-dg-field--region .pms-dg-field-value {
    font-weight: 600;
}

.pms-dg-phone {
    color: inherit;
    text-decoration: none;
    word-break: break-all;
}
.pms-dg-phone:hover { text-decoration: underline; }

/* ── Empty state ─────────────────────────────────────────────────────── */
.pms-dg-empty {
    opacity: .55;
    font-style: italic;
    padding: 24px 0;
    grid-column: 1 / -1;
}

/* ── Pagination ──────────────────────────────────────────────────────── */
.pms-dg-pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .375rem;
    margin-top: 1.5rem;
}

.pms-dg-page-btn {
    min-width: 34px;
    height: 34px;
    padding: 0 .5rem;
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 5px;
    background: transparent;
    color: inherit;
    font-size: .875rem;
    cursor: pointer;
    transition: background .15s, border-color .15s;
    line-height: 1;
}
.pms-dg-page-btn:hover:not(:disabled) {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.35);
}
.pms-dg-page-btn.is-active {
    background: #7c3aed;
    border-color: #7c3aed;
    font-weight: 700;
    cursor: default;
}
.pms-dg-page-btn:disabled {
    opacity: .3;
    cursor: not-allowed;
}
