/* Planer podróży v4 - Kompaktowy header + responsive */

.pp-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
}

/* NOWY: Kompaktowy header */
.pp-header {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #2c5530 0%, #3a6d3e 100%);
    color: white;
    border-radius: 8px;
}

.pp-header h1 {
    margin: 0;
    font-size: 1.2rem;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* NOWY: Przycisk instrukcji */
.pp-help-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.5);
    color: white;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
}

.pp-help-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.8);
}

/* NOWY: Tooltip z instrukcjami */
.pp-instructions-tooltip {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border: 3px solid #2c5530;
    border-radius: 12px;
    padding: 25px;
    max-width: 500px;
    z-index: 10000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: none;
}

.pp-instructions-tooltip.active {
    display: block;
}

.pp-instructions-tooltip h3 {
    margin: 0 0 15px 0;
    color: #2c5530;
    font-size: 1.3rem;
}

.pp-instructions-tooltip p {
    margin: 0 0 10px 0;
    color: #666;
    line-height: 1.6;
    font-size: 0.95rem;
}

.pp-instructions-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #dc3545;
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    transition: background 0.2s;
}

.pp-instructions-close:hover {
    background: #c82333;
}

/* Overlay dla tooltipa */
.pp-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: none;
}

.pp-overlay.active {
    display: block;
}

.pp-layout {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 20px;
    min-height: 600px;
}

/* Sidebar - formularz */
.pp-sidebar {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 0;
    overflow: hidden;
}

.pp-form {
    padding: 25px;
}

.pp-form h3 {
    margin: 0 0 20px 0;
    color: #2c5530;
    font-size: 1.3rem;
}

.pp-field {
    margin-bottom: 20px;
}

.pp-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: #333;
    font-size: 0.95rem;
}

.pp-field input,
.pp-field select {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.pp-field input:focus,
.pp-field select:focus {
    border-color: #2c5530;
    outline: none;
}

.pp-field small {
    display: block;
    margin-top: 4px;
    color: #999;
    font-size: 0.8rem;
}

.pp-btn-primary {
    width: 100%;
    background: #2c5530;
    color: white;
    border: none;
    padding: 16px 24px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.pp-btn-primary:hover {
    background: #1a3a1f;
}

.pp-btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.pp-btn-secondary:hover {
    background: #5a6268;
}

.pp-loading {
    text-align: center;
    padding: 30px 20px;
}

.pp-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #2c5530;
    border-radius: 50%;
    animation: pp-spin 1s linear infinite;
    margin: 0 auto 15px auto;
}

@keyframes pp-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Results panel */
.pp-results {
    padding: 25px;
    background: white;
    border-top: 3px solid #2c5530;
}

.pp-results h3 {
    margin: 0 0 20px 0;
    color: #2c5530;
    font-size: 1.3rem;
}

.pp-results h4 {
    margin: 15px 0 10px 0;
    color: #333;
    font-size: 1.1rem;
}

.pp-stat {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 10px;
}

.pp-stat-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.pp-stat-label {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 2px;
}

.pp-stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #2c5530;
}

.pp-stops-list {
    max-height: 300px;
    overflow-y: auto;
}

.pp-stop-item {
    background: #f8f9fa;
    border-left: 4px solid #2c5530;
    padding: 12px 15px;
    margin-bottom: 10px;
    border-radius: 6px;
}

.pp-stop-item-name {
    font-weight: 600;
    color: #2c5530;
    margin-bottom: 4px;
}

.pp-stop-item-info {
    font-size: 0.9rem;
    color: #666;
}

/* Mapa */
.pp-map-container {
    position: relative;
    background: #e9ecef;
    border-radius: 12px;
    overflow: hidden;
    min-height: 600px;
}

#pp-map {
    width: 100%;
    height: 100%;
    min-height: 600px;
    border-radius: 12px;
}

.pp-map-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    z-index: 1000;
}

.pp-map-placeholder-content {
    text-align: center;
    padding: 40px;
    max-width: 400px;
}

.pp-map-placeholder-content h3 {
    margin: 0 0 10px 0;
    color: #333;
}

.pp-map-placeholder-content p {
    margin: 0;
    color: #666;
    line-height: 1.6;
}

/* Leaflet popup customization */
.pp-popup-title {
    font-weight: 700;
    color: #2c5530;
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.pp-popup-info {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.5;
}

/* Autocomplete styles - ULEPSZONE */
.pp-autocomplete-wrapper {
    position: relative;
}

.pp-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #2c5530;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.pp-suggestions.active {
    display: block;
}

.pp-suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #eee;
}

.pp-suggestion-item:last-child {
    border-bottom: none;
}

.pp-suggestion-item:hover {
    background: #f0f7f1;
}

.pp-suggestion-item.selected {
    background: #e8f5e9;
}

/* ULEPSZONE: Większa nazwa miasta */
.pp-suggestion-name {
    font-weight: 700;
    color: #2c5530;
    font-size: 16px;
    margin-bottom: 3px;
}

/* ULEPSZONE: Dyskretniejszy region */
.pp-suggestion-region {
    font-size: 11px;
    color: #999;
    font-weight: 400;
    text-transform: lowercase;
}

/* Waypoints */
.pp-waypoint-field {
    margin-bottom: 15px;
    padding: 12px;
    background: #ffffff;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
}

.pp-waypoint-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.pp-waypoint-label {
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
}

.pp-btn-remove-waypoint {
    background: #dc3545;
    color: white;
    border: none;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
}

.pp-btn-remove-waypoint:hover {
    background: #c82333;
}

.pp-btn-add-waypoint {
    width: 100%;
    background: transparent;
    color: #2c5530;
    border: 2px dashed #2c5530;
    padding: 12px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 20px;
    transition: all 0.2s;
}

.pp-btn-add-waypoint:hover {
    background: #f0f7f1;
    border-style: solid;
}

/* Scrollbars */
.pp-stops-list::-webkit-scrollbar,
.pp-suggestions::-webkit-scrollbar {
    width: 8px;
}

.pp-stops-list::-webkit-scrollbar-track,
.pp-suggestions::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.pp-stops-list::-webkit-scrollbar-thumb,
.pp-suggestions::-webkit-scrollbar-thumb {
    background: #2c5530;
    border-radius: 4px;
}

.pp-stops-list::-webkit-scrollbar-thumb:hover,
.pp-suggestions::-webkit-scrollbar-thumb:hover {
    background: #1a3a1f;
}

/* RESPONSIVE - Mobile First */
@media (max-width: 992px) {
    .pp-layout {
        grid-template-columns: 1fr;
    }

    .pp-map-container {
        min-height: 400px;
        order: 2;
    }

    .pp-sidebar {
        order: 1;
    }

    #pp-map {
        min-height: 400px;
    }

    .pp-header h1 {
        font-size: 1.3rem;
    }

    .pp-help-btn {
        padding: 6px 12px;
        font-size: 0.85rem;
    }
}

@media (max-width: 768px) {
    .pp-header {
        padding: 10px 15px;
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .pp-header h1 {
        font-size: 1.2rem;
    }

    .pp-help-btn {
        width: 100%;
    }

    .pp-form,
    .pp-results {
        padding: 20px 15px;
    }

    .pp-stat {
        padding: 10px;
    }

    .pp-stat-icon {
        font-size: 20px;
    }

    .pp-instructions-tooltip {
        max-width: 90%;
        padding: 20px;
    }

    /* Mniejsze autocomplete na mobile */
    .pp-suggestion-name {
        font-size: 15px;
    }

    .pp-suggestion-region {
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    .pp-header h1 {
        font-size: 1.1rem;
    }

    .pp-layout {
        gap: 15px;
    }

    .pp-map-container,
    #pp-map {
        min-height: 350px;
    }
}

/* ========================================
   FULL WIDTH - ukryj sidebar WordPress
   ======================================== */
.page-id-1249 #secondary,
.page-id-1249 .ct-sidebar-wrapper,
.page-id-1249 aside,
.page-id-1249 .sidebar,
.page-id-1249 .widget-area {
    display: none;
}

.page-id-1249 #primary,
.page-id-1249 .content-area,
.page-id-1249 .site-main {
    width: 100%;
    max-width: 100%;
    float: none;
    margin: 0 auto;
    padding-left: 0;
    padding-right: 0;
}

.page-id-1249 .site-content {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 20px;
}

.page-id-1249 .entry-content {
    margin: 0;
    padding: 0;
}

/* Ukryj niepotrzebne elementy strony */
.page-id-1249 .entry-footer,
.page-id-1249 .post-share,
.page-id-1249 .share-links,
.page-id-1249 .entry-meta,
.page-id-1249 .post-navigation,
.page-id-1249 .comments-area {
    display: none;
}

/* Loading indicator dla Nominatim */
.pp-suggestion-item.pp-loading {
    color: #888;
    font-style: italic;
    cursor: default;
    text-align: center;
    padding: 12px;
}

/* Fix layout gdy widoczne wyniki */
.pp-sidebar:has(.pp-results[style*="block"]) {
    grid-column: 1;
}

.pp-map-container:has(~ .pp-sidebar .pp-results[style*="block"]) {
    grid-column: 2;
}

/* Alternatywnie - wyniki na całą szerokość sidebar */
.pp-results {
    min-height: 500px;
}

/* Upewnij się że mapa ma pełną wysokość */
.pp-layout .pp-map-container {
    height: auto;
    min-height: 600px;
}

/* Przycisk Zaplanuj trasę - wyrazisty kolor */
.pp-btn-plan {
    width: 100%;
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    color: white;
    border: none;
    padding: 18px 24px;
    border-radius: 10px;
    font-size: 1.15rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pp-btn-plan:hover {
    background: linear-gradient(135deg, #ff8555 0%, #ffaa3e 100%);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.5);
    transform: translateY(-2px);
}

.pp-btn-plan:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(255, 107, 53, 0.4);
}

.pp-btn-plan .pp-btn-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
