/* ==========================================================================
   Podróżne Miejsca – Społeczność Podróżników & Interaktywna Mapa
   Stylesheet: community-map.css
   ========================================================================== */

/* Kontener główny - izolacja styli */
.pm-community-wrapper {
    --pm-primary: #0284c7;
    --pm-primary-dark: #0369a1;
    --pm-primary-light: #e0f2fe;
    --pm-accent: #f59e0b;
    --pm-success: #10b981;
    --pm-danger: #ef4444;
    --pm-purple: #8b5cf6;
    --pm-text-main: #0f172a;
    --pm-text-muted: #64748b;
    --pm-bg-card: #ffffff;
    --pm-bg-subtle: #f8fafc;
    --pm-border: #e2e8f0;
    --pm-radius: 12px;
    --pm-radius-sm: 8px;
    --pm-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --pm-shadow-md: 0 4px 14px rgba(0, 0, 0, 0.08);
    --pm-shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.1);

    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    color: var(--pm-text-main);
    line-height: 1.5;
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
    box-sizing: border-box;
}

.pm-community-wrapper * {
    box-sizing: border-box;
}

/* ==========================================================================
   1. Nagłówek i Karty Statystyk
   ========================================================================== */
.pm-header-card {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 50%, #075985 100%);
    color: #ffffff;
    padding: 2.25rem 2rem;
    border-radius: var(--pm-radius);
    box-shadow: var(--pm-shadow-lg);
    text-align: center;
    position: relative;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.pm-header-card::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.08) 0%, transparent 60%);
    pointer-events: none;
}

.pm-header-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #ffffff;
    font-size: 0.825rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.35rem 1rem;
    border-radius: 9999px;
    margin-bottom: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.pm-header-title {
    font-size: 2rem;
    font-weight: 800;
    color: #ffffff !important;
    margin: 0 0 0.5rem 0;
    line-height: 1.25;
}

.pm-header-desc {
    font-size: 1.05rem;
    color: rgba(255, 255, 255, 0.9);
    max-width: 720px;
    margin: 0 auto 1.75rem auto;
}

.pm-stats-row {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.pm-stat-item {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-radius: var(--pm-radius-sm);
    padding: 0.75rem 1.5rem;
    min-width: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.2s ease, background 0.2s ease;
}

.pm-stat-item:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.18);
}

.pm-stat-num {
    font-size: 1.75rem;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.1;
}

.pm-stat-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.85);
    margin-top: 0.25rem;
    font-weight: 600;
}

/* ==========================================================================
   2. Pasek Nawigacji (Zakładki)
   ========================================================================== */
.pm-tabs-bar {
    display: flex;
    gap: 0.5rem;
    background: #ffffff;
    padding: 0.5rem;
    border-radius: var(--pm-radius);
    border: 1px solid var(--pm-border);
    box-shadow: var(--pm-shadow-sm);
    margin-bottom: 1.5rem;
    overflow-x: auto;
}

.pm-tab-btn {
    flex: 1;
    min-width: 160px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 1.25rem;
    border: none;
    background: transparent;
    border-radius: var(--pm-radius-sm);
    font-size: 0.95rem;
    color: var(--pm-text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.pm-tab-btn span {
    font-size: 1.15rem;
}

.pm-tab-btn:hover {
    color: var(--pm-primary);
    background: var(--pm-bg-subtle);
}

.pm-tab-btn.active {
    background: var(--pm-primary);
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(2, 132, 199, 0.3);
}

.pm-tab-btn.active strong {
    color: #ffffff;
}

.pm-tab-content {
    display: none;
    animation: pmFadeIn 0.3s ease-in-out;
}

.pm-tab-content.active {
    display: block;
}

@keyframes pmFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   3. Filtry Mapy & Kontener Mapy
   ========================================================================== */
.pm-map-filters {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    background: #ffffff;
    padding: 0.75rem 1.25rem;
    border-radius: var(--pm-radius);
    border: 1px solid var(--pm-border);
    box-shadow: var(--pm-shadow-sm);
}

.pm-filter-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--pm-text-muted);
    margin-right: 0.5rem;
}

.pm-pill-btn {
    border: 1px solid var(--pm-border);
    background: #ffffff;
    color: var(--pm-text-muted);
    padding: 0.45rem 0.9rem;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pm-pill-btn:hover {
    border-color: var(--pm-primary);
    color: var(--pm-primary);
    background: var(--pm-primary-light);
}

.pm-pill-btn.active {
    background: var(--pm-primary);
    border-color: var(--pm-primary);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
}

.pm-map-container {
    height: 560px;
    width: 100%;
    border-radius: var(--pm-radius);
    border: 1px solid var(--pm-border);
    box-shadow: var(--pm-shadow-md);
    position: relative;
    overflow: hidden;
    background: #e2e8f0;
    z-index: 1;
}

.pm-map-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 600;
    color: var(--pm-text-muted);
    background: rgba(255, 255, 255, 0.9);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    box-shadow: var(--pm-shadow-sm);
}

.pm-map-tip-note {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--pm-text-muted);
    text-align: center;
}

/* ==========================================================================
   4. Niestandardowe Pinezki Leaflet (SVG DivIcon)
   ========================================================================== */
.pm-custom-pin {
    width: 36px;
    height: 44px;
    cursor: pointer;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.25));
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pm-custom-pin:hover {
    transform: scale(1.18) translateY(-4px);
    z-index: 9999 !important;
}

.pm-pin-svg {
    width: 100%;
    height: 100%;
}

/* Typy pinezek */
.pm-pin-hidden_gem .pm-pin-body { fill: #8b5cf6; }
.pm-pin-food .pm-pin-body { fill: #f97316; }
.pm-pin-warning .pm-pin-body { fill: #ef4444; }
.pm-pin-photo_spot .pm-pin-body { fill: #0284c7; }

/* Klastry MarkerCluster - Custom look */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
    background-color: rgba(2, 132, 199, 0.25) !important;
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
    background-color: #0284c7 !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    font-family: inherit !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
}

/* ==========================================================================
   5. Popup Mapy (Estetyczna Karta Polecajki)
   ========================================================================== */
.pm-popup-card {
    min-width: 250px;
    max-width: 310px;
    font-family: inherit;
    padding: 0.25rem 0;
}

.leaflet-popup-content-wrapper {
    border-radius: var(--pm-radius) !important;
    box-shadow: var(--pm-shadow-lg) !important;
    padding: 0.75rem 1rem !important;
    border: 1px solid var(--pm-border);
}

.leaflet-popup-tip {
    box-shadow: var(--pm-shadow-md) !important;
}

.pm-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.pm-badge-type {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.725rem;
    font-weight: 700;
}

.pm-badge-type.hidden_gem { background: #f5f3ff; color: #7c3aed; }
.pm-badge-type.food { background: #fff7ed; color: #ea580c; }
.pm-badge-type.warning { background: #fef2f2; color: #dc2626; }
.pm-badge-type.photo_spot { background: #f0f9ff; color: #0284c7; }

.pm-popup-country {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--pm-text-muted);
}

.pm-popup-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--pm-text-main);
    margin: 0.25rem 0 0.5rem 0;
    line-height: 1.3;
}

.pm-popup-body {
    font-size: 0.875rem;
    color: #334155;
    background: var(--pm-bg-subtle);
    padding: 0.6rem 0.75rem;
    border-radius: var(--pm-radius-sm);
    border-left: 3px solid var(--pm-primary);
    margin: 0.5rem 0;
    max-height: 150px;
    overflow-y: auto;
    line-height: 1.45;
}

.pm-popup-body p {
    margin: 0 0 0.5rem 0;
}
.pm-popup-body p:last-child {
    margin-bottom: 0;
}

.pm-popup-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--pm-text-muted);
    border-top: 1px solid var(--pm-border);
    padding-top: 0.5rem;
    margin-top: 0.5rem;
}

.pm-popup-author strong {
    color: var(--pm-text-main);
}

.pm-popup-ig {
    color: #d946ef;
    text-decoration: none;
    font-weight: 600;
}
.pm-popup-ig:hover {
    text-decoration: underline;
}

.pm-popup-actions {
    margin-top: 0.75rem;
}

.pm-upvote-btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.45rem 0.75rem;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    border-radius: var(--pm-radius-sm);
    font-size: 0.8rem;
    font-weight: 700;
    color: #334155;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pm-upvote-btn:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #0f172a;
}

.pm-upvote-btn.pm-voted {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #059669;
    cursor: default;
}

/* ==========================================================================
   6. Formularz Dodawania Rekomendacji
   ========================================================================== */
.pm-form-card {
    background: var(--pm-bg-card);
    border-radius: var(--pm-radius);
    border: 1px solid var(--pm-border);
    box-shadow: var(--pm-shadow-md);
    padding: 2.25rem 2.5rem;
}

.pm-form-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--pm-text-main);
    margin: 0 0 0.5rem 0;
}

.pm-form-subtitle {
    font-size: 0.95rem;
    color: var(--pm-text-muted);
    margin: 0 0 1.75rem 0;
    line-height: 1.5;
}

.pm-form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

.pm-form-group {
    display: flex;
    flex-direction: column;
}

.pm-form-group label {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--pm-text-main);
    margin-bottom: 0.4rem;
}

.pm-hint {
    font-weight: 400;
    color: var(--pm-text-muted);
    font-size: 0.8rem;
}

.pm-form-group input[type="text"],
.pm-form-group input[type="email"],
.pm-form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--pm-border);
    border-radius: var(--pm-radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    background: #ffffff;
    color: var(--pm-text-main);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.pm-form-group input:focus,
.pm-form-group textarea:focus {
    outline: none;
    border-color: var(--pm-primary);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

/* Wybór kategorii (Radio Pills) */
.pm-type-selector {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.pm-type-radio {
    cursor: pointer;
    position: relative;
    user-select: none;
}

.pm-type-radio input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.pm-type-radio span {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 0.5rem;
    background: var(--pm-bg-subtle);
    border: 1.5px solid var(--pm-border);
    border-radius: var(--pm-radius-sm);
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--pm-text-muted);
    transition: all 0.2s ease;
    text-align: center;
}

.pm-type-radio:hover span {
    border-color: #cbd5e1;
    background: #f1f5f9;
}

.pm-type-radio input:checked + span {
    border-color: var(--pm-primary);
    background: var(--pm-primary-light);
    color: var(--pm-primary-dark);
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.15);
}

/* Mini Picker Map */
.pm-picker-map-container {
    height: 280px;
    width: 100%;
    border-radius: var(--pm-radius-sm);
    border: 1.5px solid var(--pm-border);
    background: #e2e8f0;
    position: relative;
    overflow: hidden;
    cursor: crosshair;
}

.pm-coords-display {
    display: flex;
    justify-content: space-between;
    background: var(--pm-bg-subtle);
    padding: 0.6rem 1rem;
    border-radius: var(--pm-radius-sm);
    border: 1px solid var(--pm-border);
    font-size: 0.825rem;
    color: var(--pm-text-muted);
    margin-top: 0.5rem;
}

.pm-coords-display strong {
    color: var(--pm-primary-dark);
    font-family: monospace;
}

/* Checkbox RODO */
.pm-consent-box {
    margin-top: 1.25rem;
    padding: 1rem;
    background: var(--pm-bg-subtle);
    border-radius: var(--pm-radius-sm);
    border: 1px solid var(--pm-border);
}

.pm-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    font-size: 0.825rem;
    color: var(--pm-text-muted);
    cursor: pointer;
    line-height: 1.45;
}

.pm-checkbox-label input[type="checkbox"] {
    margin-top: 0.15rem;
    width: 18px;
    height: 18px;
    accent-color: var(--pm-primary);
    cursor: pointer;
}

/* Przycisk wysyłki */
.pm-form-actions {
    margin-top: 1.5rem;
}

.pm-btn-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.95rem 1.5rem;
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff;
    border: none;
    border-radius: var(--pm-radius-sm);
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
}

.pm-btn-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(2, 132, 199, 0.45);
}

.pm-btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Feedback alert box */
.pm-form-feedback {
    margin-top: 1.25rem;
    padding: 1rem 1.25rem;
    border-radius: var(--pm-radius-sm);
    font-size: 0.95rem;
    line-height: 1.45;
}

.pm-feedback-success {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.pm-feedback-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

/* ==========================================================================
   7. Ranking Odkrywców
   ========================================================================== */
.pm-ranking-card {
    background: var(--pm-bg-card);
    border-radius: var(--pm-radius);
    border: 1px solid var(--pm-border);
    box-shadow: var(--pm-shadow-md);
    padding: 2.25rem 2rem;
}

.pm-ranking-header {
    margin-bottom: 1.5rem;
}

.pm-ranking-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--pm-text-main);
    margin: 0 0 0.4rem 0;
}

.pm-ranking-sub {
    font-size: 0.925rem;
    color: var(--pm-text-muted);
    margin: 0;
}

.pm-table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.pm-ranking-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.95rem;
}

.pm-ranking-table th {
    background: var(--pm-bg-subtle);
    color: var(--pm-text-muted);
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.85rem 1rem;
    border-bottom: 2px solid var(--pm-border);
    white-space: nowrap;
}

.pm-ranking-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--pm-border);
    vertical-align: middle;
}

.pm-ranking-table tr:hover td {
    background: #f8fafc;
}

.pm-top-leader td {
    background: #fafafa;
}

.pm-rank-badge {
    font-size: 1.25rem;
    text-align: center;
}

.pm-author-cell strong {
    color: var(--pm-text-main);
    display: block;
}

.pm-ig-link {
    font-size: 0.8rem;
    color: #d946ef;
    text-decoration: none;
    font-weight: 600;
}

.pm-ig-link:hover {
    text-decoration: underline;
}

.pm-pill-stat {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    background: var(--pm-bg-subtle);
    border: 1px solid var(--pm-border);
    border-radius: 9999px;
    font-size: 0.825rem;
    font-weight: 600;
    color: #334155;
    white-space: nowrap;
}

.pm-vote-stat {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #047857;
}

.pm-score-total {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--pm-primary-dark);
}

/* ==========================================================================
   8. Responsywność (Mobile & Tablet)
   ========================================================================== */
@media (max-width: 768px) {
    .pm-header-card {
        padding: 1.75rem 1.25rem;
    }

    .pm-header-title {
        font-size: 1.5rem;
    }

    .pm-header-desc {
        font-size: 0.95rem;
    }

    .pm-stats-row {
        gap: 0.75rem;
    }

    .pm-stat-item {
        padding: 0.6rem 1rem;
        min-width: 95px;
    }

    .pm-stat-num {
        font-size: 1.4rem;
    }

    .pm-tabs-bar {
        padding: 0.35rem;
        gap: 0.35rem;
    }

    .pm-tab-btn {
        padding: 0.65rem 0.85rem;
        font-size: 0.85rem;
        min-width: 120px;
    }

    .pm-map-container {
        height: 420px;
    }

    .pm-form-card {
        padding: 1.5rem 1.25rem;
    }

    .pm-form-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .pm-type-selector {
        grid-template-columns: repeat(2, 1fr);
    }

    .pm-ranking-card {
        padding: 1.5rem 1rem;
    }
}
