/*
 * KAWAI Händlersuche – Frontend Styles
 * Scoped inside .kawai-hs-wrap
 * Matches the original RetailerCard / RetailerList design from the Next.js frontend.
 */

/* ============================================================
   Reset & wrapper
   ============================================================ */
.kawai-hs-wrap {
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: #111827;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 48px 16px 80px;
}

.kawai-hs-wrap *,
.kawai-hs-wrap *::before,
.kawai-hs-wrap *::after {
    box-sizing: inherit;
}

/* ============================================================
   Search box  (bg-gray-50, rounded-xl, p-4 md:p-6)
   ============================================================ */
.kawai-hs-wrap .kh-search-box {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 32px;
    position: relative;
    z-index: 20;
}

.kawai-hs-wrap .kh-search-fields {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Product group select */
.kawai-hs-wrap .kh-group-select {
    display: block;
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    font-family: inherit;
    color: #111827;
    background: #ffffff
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7280' d='M1 1l5 5 5-5'/%3E%3C/svg%3E")
        no-repeat right 14px center;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    padding-right: 40px;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.kawai-hs-wrap .kh-group-select:focus {
    border-color: #e60026;
    box-shadow: 0 0 0 3px rgba(230, 0, 38, 0.12);
}

/* Location row */
.kawai-hs-wrap .kh-location-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.kawai-hs-wrap .kh-location-wrap {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.kawai-hs-wrap .kh-location-input {
    display: block;
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    font-family: inherit;
    color: #111827;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.kawai-hs-wrap .kh-location-input::placeholder {
    color: rgba(0, 0, 0, 0.5);
    opacity: 1;
}

.kawai-hs-wrap .kh-location-input:focus {
    border-color: #e60026;
    box-shadow: 0 0 0 3px rgba(230, 0, 38, 0.12);
}

/* ============================================================
   Suggestions dropdown
   ============================================================ */
.kawai-hs-wrap .kh-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 1000;
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 220px;
    overflow-y: auto;
}

.kawai-hs-wrap .kh-suggestions li {
    padding: 10px 16px;
    font-size: 13px;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    color: #374151;
    transition: background 0.12s ease;
}

.kawai-hs-wrap .kh-suggestions li:last-child { border-bottom: none; }

.kawai-hs-wrap .kh-suggestions li:hover,
.kawai-hs-wrap .kh-suggestions li.kh-highlighted {
    background: #f3f4f6;
}

/* Locate button – theme-compatible class + fallback */
.kawai-hs-wrap .button-dealersearch-detect-location {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    color: #ffffff;
    background: #2e2e2e;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.18s ease;
    text-decoration: none;
}

.kawai-hs-wrap .button-dealersearch-detect-location:hover {
    background: #1a1a1a;
    color: #ffffff;
}

.kawai-hs-wrap .button-dealersearch-detect-location:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* ============================================================
   Selection Center mobile banner
   ============================================================ */
.kawai-hs-wrap .kh-sc-banner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 24px;
    font-size: 13px;
    color: #374151;
    text-align: center;
}

.kawai-hs-wrap .kh-sc-banner img {
    height: 20px;
    width: auto;
}

@media (min-width: 768px) {
    .kawai-hs-wrap .kh-sc-banner { display: none; }
}

/* ============================================================
   CTA text & no-results
   ============================================================ */
.kawai-hs-wrap .kh-cta {
    text-align: center;
    color: #9ca3af;
    font-size: 15px;
    margin: 32px 0;
}

.kawai-hs-wrap .kh-no-results {
    text-align: center;
    color: #374151;
    padding: 40px 16px;
    font-size: 15px;
    grid-column: 1 / -1;
}

/* ============================================================
   Divider
   ============================================================ */
.kawai-hs-wrap .kh-divider {
    border: none;
    border-top: 2px solid #e5e7eb;
    margin: 0 0 32px;
}

/* ============================================================
   Results grid  (2-column desktop)
   ============================================================ */
.kawai-hs-wrap .kh-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

@media (min-width: 768px) {
    .kawai-hs-wrap .kh-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================================
   Dealer card  (bg-gray-50, rounded-2xl, p-6 md:p-10)
   ============================================================ */
.kawai-hs-wrap .kh-card {
    background: #f9fafb;
    border-radius: 16px;
    padding: 28px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 20px;
    position: relative;
    transition: box-shadow 0.2s ease;
}

.kawai-hs-wrap .kh-card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.kawai-hs-wrap .kh-card--sc {
    border: 1px solid rgba(230, 0, 38, 0.18);
}

.kawai-hs-wrap .kh-card--rd:not(.kh-card--sc) {
    border: 1px solid rgba(29, 111, 184, 0.18);
}

/* Inner content */
.kawai-hs-wrap .kh-card-inner {
    flex: 1;
    position: relative;
}

/* Distance (red, bold, small) */
.kawai-hs-wrap .kh-dist {
    display: block;
    color: #e60026;
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 4px;
}

/* Company name */
.kawai-hs-wrap .kh-company {
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
    margin: 0 0 12px;
    line-height: 1.3;
}

/* ============================================================
   Selection Center badge
   ============================================================ */
.kawai-hs-wrap .kh-sc-badge {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
}

.kawai-hs-wrap .kh-sc-img,
.kawai-hs-wrap .kh-rd-img {
    height: 20px;
    width: auto;
    display: block;
}

/* ⓘ info icon */
.kawai-hs-wrap .kh-sc-info {
    position: relative;
    display: inline-flex;
    align-items: center;
    color: #6b7280;
    cursor: help;
    line-height: 1;
}

.kawai-hs-wrap .kh-sc-info svg {
    display: block;
}

.kawai-hs-wrap .kh-sc-info:hover {
    color: #374151;
}

/* Tooltip */
.kawai-hs-wrap .kh-sc-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #000000;
    color: #ffffff;
    font-size: 12px;
    line-height: 1.5;
    padding: 8px 12px;
    border-radius: 5px;
    white-space: normal;
    width: 210px;
    text-align: left;
    z-index: 100;
    pointer-events: none;
}

.kawai-hs-wrap .kh-sc-info:hover .kh-sc-tooltip {
    display: block;
}

/* Tablet & mobile: stack the badge in normal flow (like the mobile view)
   instead of the absolute top-right position, to avoid overlapping the
   company name on the narrower 2-column cards. */
@media (max-width: 1024px) {
    .kawai-hs-wrap .kh-sc-badge {
        position: static;
        justify-content: flex-end;
        margin-bottom: 12px;
    }
}

/* ============================================================
   Info list (address / email / phone / url)
   ============================================================ */
.kawai-hs-wrap .kh-info-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.kawai-hs-wrap .kh-info-list li a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #374151;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.15s ease;
}

.kawai-hs-wrap .kh-info-list li a:hover {
    color: #e60026;
}

.kawai-hs-wrap .kh-icon {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    color: #e60026;
}

/* Icons inside the action buttons inherit the button text color (white) */
.kawai-hs-wrap .kh-btn-grid .kh-icon {
    color: inherit;
}

/* ============================================================
   Button grid (2 × 2)
   ============================================================ */
.kawai-hs-wrap .kh-btn-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

/* Theme-compatible button classes + self-contained fallback */
.kawai-hs-wrap .button-dealersearch-results-cta-route,
.kawai-hs-wrap .button-dealersearch-results-cta-contact,
.kawai-hs-wrap .button-dealersearch-results-cta-web,
.kawai-hs-wrap .button-dealersearch-results-cta-email {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
    text-align: center;
}

.kawai-hs-wrap .button-dealersearch-results-cta-route,
.kawai-hs-wrap .button-dealersearch-results-cta-contact,
.kawai-hs-wrap .button-dealersearch-results-cta-web,
.kawai-hs-wrap .button-dealersearch-results-cta-email {
    background: #111827;
    color: #ffffff;
    border: 2px solid #111827;
}

.kawai-hs-wrap .button-dealersearch-results-cta-route:hover,
.kawai-hs-wrap .button-dealersearch-results-cta-contact:hover,
.kawai-hs-wrap .button-dealersearch-results-cta-web:hover,
.kawai-hs-wrap .button-dealersearch-results-cta-email:hover {
    background: #374151;
    border-color: #374151;
    color: #ffffff;
}

.kawai-hs-wrap .button-dealersearch-results-cta-contact-disabled,
.kawai-hs-wrap .button-dealersearch-results-cta-web-disabled,
.kawai-hs-wrap .button-dealersearch-results-cta-email-disabled {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    border-radius: 8px;
    border: 2px solid #e5e7eb;
    background: transparent;
    color: #d1d5db;
    cursor: not-allowed;
}

/* ============================================================
   Responsive – mobile (≤ 560px)
   ============================================================ */
@media (max-width: 560px) {
    .kawai-hs-wrap {
        padding: 24px 12px 48px;
    }

    .kawai-hs-wrap .kh-search-box {
        padding: 16px;
    }

    .kawai-hs-wrap .kh-card {
        padding: 20px;
    }

    /* Mobile: badge left-aligned above the company name (name sits under the
       badge, no overlap on narrow screens). */
    .kawai-hs-wrap .kh-sc-badge {
        justify-content: flex-start;
    }

    /* Mobile: hide the ⓘ info icons – the hover tooltip is not usable on touch
       and the icon crowds the badge. */
    .kawai-hs-wrap .kh-sc-info {
        display: none;
    }

    .kawai-hs-wrap .kh-btn-grid {
        grid-template-columns: 1fr 1fr;
    }

    .kawai-hs-wrap .button-dealersearch-detect-location {
        width: 100%;
        justify-content: center;
    }
}
