/* ============================================================
   Aoprema Mounting Locator — frontend
   ============================================================ */

/* Hide the native WPCPO select but keep it focusable/submittable
   (so required validation doesn't hit a non-focusable element). */
.aml-native.screen-reader-text,
.aml-option .aml-native.screen-reader-text {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* All plugin buttons share the brand look. !important + specificity beat the
   theme's global black button styling. */
.aml-option .aml-open-btn,
.aml-option .aml-change-btn,
.aml-modal .aml-search-btn,
.aml-modal .aml-select-garage {
    display: inline-block;
    background: #000 !important;
    color: #fff !important;
    border: 0 !important;
    border-radius: 4px !important;
    font-weight: 700 !important;
    cursor: pointer;
    line-height: 1.2;
    text-transform: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
    letter-spacing: normal;
}

.aml-option .aml-open-btn,
.aml-option .aml-change-btn {
    padding: 12px 20px;
}

.aml-option .aml-open-btn:hover,
.aml-option .aml-change-btn:hover,
.aml-modal .aml-search-btn:hover,
.aml-modal .aml-select-garage:hover {
    background: #333 !important;
    color: #fff !important;
}

/* Framed box — identical for both the empty and the selected state */
.aml-option .aml-field-frame {
    display: block;
    background: #fff8de;
    border: 1px solid #f4c20d;
    border-radius: 4px;
    padding: 10px 14px;
}

.aml-option .aml-empty,
.aml-option .aml-selected {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Honor the hidden attribute even though we set an explicit display above
   (an explicit `display` would otherwise override [hidden]'s display:none). */
.aml-option .aml-empty[hidden],
.aml-option .aml-selected[hidden] {
    display: none !important;
}

.aml-option .aml-empty-text,
.aml-option .aml-selected-text { flex: 1 1 auto; }
.aml-option .aml-empty-text { color: #555; }
.aml-option .aml-check { color: #2e7d32; font-weight: 700; }
.aml-option .aml-change-btn { padding: 8px 14px; font-size: 13px; }
.aml-option .aml-req { color: #d63638; }

/* ============================================================
   Modal
   ============================================================ */
.aml-modal[hidden] { display: none; }

.aml-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.aml-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
}

.aml-modal-dialog {
    position: relative;
    background: #fff;
    width: 1040px;
    max-width: 95vw;
    height: 86vh;
    max-height: 760px;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.aml-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    border-bottom: 1px solid #eee;
}

.aml-modal-title { margin: 0; font-size: 16px; font-weight: 600; }

.aml-modal-close {
    background: none;
    border: 0;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    color: #666;
    padding: 0 4px;
}
.aml-modal-close:hover { color: #000; }

.aml-modal-body {
    flex: 1 1 auto;
    display: flex;
    min-height: 0;
}

/* Left panel: search + list */
.aml-panel {
    width: 38%;
    min-width: 280px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #eee;
    min-height: 0;
}

.aml-search { padding: 12px; }

.aml-search-input {
    width: 100%;
    box-sizing: border-box;
    padding: 9px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin-bottom: 8px;
}

.aml-search-btn {
    width: 100%;
    background: #000;
    color: #fff;
    border: 0;
    border-radius: 4px;
    font-weight: 700;
    padding: 9px 12px;
    cursor: pointer;
}
.aml-search-btn:hover { background: #333; }

.aml-list-notice {
    margin: 0 12px 10px;
    padding: 8px 10px;
    border-left: 3px solid #f4c20d;
    background: #fffbea;
    font-size: 13px;
    line-height: 1.4;
}
.aml-list-notice[hidden] { display: none !important; }

.aml-list {
    list-style: none;
    margin: 0;
    padding: 0 12px 12px;
    overflow-y: auto;
    flex: 1 1 auto;
}

.aml-card {
    border: 1px solid #eaeaea;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}
.aml-card:hover { border-color: #f4c20d; }
.aml-card-focus { box-shadow: 0 0 0 2px #f4c20d inset; }
.aml-card-selected { border-color: #2e7d32; background: #f4fbf4; }

.aml-card-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
}
.aml-card-name { font-weight: 700; color: #000; }
.aml-card-services { font-size: 12px; color: #888; white-space: nowrap; }
.aml-card-addr { font-size: 13px; color: #555; margin: 4px 0; }

.aml-card-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 6px 0;
}
.aml-card-meta { flex-wrap: wrap; }
.aml-card-price { font-weight: 700; }
.aml-price-label { color: #555; font-weight: 600; }
.aml-card-meta .aml-pp { margin-right: 12px; white-space: nowrap; }

/* Google rating row (under the price) with proportional star fill */
.aml-card-rating {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #555;
    margin: 2px 0 8px;
}
.aml-stars {
    position: relative;
    display: inline-block;
    white-space: nowrap;
    line-height: 1;
    font-size: 15px;
}
.aml-stars-empty { color: #d8d8d8; }
.aml-stars-full {
    position: absolute;
    left: 0;
    top: 0;
    overflow: hidden;
    white-space: nowrap;
    color: #f4c20d;
}
.aml-rating-num { font-weight: 700; color: #444; }

.aml-more-toggle { font-size: 12px; color: #2271b1; display: inline-block; margin-bottom: 6px; }
.aml-card-details { font-size: 13px; color: #444; margin: 4px 0 8px; }
.aml-card-row { margin: 2px 0; }

.aml-select-garage {
    display: block;
    width: 100%;
    background: #000;
    color: #fff;
    border: 0;
    border-radius: 4px;
    font-weight: 700;
    padding: 9px 12px;
    cursor: pointer;
}
.aml-select-garage:hover { background: #333; }

.aml-no-results { color: #888; padding: 20px 4px; text-align: center; }

/* Right panel: map */
.aml-map {
    flex: 1 1 auto;
    height: 100%;
    min-height: 300px;
}

body.aml-modal-active { overflow: hidden; }

/* ============================================================
   Responsive — stack panels on mobile
   ============================================================ */
@media (max-width: 782px) {
    .aml-modal-dialog { height: 92vh; max-height: none; }
    .aml-modal-body { flex-direction: column; }
    .aml-panel {
        width: 100%;
        min-width: 0;
        border-right: 0;
        border-bottom: 1px solid #eee;
        max-height: 50%;
    }
    .aml-map { min-height: 240px; }
}
