/* =============================================
   LOCATION PICKER COMPONENT
   Reusable location selection bottom sheet for mobile
   ============================================= */

/* ===== BOTTOM SHEET CONTAINER ===== */
.location-bottom-sheet {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: none;
}

.location-bottom-sheet.show {
    display: block;
}

/* ===== OVERLAY ===== */
.location-bottom-sheet .bottom-sheet-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease-out;
}

/* ===== CONTENT ===== */
.location-bottom-sheet .bottom-sheet-content {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100%;
    max-height: 100%;
    background: white;
    border-radius: 0;
    box-shadow: none;
    transform: translateY(100%);
    transition: transform 0.3s ease-out;
    display: flex;
    flex-direction: column;
}

.location-bottom-sheet.show .bottom-sheet-content {
    transform: translateY(0);
}

/* ===== HEADER ===== */
.location-bottom-sheet .bottom-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e9ecef;
    flex-shrink: 0;
}

.location-bottom-sheet .bottom-sheet-header h5 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.location-bottom-sheet .bottom-sheet-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #6B7280;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.location-bottom-sheet .bottom-sheet-close:hover {
    color: #1F2937;
}

/* ===== BODY ===== */
.location-bottom-sheet .bottom-sheet-body {
    overflow-y: hidden;
    overflow-x: hidden;
    flex: 1;
    padding: 16px 20px 0 20px !important;
    display: flex;
    flex-direction: column;
}

.location-bottom-sheet .location-search-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

/* ===== SEARCH INPUT ===== */
.location-bottom-sheet .filter-search-input {
    margin-bottom: 0;
    flex-shrink: 0;
}

.location-bottom-sheet .filter-search-input input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    font-size: 16px; /* Prevents iOS zoom */
}

.location-bottom-sheet .filter-search-input input:focus {
    outline: none;
    border-color: #2ABDB5;
}

/* ===== SELECTED LOCATIONS ===== */
.location-bottom-sheet .selected-locations-container {
    flex-shrink: 0;
    padding: 12px 0;
    margin-top: 12px;
    border-top: 1px solid #E5E7EB;
    border-bottom: none;
}

.location-bottom-sheet .selected-locations-label {
    font-size: 13px;
    color: #6B7280;
    margin-bottom: 10px;
    font-weight: 600;
}

.location-bottom-sheet .selected-locations-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* ===== LOCATION PILLS ===== */
.location-bottom-sheet .hero-location-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    font-size: 13px;
    color: #333;
}

.location-bottom-sheet .hero-location-pill-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.location-bottom-sheet .hero-location-pill-name {
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.location-bottom-sheet .hero-location-pill-type {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}

.location-bottom-sheet .hero-location-pill-type.lan {
    background: #dbeafe;
    color: #1e40af;
}

.location-bottom-sheet .hero-location-pill-type.kommun {
    background: #fef3c7;
    color: #92400e;
}

.location-bottom-sheet .hero-location-pill-type.omrade {
    background: #d1fae5;
    color: #065f46;
}

.location-bottom-sheet .hero-location-pill-type.country {
    background: #f3e8ff;
    color: #6b21a8;
}

.location-bottom-sheet .hero-location-pill-remove {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 0;
    font-size: 16px;
}

.location-bottom-sheet .hero-location-pill-remove:hover {
    color: #ef4444;
}

/* ===== SEARCH RESULTS ===== */
.location-bottom-sheet .location-search-results {
    overflow-y: auto;
    overflow-x: hidden;
    background: white;
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    z-index: 10000;
    padding: 0;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    margin-top: 12px;
    flex: 0 0 auto;
    min-height: 0;
    max-height: 50vh;
    box-shadow: none !important;
}

.location-bottom-sheet .location-search-results:empty {
    display: none;
    padding: 0;
    flex: 0;
    border: none;
}

/* ===== RESULT ITEMS (matching desktop popup style) ===== */
.location-bottom-sheet .hero-location-result-item {
    padding: 12px 14px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    border-bottom: 1px solid #f1f3f4;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.location-bottom-sheet .hero-location-result-item:last-child {
    border-bottom: none;
}

.location-bottom-sheet .hero-location-result-item:hover {
    background-color: #f8f9fa;
}

.location-bottom-sheet .hero-location-result-item.selected {
    background-color: #e6f7f7;
}

.location-bottom-sheet .hero-location-result-item.no-results {
    color: #6B7280;
    font-size: 14px;
    cursor: default;
    justify-content: center;
}

.location-bottom-sheet .hero-location-result-item.no-results:hover {
    background: transparent;
}

.location-bottom-sheet .hero-location-result-name {
    font-size: 14px;
    font-weight: 500;
    color: #1F2937;
    display: flex;
    align-items: center;
    gap: 6px;
}

.location-bottom-sheet .hero-location-result-type {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}

.location-bottom-sheet .hero-location-result-type.country {
    background: #f3e8ff;
    color: #6b21a8;
}

.location-bottom-sheet .hero-location-result-type.lan {
    background: #dbeafe;
    color: #1e40af;
}

.location-bottom-sheet .hero-location-result-type.kommun {
    background: #fef3c7;
    color: #92400e;
}

.location-bottom-sheet .hero-location-result-type.omrade {
    background: #d1fae5;
    color: #065f46;
}

.location-bottom-sheet .hero-location-result-meta {
    font-size: 11px;
    color: #718096;
    margin-top: 2px;
    text-align: left;
}

/* ===== RESULT ITEMS (alternate style) ===== */
.location-bottom-sheet .location-result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #F3F4F6;
    cursor: pointer;
    margin: 0 -20px;
}

.location-bottom-sheet .location-result-item:last-child {
    border-bottom: none;
}

.location-bottom-sheet .location-result-item:hover {
    background: #F0FFFE;
}

.location-bottom-sheet .location-result-item.selected {
    background: #E6F7F6;
    border-left: 3px solid #2ABDB5;
}

.location-bottom-sheet .location-result-item.no-results {
    color: #6B7280;
    font-size: 14px;
    cursor: default;
    justify-content: center;
}

.location-bottom-sheet .location-result-item.no-results:hover {
    background: transparent;
}

.location-bottom-sheet .location-result-main {
    font-size: 14px;
    font-weight: 500;
    color: #1F2937;
}

.location-bottom-sheet .location-result-type {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.location-bottom-sheet .location-result-type.kommun {
    background: #FEF3C7;
    color: #92400E;
}

.location-bottom-sheet .location-result-type.omrade {
    background: #D1FAE5;
    color: #065F46;
}

.location-bottom-sheet .location-result-type.lan {
    background: #DBEAFE;
    color: #1E40AF;
}

/* ===== BOTTOM SHEET FOOTER ===== */
.location-bottom-sheet .bottom-sheet-footer {
    padding: 12px 20px;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 10px;
    flex-shrink: 0;
    background: white;
}

.location-bottom-sheet .bottom-sheet-footer .btn-clear {
    flex: 1;
    padding: 12px 16px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s ease;
}

.location-bottom-sheet .bottom-sheet-footer .btn-clear:hover {
    background: #e9ecef;
}

.location-bottom-sheet .bottom-sheet-footer .btn-apply {
    flex: 2;
    padding: 12px 16px;
    background: #2ABDB5;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.location-bottom-sheet .bottom-sheet-footer .btn-apply:hover {
    background: #249a9a;
}

/* ===== ANIMATION ===== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* =============================================
   DESKTOP LOCATION POPUP
   Dropdown popup for desktop location selection
   ============================================= */

/* ===== POPUP CONTAINER ===== */
.location-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9998;
    display: none;
}

.location-popup.show {
    display: block;
}

/* ===== POPUP OVERLAY ===== */
.location-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.2s ease-out;
}

/* ===== POPUP CONTENT ===== */
.location-popup-content {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 420px;
    max-width: calc(100vw - 40px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: popupFadeIn 0.25s ease-out;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 80px);
}

@keyframes popupFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* ===== POPUP HEADER ===== */
.location-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e9ecef;
    flex-shrink: 0;
}

.location-popup-header h5 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #1F2937;
}

.location-popup-close {
    background: none;
    border: none;
    font-size: 20px;
    color: #6B7280;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.location-popup-close:hover {
    background: #f3f4f6;
    color: #1F2937;
}

/* ===== POPUP BODY ===== */
.location-popup-body {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ===== POPUP SEARCH INPUT ===== */
.location-popup .popup-search-wrapper {
    margin-bottom: 0;
    flex-shrink: 0;
}

.location-popup .popup-search-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.location-popup .popup-search-input:focus {
    outline: none;
    border-color: #2ABDB5;
    box-shadow: 0 0 0 3px rgba(42, 189, 181, 0.1);
}

.location-popup .popup-search-input::placeholder {
    color: #9CA3AF;
}

/* ===== POPUP SELECTED LOCATIONS ===== */
.location-popup .popup-selected-container {
    flex-shrink: 0;
    padding: 12px 0;
    margin-top: 12px;
    border-top: 1px solid #E5E7EB;
}

.location-popup .popup-selected-label {
    font-size: 12px;
    color: #6B7280;
    margin-bottom: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.location-popup .popup-selected-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Popup pill type colors */
.location-popup .hero-location-pill-type.country {
    background: #f3e8ff;
    color: #6b21a8;
}

.location-popup .hero-location-pill-type.lan {
    background: #dbeafe;
    color: #1e40af;
}

.location-popup .hero-location-pill-type.kommun {
    background: #fef3c7;
    color: #92400e;
}

.location-popup .hero-location-pill-type.omrade {
    background: #d1fae5;
    color: #065f46;
}

/* ===== POPUP SEARCH RESULTS ===== */
.location-popup .popup-search-results {
    overflow-y: auto;
    background: white;
    margin-top: 12px;
    flex: 1;
    min-height: 0;
    max-height: 300px;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
}

.location-popup .popup-search-results:empty {
    display: none;
}

/* ===== POPUP RESULT ITEMS ===== */
.location-popup .popup-result-item {
    padding: 12px 14px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    border-bottom: 1px solid #f1f3f4;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.location-popup .popup-result-item:last-child {
    border-bottom: none;
}

.location-popup .popup-result-item:hover {
    background-color: #f8f9fa;
}

.location-popup .popup-result-item.selected {
    background-color: #e6f7f7;
}

.location-popup .popup-result-item.no-results {
    color: #6B7280;
    font-size: 14px;
    cursor: default;
    justify-content: center;
}

.location-popup .popup-result-item.no-results:hover {
    background: transparent;
}

.location-popup .popup-result-name {
    font-size: 14px;
    font-weight: 500;
    color: #1F2937;
    display: flex;
    align-items: center;
    gap: 6px;
}

.location-popup .popup-result-type {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}

.location-popup .popup-result-type.country {
    background: #f3e8ff;
    color: #6b21a8;
}

.location-popup .popup-result-type.lan {
    background: #dbeafe;
    color: #1e40af;
}

.location-popup .popup-result-type.kommun {
    background: #fef3c7;
    color: #92400e;
}

.location-popup .popup-result-type.omrade {
    background: #d1fae5;
    color: #065f46;
}

.location-popup .popup-result-meta {
    font-size: 11px;
    color: #718096;
    margin-top: 2px;
}

/* ===== POPUP FOOTER ===== */
.location-popup-footer {
    padding: 12px 20px;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.location-popup-footer .btn-clear {
    flex: 1;
    padding: 10px 16px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s ease;
}

.location-popup-footer .btn-clear:hover {
    background: #e9ecef;
}

.location-popup-footer .btn-apply {
    flex: 2;
    padding: 10px 16px;
    background: #2ABDB5;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.location-popup-footer .btn-apply:hover {
    background: #249a9a;
}

/* ===== HIDE POPUP ON MOBILE ===== */
@media (max-width: 767px) {
    .location-popup {
        display: none !important;
    }
}
