/**
 * Interactive Map Pins — Frontend Styles
 * Handles layout, pin styling, city list, and hover animations.
 */

/* Wrapper */
.imp-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    font-family: verdana, Arial, "Segoe UI", Roboto, sans-serif;
}

.imp-title {
    font-size: 3rem;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 8px;
}

.imp-subtitle {
    font-size: 2rem;
    color: #555;
    margin: 0 0 32px;
}

/* Layout: map left, city list right */
.imp-layout {
    display: flex;
    gap: 40px;
    align-items: flex-start;
}

@media (max-width: 768px) {
    .imp-layout {
        flex-direction: column;
        gap: 24px;
    }
}

/* Map section */
.imp-map-section {
    flex: 1;
    min-width: 0;
}

.imp-map-container {
    position: relative;
    display: inline-block;
    width: 100%;
}

.imp-map-image {
    display: block;
    width: 100%;
    height: auto;
    user-select: none;
    -webkit-user-drag: none;
}

/* Pins overlay */
.imp-pins {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Individual pin */
.imp-pin {
    position: absolute;
    transform: translate(-50%, -100%);
    pointer-events: auto;
    cursor: pointer;
    z-index: 10;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                filter 0.3s ease;
}

.imp-pin-icon {
    width: 28px;
    height: 42px;
    color: #e8a317;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    transition: color 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Pin hover state */
.imp-pin:hover,
.imp-pin.imp-active {
    transform: translate(-50%, -100%) scale(1.3);
    z-index: 20;
}

.imp-pin:hover .imp-pin-icon,
.imp-pin.imp-active .imp-pin-icon {
    color: #ff6b35;
}

/* Pin bounce animation */
.imp-pin.imp-active {
    animation: imp-bounce 0.6s ease infinite alternate;
}

@keyframes imp-bounce {
    0% {
        transform: translate(-50%, -100%) scale(1.3) translateY(0);
    }
    100% {
        transform: translate(-50%, -100%) scale(1.3) translateY(-8px);
    }
}

/* Pin pulse ring */
.imp-pin.imp-active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(232, 163, 23, 0.3);
    transform: translate(-50%, 50%);
    animation: imp-pulse 1.2s ease-in-out infinite;
}

@keyframes imp-pulse {
    0% {
        transform: translate(-50%, 50%) scale(0.8);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, 50%) scale(2.5);
        opacity: 0;
    }
}

/* Pin tooltip */
.imp-pin-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) scale(0.8);
    background: #1a1a2e;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.imp-pin-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #1a1a2e;
}

.imp-pin:hover .imp-pin-tooltip,
.imp-pin.imp-active .imp-pin-tooltip {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

/* City list */
.imp-city-list {
    display: grid;
    gap: 12px;
    flex-shrink: 0;
    width: 320px;
}

.imp-wrapper[data-columns="1"] .imp-city-list {
    grid-template-columns: 1fr;
}

.imp-wrapper[data-columns="2"] .imp-city-list {
    grid-template-columns: 1fr 1fr;
}

.imp-wrapper[data-columns="3"] .imp-city-list {
    grid-template-columns: 1fr 1fr 1fr;
}

@media (max-width: 768px) {
    .imp-city-list {
        width: 100%;
        grid-template-columns: 1fr 1fr !important;
    }
}

@media (max-width: 480px) {
    .imp-city-list {
        grid-template-columns: 1fr !important;
    }
}

/* City item */
.imp-city-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    text-decoration: none;
    color: #1a1a2e;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s ease,
                border-color 0.3s ease,
                transform 0.2s ease,
                box-shadow 0.3s ease;
}

.imp-city-item:hover,
.imp-city-item.imp-active {
    background: #f0f7ff;
    border-color: #3b82f6;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.15);
}

.imp-city-icon {
    width: 18px;
    height: 27px;
    color: #3b82f6;
    flex-shrink: 0;
    transition: color 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.imp-city-item:hover .imp-city-icon,
.imp-city-item.imp-active .imp-city-icon {
    color: #ff6b35;
    transform: scale(1.2);
}

.imp-city-name {
    flex: 1;
}

/* ============================================
   Dealers Table Section
   ============================================ */

.imp-dealers-section {
    margin-top: 32px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
    animation: imp-slideDown 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes imp-slideDown {
    0% {
        opacity: 0;
        transform: translateY(-16px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.imp-dealers-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.imp-dealers-title {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    color: #1a1a2e;
}

.imp-dealers-count {
    font-weight: 400;
    font-size: 13px;
    color: #666;
    margin-left: 8px;
}

.imp-dealers-close {
    background: none;
    border: none;
    font-size: 13px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.2s ease, color 0.2s ease;
}

.imp-dealers-close:hover {
    background: #f1f1f1;
    color: #333;
}

/* Table */
.imp-dealers-section .imp-dealers-table-wrap {
    overflow-x: auto;
}

.imp-dealers-section .imp-dealers-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px !important;
}

.imp-dealers-section .imp-dealers-table thead {
    background: #2563eb;
    color: #fff;
}

.imp-dealers-section .imp-dealers-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.imp-dealers-section .imp-dealers-table th:first-child {
    border-radius: 8px 0 0 8px;
}

.imp-dealers-section .imp-dealers-table th:last-child {
    border-radius: 0 8px 8px 0;
}

.imp-dealers-section .imp-dealers-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    color: #333;
}

.imp-dealers-section .imp-dealers-table tbody tr:nth-child(even) {
    background: #f8fafd;
}

.imp-dealers-section .imp-dealers-table tbody tr:hover {
    background: #eef4ff;
}

/* Loading & empty states */
.imp-dealers-loading {
    text-align: center;
    padding: 24px;
    color: #888;
    font-size: 13px;
}

.imp-dealers-empty {
    text-align: center;
    padding: 24px;
    color: #999;
    font-size: 13px;
}

/* Responsive: stack on mobile */
@media (max-width: 640px) {
    .imp-dealers-section .imp-dealers-table thead {
        display: none;
    }

    .imp-dealers-section .imp-dealers-table tbody tr {
        display: block;
        margin-bottom: 12px;
        padding: 12px;
        background: #f8fafd;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
    }

    .imp-dealers-section .imp-dealers-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 6px 0;
        border-bottom: 1px solid #eee;
    }

    .imp-dealers-section .imp-dealers-table td:last-child {
        border-bottom: none;
    }

    .imp-dealers-section .imp-dealers-table td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.75rem;
        text-transform: uppercase;
        color: #888;
        margin-right: 12px;
    }
}