/* ============================================================
   Agreno Map Search v2 — style
   ============================================================ */

#agreno-map-search-wrap {
    margin: 32px 0 40px;
    font-family: inherit;
}

/* ── Zakładki trybów ──────────────────────────────────────── */
.agreno-mode-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.agreno-mode-tab {
    padding: 9px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 24px;
    background: #fff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #555;
    transition: all .2s;
    white-space: nowrap;
}
.agreno-mode-tab:hover:not(.active) {
    border-color: #4caf50;
    color: #4caf50;
}
.agreno-mode-tab.active {
    background: #4caf50;
    border-color: #4caf50;
    color: #fff;
}

/* ── Pasek wyszukiwania ───────────────────────────────────── */
.agreno-map-search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
    align-items: flex-end;
}

/* ── Pole wyszukiwania (produkt) ──────────────────────────── */
.agreno-search-input-wrap {
    flex: 1;
    min-width: 220px;
    position: relative;
    display: flex;
    align-items: center;
}

.agreno-search-icon {
    position: absolute;
    left: 12px;
    width: 17px;
    height: 17px;
    color: #888;
    pointer-events: none;
    flex-shrink: 0;
}

#agreno-search-input {
    width: 100%;
    padding: 12px 36px 12px 38px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    outline: none;
    transition: border-color .2s;
    box-sizing: border-box;
    background: #fff;
    color: #333;
}
#agreno-search-input:focus { border-color: #4caf50; }

.agreno-clear-btn {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
    font-size: 16px;
    padding: 4px;
    line-height: 1;
}
.agreno-clear-btn:hover { color: #333; }

#agreno-search-btn,
#agreno-nearby-btn,
#agreno-route-btn {
    padding: 12px 22px;
    background: #4caf50;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background .2s;
    flex-shrink: 0;
}
#agreno-search-btn:hover,
#agreno-nearby-btn:hover,
#agreno-route-btn:hover  { background: #43a047; }
#agreno-search-btn:disabled { background: #a5d6a7; cursor: default; }

/* ── Autocomplete (okolica / trasa) ───────────────────────── */
.agreno-autocomplete-wrap {
    position: relative;
    flex: 1;
    min-width: 180px;
}
.agreno-autocomplete-wrap input[type="text"] {
    width: 100%;
    padding: 12px 12px 12px 38px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    outline: none;
    box-sizing: border-box;
    background: #fff;
    color: #333;
    transition: border-color .2s;
}
.agreno-autocomplete-wrap input[type="text"]:focus { border-color: #4caf50; }
.agreno-autocomplete-wrap input[type="text"]::placeholder { color: #999; }

.agreno-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0,0,0,.12);
    z-index: 2000;
    display: none;
    max-height: 220px;
    overflow-y: auto;
}
.agreno-suggestion-item {
    padding: 9px 14px;
    font-size: 13px;
    cursor: pointer;
    border-bottom: 1px solid #f5f5f5;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #333;
}
.agreno-suggestion-item:last-child { border-bottom: none; }
.agreno-suggestion-item:hover { background: #e8f5e9; color: #2e7d32; }

/* ── Suwak promienia ──────────────────────────────────────── */
.agreno-radius-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 160px;
}
.agreno-radius-wrap label {
    font-size: 13px;
    color: #555;
    white-space: nowrap;
}
.agreno-radius-wrap input[type="range"] {
    accent-color: #4caf50;
    width: 100%;
    cursor: pointer;
}

/* ── Trasa — strzałka i markery A/B ───────────────────────── */
.agreno-route-bar { flex-wrap: wrap; gap: 8px; }
.agreno-route-arrow {
    font-size: 20px;
    color: #aaa;
    display: flex;
    align-items: center;
    padding-bottom: 2px;
    flex-shrink: 0;
}
.agreno-route-dot {
    width: 24px; height: 24px;
    border-radius: 50%;
    color: #fff;
    font-weight: 700;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,.3);
}

/* ── Split layout: mapa + lista ───────────────────────────── */
.agreno-map-results {
    display: flex;
    gap: 0;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    height: 540px;
    background: #fff;
}

#agreno-map-container {
    flex: 1 1 60%;
    position: relative;
    min-width: 0;
}

#agreno-map {
    width: 100%;
    height: 100%;
    background: #f0f0f0;
}

.agreno-map-status {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,.65);
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    pointer-events: none;
    opacity: 0;
    transition: opacity .3s;
    white-space: nowrap;
    z-index: 1000;
}
.agreno-map-status.visible { opacity: 1; }

/* ── Panel listy ──────────────────────────────────────────── */
#agreno-listings-panel {
    width: 320px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-left: 1px solid #e0e0e0;
    background: #fafafa;
    overflow: hidden;
}
#agreno-listings-header {
    padding: 12px 14px;
    font-size: 13px;
    color: #555;
    border-bottom: 1px solid #e8e8e8;
    background: #fff;
    font-weight: 500;
    flex-shrink: 0;
}
#agreno-listings-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

/* ── Karta ogłoszenia ─────────────────────────────────────── */
.agreno-listing-card {
    display: flex;
    gap: 10px;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background .15s;
    margin-bottom: 4px;
    border: 1px solid transparent;
    text-decoration: none;
    color: inherit;
}
.agreno-listing-card:hover,
.agreno-listing-card.active {
    background: #e8f5e9;
    border-color: #c8e6c9;
}
.agreno-listing-thumb {
    width: 60px; height: 60px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    background: #e0e0e0;
}
.agreno-listing-thumb-placeholder {
    width: 60px; height: 60px;
    border-radius: 6px;
    background: #e8f5e9;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}
.agreno-listing-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.agreno-listing-title {
    font-size: 13px;
    font-weight: 600;
    color: #1a1a1a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.agreno-listing-cat   { font-size: 11px; color: #4caf50; font-weight: 500; }
.agreno-listing-price { font-size: 13px; font-weight: 700; color: #2e7d32; margin-top: 2px; }
.agreno-listing-loc   { font-size: 11px; color: #888; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agreno-listing-dist  { font-size: 11px; color: #4caf50; font-weight: 500; }
.agreno-dist-route    { color: #f57c00 !important; }

/* ── Popup ────────────────────────────────────────────────── */
.agreno-popup       { font-family: inherit; min-width: 180px; max-width: 240px; }
.agreno-popup-title { font-size: 13px; font-weight: 700; margin-bottom: 4px; color: #1a1a1a; line-height: 1.3; }
.agreno-popup-cat   { font-size: 11px; color: #4caf50; margin-bottom: 4px; }
.agreno-popup-price { font-size: 14px; font-weight: 700; color: #2e7d32; margin-bottom: 6px; }
.agreno-popup-loc   { font-size: 11px; color: #888; margin-bottom: 6px; }
.agreno-popup-extra { font-size: 11px; color: #888; margin-bottom: 6px; }
.agreno-popup-link  {
    display: inline-block;
    padding: 5px 14px;
    background: #4caf50;
    color: #fff !important;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
}
.agreno-popup-link:hover { background: #43a047; }

/* ── Paginacja ────────────────────────────────────────────── */
#agreno-listings-pagination {
    padding: 8px;
    display: flex;
    gap: 6px;
    justify-content: center;
    border-top: 1px solid #e8e8e8;
    flex-wrap: wrap;
    flex-shrink: 0;
    background: #fff;
}
.agreno-page-btn {
    padding: 5px 11px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    transition: all .15s;
}
.agreno-page-btn:hover { background: #e8f5e9; border-color: #4caf50; }
.agreno-page-btn.active { background: #4caf50; color: #fff; border-color: #4caf50; }

/* ── Stany ──────────────────────────────────────────────────  */
.agreno-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #aaa;
}
.agreno-empty-icon { font-size: 40px; margin-bottom: 10px; }
.agreno-empty-state p { font-size: 13px; margin: 0; }

.agreno-loader  { display: flex; align-items: center; justify-content: center; padding: 40px; }
.agreno-spinner {
    width: 28px; height: 28px;
    border: 3px solid #e0e0e0;
    border-top-color: #4caf50;
    border-radius: 50%;
    animation: agreno-spin .7s linear infinite;
}
@keyframes agreno-spin { to { transform: rotate(360deg); } }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 680px) {
    .agreno-map-results  { flex-direction: column; height: auto; }
    #agreno-map-container { height: 300px; flex: none; }
    #agreno-listings-panel { width: 100%; border-left: none; border-top: 1px solid #e0e0e0; max-height: 360px; }
    .agreno-mode-tab { font-size: 13px; padding: 7px 14px; }
    .agreno-route-arrow { display: none; }
}
