/* ==========================================================================
   Truckstop Fuel Map – Plugin Styles
   All class names are prefixed with "fuel-map-" to avoid collisions with
   the active WordPress theme.
   ========================================================================== */

.fuel-map-widget {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.12);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.fuel-map-app {
    display: flex;
    height: 100%;
    overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */

.fuel-map-sidebar {
    width: 380px;
    flex-shrink: 0;
    background: #fff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.08);
    z-index: 10;
}

.fuel-map-sidebar-header {
    padding: 16px 20px 12px;
    border-bottom: 1px solid #f0f0f0;
}

.fuel-map-sidebar-logo {
    height: 32px;
    width: auto;
    display: block;
}

/* Search bar */
.fuel-map-search-bar {
    display: flex;
    align-items: center;
    margin: 8px 16px;
    border: 1.5px solid #e0e0e0;
    border-radius: 10px;
    padding: 8px 12px;
    gap: 8px;
    background: #fff;
}

.fuel-map-search-icon {
    color: #888;
    font-size: 16px;
    flex-shrink: 0;
}

#fuel-map-location-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    color: #333;
    background: transparent;
    font-family: inherit;
}

/* Results header */
.fuel-map-results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    border-top: 1px solid #f0f0f0;
    border-bottom: 1px solid #f0f0f0;
}

.fuel-map-results-meta {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.fuel-map-results-label {
    font-size: 13px;
    font-weight: 700;
    color: #1a1a1a;
}

.fuel-map-results-count {
    font-size: 12px;
    color: #888;
}

.fuel-map-sort-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #f5f5f5;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    font-family: inherit;
}

.fuel-map-sort-btn:hover { background: #ebebeb; }

/* Results list */
.fuel-map-results-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.fuel-map-results-list::-webkit-scrollbar { width: 4px; }
.fuel-map-results-list::-webkit-scrollbar-track { background: transparent; }
.fuel-map-results-list::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }

.fuel-map-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #aaa;
    text-align: center;
    gap: 12px;
}

.fuel-map-empty-icon { font-size: 36px; }
.fuel-map-empty-state p { font-size: 14px; line-height: 1.5; margin: 0; }

/* Station card */
.fuel-map-station-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
    transition: background 0.12s;
    border-bottom: 1px solid #f5f5f5;
}

.fuel-map-station-card:hover { background: #fafafa; }
.fuel-map-station-card.active {
    background: #f5f5f5;
    border-left: 3px solid #c62828;
}

.fuel-map-station-logo {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #f0f0f0;
    flex-shrink: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.fuel-map-station-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.fuel-map-station-info {
    flex: 1;
    min-width: 0;
}

.fuel-map-station-name-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.fuel-map-station-name {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fuel-map-discount-tag {
    flex-shrink: 0;
    background: #fdecea;
    color: #c62828;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.4px;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #f5c6c6;
}

.fuel-map-station-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
    font-size: 12px;
    color: #888;
}

/* Fuel rows */
.fuel-map-fuel-rows {
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.fuel-map-fuel-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.fuel-map-fuel-grade-label {
    color: #888;
    min-width: 52px;
}

.fuel-map-fuel-price-val {
    font-weight: 700;
    color: #1a1a1a;
    min-width: 40px;
}

.fuel-map-fuel-discount-badge {
    background: #fdecea;
    color: #c62828;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
    border: 1px solid #f5c6c6;
}

.fuel-map-fuel-no-discount {
    color: #ccc;
    font-size: 11px;
}

/* Loading */
.fuel-map-loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100px;
    gap: 10px;
    color: #888;
    font-size: 14px;
}

/* ── Map panel ───────────────────────────────────────────────────────────── */

.fuel-map-map-container {
    flex: 1;
    position: relative;
}

#fuel-map-map {
    width: 100%;
    height: 100%;
}

/* "Search this area" button */
.fuel-map-search-area-btn {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: #fff;
    color: #1a1a1a;
    border: 1.5px solid #e0e0e0;
    border-radius: 24px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    white-space: nowrap;
    transition: box-shadow 0.15s, background 0.15s;
    font-family: inherit;
}

.fuel-map-search-area-btn:hover {
    background: #f5f5f5;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

/* Map loading overlay */
.fuel-map-loading {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 24px;
    padding: 10px 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
}

.fuel-map-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e0e0e0;
    border-top-color: #1a1a1a;
    border-radius: 50%;
    animation: fuel-map-spin 0.7s linear infinite;
}

@keyframes fuel-map-spin { to { transform: rotate(360deg); } }

/* ── Leaflet marker overrides ────────────────────────────────────────────── */

.fuel-map-ts-marker-wrapper {
    background: none !important;
    border: none !important;
}

.fuel-map-ts-marker {
    color: #fff;
    border-radius: 24px;
    padding: 5px 10px 5px 5px;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.9);
    position: relative;
    transition: transform 0.15s, background 0.15s;
    user-select: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.fuel-map-ts-marker::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
}

.fuel-map-marker-icon {
    width: 22px;
    height: 22px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.fuel-map-marker-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Discount marker – red */
.fuel-map-ts-marker.discount { background: #c62828; }
.fuel-map-ts-marker.discount::after { border-top-color: #c62828; }
.fuel-map-ts-marker.discount .fuel-map-marker-icon span { font-size: 11px; font-weight: 700; color: #c62828; }
.fuel-map-ts-marker.discount:hover { background: #b71c1c; transform: scale(1.08); }
.fuel-map-ts-marker.discount.highlighted {
    background: #8b0000;
    transform: scale(1.12);
    z-index: 1000 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}

/* No-discount marker – grey */
.fuel-map-ts-marker.no-discount { background: #aaa; }
.fuel-map-ts-marker.no-discount::after { border-top-color: #aaa; }
.fuel-map-ts-marker.no-discount .fuel-map-marker-icon span { font-size: 11px; font-weight: 700; color: #aaa; }
.fuel-map-ts-marker.no-discount:hover { background: #888; transform: scale(1.08); }
.fuel-map-ts-marker.no-discount.highlighted {
    background: #666;
    transform: scale(1.12);
    z-index: 1000 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media ( max-width: 640px ) {
    .fuel-map-sidebar {
        width: 100%;
        max-height: 40%;
    }

    .fuel-map-app {
        flex-direction: column;
    }
}
