/* FitCamp Location Search Plugin Styles */
/* Nur für Frontend Shortcode - keine globalen Styles */

/* Plugin Container - spezifisch begrenzt */
.fitcamp-location-search {
    max-width: 100%;
    margin: 20px 0;
    font-family: inherit;
    position: relative;
    z-index: 1;
}

/* Suchformular */
.fitcamp-search-form {
    margin-bottom: 20px;
}

.fitcamp-search-input-wrapper {
    display: flex;
    gap: 10px;
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

.fitcamp-search-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    background: #fff;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.fitcamp-search-input:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
}

.fitcamp-search-input-wrapper.focused .fitcamp-search-input {
    border-color: #007cba;
}

/* Autocomplete Dropdown */
.fitcamp-autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 60px; /* Platz für Button lassen */
    background: #fff;
    border: 1px solid #e1e5e9;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    z-index: 99999;
    max-height: 300px;
    overflow-y: auto;
}

.fitcamp-suggestions-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.fitcamp-suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
    font-size: 15px;
    color: #333;
}

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

.fitcamp-suggestion-item:hover,
.fitcamp-suggestion-item.active {
    background-color: #f8f9fa;
    color: #007cba;
}

.fitcamp-suggestion-item.active {
    background-color: #e3f2fd;
}

/* Styling für Autocomplete bei fokussiertem Input */
.fitcamp-search-input:focus + .fitcamp-autocomplete-dropdown {
    border-color: #007cba;
}

.fitcamp-search-button {
    padding: 10px 20px;
    background-color: #7bb926 !important;
	background: #7bb926 !important; 
    color: #fff !important;
    border: none;
    border-radius: 4px !important;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    min-width: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.fitcamp-search-button:hover:not(.loading) {
    background: linear-gradient(135deg, #005a87 0%, #004066 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.3);
}

.fitcamp-search-button:active {
    transform: translateY(0);
}

.fitcamp-search-button.loading {
    cursor: not-allowed;
    opacity: 0.8;
}

.fitcamp-loading-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Modal/Popup für Ergebnisse */
.fitcamp-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    overflow: hidden; /* Verhindert Scrolling der Hintergrundseite */
}

/* Body-Scrolling deaktivieren wenn Modal offen */
body.fitcamp-modal-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100vh !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
}

/* iOS Safari spezifische Fixes */
body.fitcamp-modal-open {
    -webkit-overflow-scrolling: none !important;
    touch-action: none !important;
}

@supports (-webkit-touch-callout: none) {
    body.fitcamp-modal-open {
        position: fixed !important;
        overflow: hidden !important;
        height: 100vh !important;
        width: 100vw !important;
    }
}

.fitcamp-modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.fitcamp-modal {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.9) translateY(30px);
    transition: all 0.3s ease;
    position: relative;
}

.fitcamp-modal-overlay.show .fitcamp-modal {
    transform: scale(1) translateY(0);
}

.fitcamp-modal-header {
    padding: 20px 70px 15px 25px; /* Mehr Platz für Close-Button */
    border-bottom: 1px solid #e1e5e9;
    display: flex;
    justify-content: flex-start; /* Links ausrichten statt space-between */
    align-items: center;
    background: #f8f9fa;
    position: relative;
}

.fitcamp-modal-close {
    background: none;
    border: none;
    font-size: 32px !important;
    color: #666;
    cursor: pointer;
    padding: 8px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    line-height: 1;
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 10;
}

.fitcamp-modal-close:hover {
    background: #e9ecef;
    color: #333;
}

.fitcamp-modal-body {
    padding: 25px;
    overflow-y: auto;
    max-height: calc(90vh - 120px);
}

/* Ergebnisbereich - jetzt im Modal */
.fitcamp-search-results {
    animation: fadeInUp 0.3s ease;
}

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

.fitcamp-results-header {
    margin-bottom: 20px;
    text-align: center;
}

.fitcamp-results-title {
    font-size: 24px !important;
    font-weight: 600;
    color: #333;
    margin: 0;
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
}

.fitcamp-fallback-results .fitcamp-results-title {
    color: #f39c12;
}

.fitcamp-error-title {
    color: #e74c3c !important;
}

/* Standortliste */
.fitcamp-results-list {
    display: grid;
    gap: 20px;
}

.fitcamp-location-item {
    background: #fff;
    border: 1px solid #7bb926;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
}

.fitcamp-location-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border-color: #007cba;
}

.fitcamp-location-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
    position: relative;
}

.fitcamp-location-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.fitcamp-location-item:hover .fitcamp-location-image img {
    transform: scale(1.05);
}

.fitcamp-location-content {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.fitcamp-location-title {
    font-size: 20px !important;
    font-weight: 600;
    margin: 0 0 10px 0;
    line-height: 1.3;
}

.fitcamp-location-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.2s ease;
}

.fitcamp-location-title a:hover {
    color: #007cba;
}

.fitcamp-location-description {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
    margin: 0 0 15px 0;
}

.fitcamp-location-meta {
    margin: 15px 0;
    flex-grow: 1;
}

.fitcamp-location-meta > div {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 14px;
    color: #555;
}

.fitcamp-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.fitcamp-location-distance {
    font-weight: 600;
    color: #7bb926 !important;
}

.fitcamp-location-meta a {
    color: #007cba;
    text-decoration: none;
}

.fitcamp-location-meta a:hover {
    text-decoration: underline;
}

/* Action Buttons */
.fitcamp-location-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
}

.fitcamp-btn {
    padding: 10px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    text-align: center;
    min-width: 100px;
    display: inline-block;
}

.fitcamp-btn-primary {
    background: #7bb926;
    color: #fff;
    border: 1px solid #7bb926;
}

.fitcamp-btn-primary:hover {
    background: #7bb926;
    border-color: #7bb926;
    color: #fff;
    text-decoration: none;
}

.fitcamp-btn-secondary {
    background: transparent;
    color: #007cba;
    border: 1px solid #007cba;
}

.fitcamp-btn-secondary:hover {
    background: #007cba;
    color: #fff;
    text-decoration: none;
}

/* Fehlermeldungen */
.fitcamp-error,
.fitcamp-error-message {
    background: #fee;
    color: #c33;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #fcc;
    text-align: center;
    font-weight: 500;
}

.fitcamp-no-results {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-style: italic;
}

/* Responsive Design */
@media (min-width: 768px) {
    .fitcamp-results-list {
        grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    }
    
    .fitcamp-location-item {
        flex-direction: row;
        min-height: 200px;
    }
    
    .fitcamp-location-image {
        width: 200px;
        height: auto;
        flex-shrink: 0;
    }
    
    .fitcamp-location-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .fitcamp-btn {
        text-align: center;
    }
}

@media (max-width: 767px) {
    .fitcamp-search-input-wrapper {
        flex-direction: column;
        gap: 15px;
    }
    
    .fitcamp-search-input {
        padding: 16px 20px !important;
        font-size: 18px !important;
        border-radius: 12px !important;
    }
    
    .fitcamp-search-button {
        width: 100% !important;
        justify-content: center;
        padding: 16px 24px !important;
        font-size: 18px !important;
        min-height: 56px !important;
        border-radius: 12px !important;
        font-weight: 600 !important;
    }
    
    /* Autocomplete für Mobile anpassen */
    .fitcamp-autocomplete-dropdown {
        right: 0 !important; /* Volle Breite auf Mobile */
        max-height: 250px !important; /* Weniger Höhe auf kleinen Bildschirmen */
        border-radius: 0 0 8px 8px !important;
        font-size: 16px !important; /* iOS Zoom verhindern */
		z-index: 99999 !important;
    }

    .fitcamp-suggestion-item {
        padding: 16px 20px !important; /* Größere Touch-Targets */
        font-size: 16px !important; /* Verhindert Zoom auf iOS */
        min-height: 48px !important; /* Touch-freundliche Mindesthöhe */
        display: flex !important;
        align-items: center !important;
    }
    
    .fitcamp-location-actions {
        flex-direction: column;
        gap: 12px !important;
        margin-top: 20px !important;
    }
    
    .fitcamp-btn {
        width: 100% !important;
        text-align: center !important;
        padding: 14px 20px !important;
        font-size: 16px !important;
        min-height: 48px !important;
        border-radius: 8px !important;
        font-weight: 600 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        text-decoration: none !important;
        box-sizing: border-box !important;
        vertical-align: middle !important;
    }
    
    .fitcamp-location-content {
        padding: 20px 20px 0 20px !important; /* Kein Bottom-Padding, da Actions eigenes Padding haben */
        min-height: 140px !important; /* Mindesthöhe für beide Buttons */
        display: flex !important;
        flex-direction: column !important;
        position: relative !important;
    }

    .fitcamp-location-meta {
        margin: 15px 0 20px 0 !important;
        flex-grow: 1 !important; /* Füllt verfügbaren Platz */
    }

    .fitcamp-location-meta > div {
        margin-bottom: 12px !important;
        padding: 8px 0 !important;
        font-size: 15px !important;
    }

    /* Modal anpassungen für Mobile */
    .fitcamp-modal-overlay {
        padding: 8px !important;
        padding-top: max(20px, env(safe-area-inset-top, 10px) + 10px) !important;
    }

    .fitcamp-modal {
        margin-top: max(60px, env(safe-area-inset-top, 20px) + 40px) !important;
        border-radius: 16px !important;
        max-height: calc(100vh - max(80px, env(safe-area-inset-top, 20px) + 60px)) !important;
        width: calc(100vw - 16px) !important;
        position: relative !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .fitcamp-modal-header {
        padding: 15px 60px 15px 20px !important; /* Mehr Platz für Close-Button */
        border-radius: 16px 16px 0 0 !important;
        flex-shrink: 0 !important; /* Header bleibt oben fixiert */
        min-height: auto !important;
        position: relative !important;
    }

    .fitcamp-modal-close {
        width: 52px !important;
        height: 52px !important;
        font-size: 36px !important;
        padding: 8px !important;
        position: absolute !important;
        top: 12px !important;
        right: 12px !important;
        z-index: 10 !important;
    }

    .fitcamp-modal-body {
        padding: 25px 20px 30px !important;
        flex: 1 !important; /* Nimmt den verfügbaren Platz ein */
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important; /* Smooth scrolling auf iOS */
        max-height: none !important; /* Flexbox übernimmt die Höhe */
    }

    .fitcamp-results-list {
        gap: 20px !important;
    }

    .fitcamp-results-title {
        font-size: 18px !important;
        line-height: 1.4 !important;
        margin: 0 !important;
        padding-right: 0 !important; /* Close-Button ist absolut positioniert */
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        hyphens: auto !important;
        max-width: 100% !important;
    }

    /* Touch-freundliche Abstände */
    .fitcamp-location-item {
        border-radius: 16px !important;
        padding: 0 !important;
        overflow: visible !important; /* Verhindert abgeschnittene Buttons */
        margin-bottom: 25px !important; /* Mehr Platz zwischen Items */
        display: flex !important;
        flex-direction: column !important;
        min-height: auto !important;
    }

    .fitcamp-location-title {
        font-size: 20px !important;
        margin-bottom: 15px !important;
        line-height: 1.3 !important;
    }

    .fitcamp-location-title a {
        display: block;
        padding: 5px 0;
        color: #333 !important;
        text-decoration: none !important;
    }

    /* Sicherstellen dass alle Buttons sichtbar sind */
    .fitcamp-location-actions {
        padding: 20px 20px 15px 20px !important;
        border-top: 1px solid #eee !important;
        margin-top: auto !important;
        flex-shrink: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .fitcamp-btn-primary {
        background: #7bb926 !important;
        color: #fff !important;
        border: 1px solid #7bb926 !important;
        margin-bottom: 8px !important;
        text-align: center !important;
        justify-content: center !important;
        align-items: center !important;
    }

    .fitcamp-btn-secondary {
        background: transparent !important;
        color: #007cba !important;
        border: 1px solid #007cba !important;
        margin-bottom: 8px !important;
        text-align: center !important;
        justify-content: center !important;
        align-items: center !important;
    }

    .fitcamp-btn-secondary:hover,
    .fitcamp-btn-secondary:active {
        background: #007cba !important;
        color: #fff !important;
    }
}

/* Spezielle Anpassungen für iPhone X und neuere Modelle mit Notch */
@media only screen 
    and (device-width: 375px) 
    and (device-height: 812px) 
    and (-webkit-device-pixel-ratio: 3),
    only screen 
    and (device-width: 414px) 
    and (device-height: 896px) 
    and (-webkit-device-pixel-ratio: 2),
    only screen 
    and (device-width: 414px) 
    and (device-height: 896px) 
    and (-webkit-device-pixel-ratio: 3),
    only screen 
    and (device-width: 390px) 
    and (device-height: 844px) 
    and (-webkit-device-pixel-ratio: 3),
    only screen 
    and (device-width: 428px) 
    and (device-height: 926px) 
    and (-webkit-device-pixel-ratio: 3) {
    
    .fitcamp-modal-overlay {
        padding-top: 50px !important; /* Mehr Platz für Notch */
    }
    
    .fitcamp-modal {
        margin-top: 70px !important; /* Noch mehr Abstand für iPhone-Notch */
        max-height: calc(100vh - 90px) !important;
    }
}

/* Accessibility */
.fitcamp-search-input:focus,
.fitcamp-btn:focus {
    outline: 2px solid #7bb926;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print Styles */
@media print {
    .fitcamp-search-form,
    .fitcamp-location-actions {
        display: none;
    }
    
    .fitcamp-location-item {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #000;
    }
} 