/**
 * Yamasaki Dealer Map Frontend Styles
 */

.ydm-dealer-map-container {
    --ydm-surface: #f2eeea;
    --ydm-surface-elevated: #fffdfa;
    --ydm-surface-muted: #ebe5de;
    --ydm-surface-strong: #ddd5cc;
    --ydm-outline: #d8cfc6;
    --ydm-outline-strong: #c6bbae;
    --ydm-text-primary: #231f1a;
    --ydm-text-secondary: #564e47;
    --ydm-text-tertiary: #7e746b;
    --ydm-primary: #d70000;
    --ydm-primary-hover: #b80000;
    --ydm-service: #2d79d6;
    position: relative;
    width: var(--ydm-map-width, 100%);
    margin: 32px 0;
    padding: 28px;
    color: var(--ydm-text-secondary);
    background:
        radial-gradient(circle at top right, rgba(215, 0, 0, 0.06), transparent 34%),
        linear-gradient(180deg, #f7f4f1 0%, #efe9e2 100%);
    border: 1px solid rgba(57, 43, 32, 0.1);
    border-radius: 30px;
    box-shadow: 0 20px 44px rgba(48, 38, 30, 0.12);
}

.ydm-dealer-map-container * {
    box-sizing: border-box;
}

.ydm-map-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px 18px;
    margin-bottom: 22px;
    padding: 18px;
    background: rgba(255, 253, 250, 0.84);
    border: 1px solid rgba(90, 78, 67, 0.1);
    border-radius: 24px;
    box-shadow: 0 14px 30px rgba(56, 43, 31, 0.08);
    backdrop-filter: blur(10px);
}

.ydm-search-box {
    display: flex;
    flex: 1 1 420px;
    align-items: center;
    gap: 10px;
}

.ydm-search-box input[type="text"] {
    flex: 1 1 auto;
    min-width: 0;
    padding: 14px 18px;
    border: 1px solid var(--ydm-outline);
    border-radius: 18px;
    background: #ffffff;
    color: var(--ydm-text-primary);
    font: inherit;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.ydm-search-box input[type="text"]::placeholder {
    color: #8c8178;
}

.ydm-search-box input[type="text"]:focus {
    outline: none;
    border-color: rgba(215, 0, 0, 0.45);
    box-shadow: 0 0 0 4px rgba(215, 0, 0, 0.12);
}

.ydm-search-box button,
.ydm-filter-controls select {
    font: inherit;
}

.ydm-search-box button {
    min-width: 100px;
    padding: 13px 20px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.ydm-search-box button:hover,
.ydm-search-box button:focus {
    transform: translateY(-1px);
}

.ydm-search-box button#ydm-search-button {
    background: linear-gradient(180deg, #e10000 0%, #c40000 100%);
    color: #ffffff;
    box-shadow: 0 12px 24px rgba(215, 0, 0, 0.18);
}

.ydm-search-box button#ydm-search-button:hover,
.ydm-search-box button#ydm-search-button:focus {
    background: linear-gradient(180deg, #c90000 0%, #a90000 100%);
    box-shadow: 0 14px 28px rgba(184, 0, 0, 0.22);
}

.ydm-search-box button#ydm-clear-search {
    background: #f6f2ee;
    color: var(--ydm-text-secondary);
    border-color: rgba(90, 78, 67, 0.12);
}

.ydm-search-box button#ydm-clear-search:hover,
.ydm-search-box button#ydm-clear-search:focus {
    color: var(--ydm-text-primary);
    border-color: rgba(90, 78, 67, 0.22);
    background: #efebe6;
}

.ydm-filter-controls {
    display: flex;
    flex: 0 1 auto;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.ydm-filter-controls label {
    color: var(--ydm-text-tertiary);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.ydm-filter-controls select {
    min-width: 180px;
    padding: 13px 42px 13px 18px;
    border: 1px solid var(--ydm-outline);
    border-radius: 999px;
    background: #f6f2ee;
    color: var(--ydm-text-primary);
    appearance: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ydm-filter-controls select:focus {
    outline: none;
    border-color: rgba(215, 0, 0, 0.45);
    box-shadow: 0 0 0 4px rgba(215, 0, 0, 0.12);
}

.ydm-map-wrapper {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 290px;
    gap: 18px;
    align-items: stretch;
}

#ydm-dealer-map {
    min-height: var(--ydm-map-height, 560px);
    border: 1px solid rgba(56, 43, 31, 0.12);
    border-radius: 24px;
    overflow: hidden;
    background: #dbe0e4;
    box-shadow: 0 16px 36px rgba(56, 43, 31, 0.12);
}

.ydm-dealer-list {
    max-height: var(--ydm-map-height, 560px);
    padding: 18px;
    background: rgba(255, 253, 250, 0.88);
    border: 1px solid rgba(90, 78, 67, 0.1);
    border-radius: 24px;
    overflow-y: auto;
    box-shadow: 0 14px 28px rgba(56, 43, 31, 0.08);
}

.ydm-dealer-list h3 {
    margin: 0 0 16px;
    color: var(--ydm-text-primary);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

#ydm-dealer-list-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ydm-dealer-list-item {
    padding: 16px 16px 15px;
    background: rgba(246, 242, 238, 0.92);
    border: 1px solid transparent;
    border-radius: 20px;
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.ydm-dealer-list-item:hover,
.ydm-dealer-list-item:focus {
    transform: translateY(-2px);
    border-color: rgba(215, 0, 0, 0.22);
    background: #fffdfa;
    box-shadow: 0 12px 24px rgba(56, 43, 31, 0.08);
}

.ydm-dealer-list-item .dealer-name {
    margin-bottom: 8px;
    color: var(--ydm-text-primary);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.25;
}

.ydm-dealer-list-item .dealer-type-chip,
.ydm-dealer-popup .dealer-type {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border: 1px solid rgba(215, 0, 0, 0.18);
    background: rgba(215, 0, 0, 0.08);
    color: #7f1010;
}

.ydm-dealer-list-item .dealer-type-chip--service,
.ydm-dealer-popup .dealer-type--service {
    border-color: rgba(45, 121, 214, 0.2);
    background: rgba(45, 121, 214, 0.08);
    color: #1653a4;
}

.ydm-dealer-list-item .dealer-type-chip--both,
.ydm-dealer-popup .dealer-type--both {
    border-color: rgba(215, 0, 0, 0.2);
    background: rgba(215, 0, 0, 0.1);
    color: #901010;
}

.ydm-dealer-list-item .dealer-meta {
    margin-top: 10px;
    color: var(--ydm-text-secondary);
    font-size: 13px;
    line-height: 1.55;
}

.ydm-dealer-list-item .dealer-meta a {
    color: var(--ydm-primary);
    text-decoration: none;
    font-weight: 600;
}

.ydm-dealer-list-item .dealer-meta a:hover,
.ydm-dealer-list-item .dealer-meta a:focus {
    text-decoration: underline;
}

.leaflet-container {
    background: #dfe4e7;
    font: inherit;
}

.leaflet-control-zoom,
.leaflet-bar {
    border: 1px solid rgba(56, 43, 31, 0.14) !important;
    border-radius: 14px !important;
    overflow: hidden;
    box-shadow: 0 12px 24px rgba(56, 43, 31, 0.12) !important;
}

.leaflet-bar a,
.leaflet-bar a:hover {
    width: 38px !important;
    height: 38px !important;
    line-height: 38px !important;
    border-bottom: 1px solid rgba(56, 43, 31, 0.08) !important;
    background: rgba(255, 253, 250, 0.96) !important;
    color: var(--ydm-text-primary) !important;
}

.leaflet-bar a:last-child {
    border-bottom: 0 !important;
}

.leaflet-control-attribution {
    background: rgba(255, 253, 250, 0.64) !important;
    color: rgba(86, 78, 71, 0.72) !important;
    border-radius: 10px 0 0 0;
    padding: 2px 6px !important;
    font-size: 10px !important;
    line-height: 1.3 !important;
    letter-spacing: 0.01em;
    box-shadow: none !important;
    opacity: 0.72;
    transition: opacity 0.2s ease, background 0.2s ease;
}

.leaflet-control-attribution a {
    color: rgba(56, 43, 31, 0.82) !important;
}

.leaflet-control-attribution:hover {
    background: rgba(255, 253, 250, 0.86) !important;
    opacity: 1;
}

.leaflet-popup-content-wrapper {
    padding: 0 !important;
    background: linear-gradient(180deg, #fffdfa 0%, #f7f2ed 100%) !important;
    border: 1px solid rgba(56, 43, 31, 0.12) !important;
    border-radius: 22px !important;
    box-shadow: 0 22px 40px rgba(56, 43, 31, 0.16) !important;
}

.leaflet-popup-content {
    margin: 0 !important;
    min-width: 280px !important;
}

.leaflet-popup-tip {
    background: #f7f2ed !important;
    border: 1px solid rgba(56, 43, 31, 0.12);
}

.ydm-dealer-popup {
    padding: 22px;
    color: var(--ydm-text-secondary);
}

.ydm-dealer-popup h3 {
    margin: 0 0 10px;
    color: var(--ydm-text-primary);
    font-size: 22px;
    line-height: 1.2;
}

.ydm-dealer-popup .dealer-type {
    margin-bottom: 16px;
}

.ydm-dealer-popup p {
    margin: 10px 0;
    color: var(--ydm-text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

.ydm-dealer-popup .dealer-address {
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(56, 43, 31, 0.08);
}

.ydm-dealer-popup strong {
    display: inline;
    color: var(--ydm-text-tertiary);
    font-weight: 700;
    margin-right: 6px;
}

.ydm-dealer-popup a {
    color: var(--ydm-primary);
    text-decoration: none;
    font-weight: 600;
}

.ydm-dealer-popup a:hover,
.ydm-dealer-popup a:focus {
    text-decoration: underline;
}

.ydm-dealer-popup .dealer-website a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
    padding: 8px 14px;
    border: 1px solid rgba(215, 0, 0, 0.16);
    border-radius: 999px;
    background: rgba(215, 0, 0, 0.06);
    text-decoration: none;
}

.ydm-dealer-popup .dealer-website a:hover,
.ydm-dealer-popup .dealer-website a:focus {
    background: rgba(215, 0, 0, 0.1);
}

.ydm-dealer-popup .dealer-description {
    color: var(--ydm-text-tertiary);
}

.ydm-dealer-popup .dealer-directions {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(56, 43, 31, 0.08);
}

.ydm-dealer-popup .dealer-directions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 13px 18px;
    border-radius: 999px;
    background: linear-gradient(180deg, #dd0000 0%, #c00000 100%);
    color: #ffffff;
    text-decoration: none;
    box-shadow: 0 12px 24px rgba(215, 0, 0, 0.18);
}

.ydm-dealer-popup .dealer-directions a:hover,
.ydm-dealer-popup .dealer-directions a:focus {
    background: linear-gradient(180deg, #c70000 0%, #ac0000 100%);
    box-shadow: 0 14px 28px rgba(184, 0, 0, 0.22);
}

.ydm-custom-marker {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid #ffffff;
    border-radius: 50%;
    background: var(--ydm-primary);
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 10px 18px rgba(56, 43, 31, 0.22);
}

.ydm-custom-marker.service {
    background: var(--ydm-service);
}

.ydm-custom-marker.both {
    background: var(--ydm-primary);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.95), 0 12px 22px rgba(215, 0, 0, 0.18);
}

.ydm-loading {
    padding: 28px 18px;
    color: var(--ydm-text-tertiary);
    text-align: center;
}

.ydm-loading::after {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-left: 10px;
    border: 2px solid rgba(56, 43, 31, 0.14);
    border-top-color: var(--ydm-primary);
    border-radius: 50%;
    animation: ydm-spin 1s linear infinite;
    vertical-align: middle;
}

.ydm-map-legend {
    margin-top: 18px;
    padding: 18px 20px;
    background: rgba(255, 253, 250, 0.84);
    border: 1px solid rgba(90, 78, 67, 0.1);
    border-radius: 22px;
    box-shadow: 0 14px 28px rgba(56, 43, 31, 0.08);
}

.ydm-map-legend h4 {
    margin: 0 0 14px;
    color: var(--ydm-text-primary);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.ydm-legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 22px;
}

.ydm-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.ydm-legend-marker {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 6px 14px rgba(56, 43, 31, 0.16);
}

.ydm-legend-sales {
    background: var(--ydm-primary);
}

.ydm-legend-service {
    background: var(--ydm-service);
}

.ydm-legend-both {
    background: var(--ydm-primary);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.95), 0 6px 14px rgba(215, 0, 0, 0.18);
}

.ydm-legend-label {
    color: var(--ydm-text-secondary);
    font-size: 14px;
    font-weight: 600;
}

.ydm-dealer-list::-webkit-scrollbar {
    width: 10px;
}

.ydm-dealer-list::-webkit-scrollbar-track {
    background: rgba(90, 78, 67, 0.08);
    border-radius: 999px;
}

.ydm-dealer-list::-webkit-scrollbar-thumb {
    background: rgba(90, 78, 67, 0.26);
    border-radius: 999px;
}

.ydm-dealer-list::-webkit-scrollbar-thumb:hover {
    background: rgba(90, 78, 67, 0.4);
}

@keyframes ydm-spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@media (max-width: 960px) {
    .ydm-map-wrapper {
        grid-template-columns: 1fr;
    }

    .ydm-dealer-list {
        max-height: 320px;
    }
}

@media (max-width: 720px) {
    .ydm-dealer-map-container {
        margin: 24px 0;
        padding: 0;
        background: transparent;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .ydm-map-controls {
        padding: 14px;
        gap: 12px;
        border-radius: 20px;
    }

    .ydm-search-box {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        flex: 1 1 100%;
        gap: 10px;
    }

    .ydm-search-box input[type="text"] {
        grid-column: 1 / -1;
    }

    .ydm-search-box button {
        min-width: 0;
        width: 100%;
    }

    .ydm-filter-controls {
        display: grid;
        grid-template-columns: 1fr;
        flex: 1 1 100%;
        gap: 8px;
        margin-left: 0;
    }

    .ydm-filter-controls select {
        width: 100%;
        min-width: 0;
    }

    .ydm-map-wrapper {
        gap: 14px;
    }

    #ydm-dealer-map {
        min-height: 340px;
        border-radius: 20px;
    }

    .ydm-dealer-list {
        max-height: 260px;
        padding: 14px;
        border-radius: 20px;
    }

    .ydm-dealer-list-item {
        padding: 14px;
        border-radius: 18px;
    }

    .ydm-dealer-list-item .dealer-name {
        font-size: 16px;
    }

    .ydm-map-legend {
        padding: 14px 16px;
        border-radius: 20px;
    }

    .ydm-legend-items {
        gap: 12px;
    }

    .ydm-legend-item {
        width: 100%;
    }

    .leaflet-popup-content {
        min-width: 240px !important;
    }
}

@media (max-width: 480px) {
    #ydm-dealer-map {
        min-height: 300px;
    }

    .ydm-dealer-list {
        max-height: 220px;
        padding: 12px;
    }

    .ydm-map-controls,
    .ydm-dealer-list,
    .ydm-map-legend {
        box-shadow: 0 10px 20px rgba(56, 43, 31, 0.08);
    }

    .ydm-map-controls {
        padding: 12px;
    }

    .ydm-map-legend {
        padding: 12px 14px;
    }

    .leaflet-bar a,
    .leaflet-bar a:hover {
        width: 34px !important;
        height: 34px !important;
        line-height: 34px !important;
    }

    .leaflet-control-attribution {
        padding: 2px 4px !important;
        font-size: 9px !important;
    }
}
