/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Source Sans Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    height: 100vh;
    overflow: hidden;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
}

/* Scrollbar Styling */
.places-list::-webkit-scrollbar {
    width: 8px;
}

.places-list::-webkit-scrollbar-track {
    background: #f0fdf4;
    border-radius: 10px;
}

.places-list::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border-radius: 10px;
}

.places-list::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
}

/* Input Range Styling */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: #e5e7eb;
    border-radius: 5px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(34, 197, 94, 0.3);
    transition: all 0.3s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(34, 197, 94, 0.3);
}

/* Header */
.header {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 50%, #15803d 100%);
    color: white;
    padding: 18px 25px;
    box-shadow: 0 4px 20px rgba(34, 197, 94, 0.3);
    z-index: 1000;
    position: relative;
    border-bottom: 3px solid rgba(255,255,255,0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-title {
    font-size: 26px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.header-title .pulse-icon {
    animation: pulse 2s infinite;
    background: rgba(255,255,255,0.2);
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0.9; }
}

.back-btn {
    background: rgba(255,255,255,0.25);
    border: 2px solid rgba(255,255,255,0.3);
    color: white;
    padding: 10px 18px;
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
    font-size: 14px;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

.back-btn:hover {
    background: rgba(255,255,255,0.35);
    border-color: rgba(255,255,255,0.5);
    transform: translateX(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    color: white;
    text-decoration: none;
}

/* Main Container */
.main-container {
    display: flex;
    height: calc(100vh - 70px);
    position: relative;
    flex-direction: row-reverse; /* Map first, sidebar on right */
}

/* Sidebar - Now on Right */
.sidebar {
    width: 420px;
    background: linear-gradient(to bottom, #ffffff 0%, #f0fdf4 100%);
    box-shadow: -4px 0 20px rgba(34, 197, 94, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1000;
    border-left: 3px solid #dcfce7; /* Changed from border-right to border-left */
}

/* Location Status */
.location-status {
    padding: 22px;
    background: linear-gradient(135deg, #dcfce7 0%, #d1fae5 100%);
    border-bottom: 3px solid #22c55e;
    border-left: 4px solid #22c55e;
}

.location-status.loading {
    text-align: center;
    color: #16a34a;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-left-color: #6ee7b7;
}

.location-status.success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border-bottom-color: #22c55e;
    border-left-color: #22c55e;
}

.location-status.error {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border-bottom-color: #ef4444;
    border-left-color: #ef4444;
}

.location-text {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.location-details {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

/* Search Section */
.search-section {
    padding: 22px;
    border-bottom: 2px solid #e5e7eb;
    background: linear-gradient(to bottom, #ffffff 0%, #f9fafb 100%);
}

.search-box {
    position: relative;
    margin-bottom: 15px;
}

.search-box input {
    width: 100%;
    padding: 12px 15px 12px 45px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.3s;
}

.search-box input:focus {
    outline: none;
    border-color: #22c55e;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.15);
    background: white;
}

.search-box i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

.filter-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 15px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-btn.active {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    border-color: #16a34a;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
    font-weight: 600;
    transform: translateY(-1px);
}

.filter-btn:hover {
    border-color: #22c55e;
    background: #f0fdf4;
    transform: translateY(-1px);
}

.filter-btn:hover:not(.active) {
    background: #f0fdf4;
}

/* Form Controls */
.radius-control {
    margin-bottom: 15px;
}

.radius-control label {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    display: block;
    margin-bottom: 8px;
}

.radius-control-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.radius-control-wrapper input[type="range"] {
    flex: 1;
}

.radius-input {
    width: 65px;
    padding: 8px;
    border: 2px solid #dcfce7;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    color: #15803d;
    transition: all 0.3s;
}

.radius-input:focus {
    outline: none;
    border-color: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

.custom-location-control {
    margin-bottom: 15px;
}

.custom-location-control label {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    display: block;
    margin-bottom: 8px;
}

.custom-location-wrapper {
    display: flex;
    gap: 5px;
}

.custom-location-input {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 13px;
    transition: all 0.3s;
}

.custom-location-input:focus {
    outline: none;
    border-color: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

.btn-set-location {
    padding: 8px 14px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
    transition: all 0.3s;
}

.btn-set-location:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}

.btn-map-click {
    margin-top: 8px;
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 2px solid #22c55e;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: #15803d;
    transition: all 0.3s;
}

.btn-map-click:hover {
    background: linear-gradient(135deg, #dcfce7 0%, #d1fae5 100%);
    transform: translateY(-1px);
}

.btn-map-click.active {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    border-color: #16a34a;
}

/* Places List */
.places-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #fafafa;
}

.section-header {
    font-size: 14px;
    font-weight: 600;
    color: #666;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.place-card {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 14px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.place-card:hover {
    box-shadow: 0 8px 24px rgba(34, 197, 94, 0.2);
    transform: translateY(-4px);
    border-color: #22c55e;
    background: linear-gradient(to right, #f0fdf4 0%, #ffffff 100%);
}

.place-card.active {
    border-color: #22c55e;
    border-width: 3px;
    box-shadow: 0 8px 24px rgba(34, 197, 94, 0.3);
    background: linear-gradient(to right, #d1fae5 0%, #ffffff 100%);
    transform: translateY(-2px);
}

.place-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.place-title {
    font-weight: 600;
    font-size: 16px;
    color: #333;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.certified-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 700;
    margin-left: 8px;
}

.non-certified-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 700;
    margin-left: 8px;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.place-type {
    display: inline-block;
    padding: 5px 12px;
    background: linear-gradient(135deg, #dcfce7 0%, #d1fae5 100%);
    color: #15803d;
    border: 1px solid #a7f3d0;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    margin-top: 5px;
}

.place-address {
    color: #666;
    font-size: 13px;
    margin: 8px 0;
    display: flex;
    align-items: flex-start;
    gap: 5px;
}

.place-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
}

.place-distance {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #16a34a;
    font-weight: 700;
    font-size: 14px;
    padding: 4px 10px;
    background: #f0fdf4;
    border-radius: 8px;
}

.place-rating {
    display: flex;
    align-items: center;
    gap: 3px;
    color: #ff9800;
    font-size: 13px;
}

.btn-route {
    padding: 7px 14px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(34, 197, 94, 0.3);
    transition: all 0.3s;
}

.btn-route:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(34, 197, 94, 0.4);
}

/* Map */
#map {
    flex: 1;
    height: 100%;
    z-index: 1;
}

/* Floating Action Button */
.fab {
    position: absolute;
    bottom: 30px;
    left: 30px; /* Changed from right to left since sidebar is on right */
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 50%, #15803d 100%);
    border: 3px solid white;
    border-radius: 50%;
    color: white;
    font-size: 26px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(34, 197, 94, 0.4), 0 0 0 8px rgba(34, 197, 94, 0.1);
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.fab:hover {
    transform: scale(1.15) rotate(5deg);
    box-shadow: 0 12px 32px rgba(34, 197, 94, 0.5), 0 0 0 12px rgba(34, 197, 94, 0.15);
}

.fab:active {
    transform: scale(1.05);
}

/* Stats Bar - Adjusted for right sidebar */
.stats-bar {
    position: absolute;
    top: 20px;
    right: 440px; /* Changed from left: 440px to right: 440px */
    background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
    padding: 16px 24px;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(34, 197, 94, 0.2);
    border: 2px solid #dcfce7;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 24px;
    font-size: 14px;
    backdrop-filter: blur(10px);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #374151;
    padding: 8px 12px;
    background: white;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
}

.stat-item i {
    color: #22c55e;
    font-size: 18px;
}

.stat-value {
    font-weight: 700;
    color: #15803d;
    font-size: 16px;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: #999;
}

.loading i {
    font-size: 40px;
    animation: spin 1s linear infinite;
    color: #22c55e;
}

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

.no-results {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.no-results i {
    font-size: 48px;
    margin-bottom: 15px;
    color: #ddd;
}

/* Custom Leaflet Popup */
.leaflet-popup-content-wrapper {
    border-radius: 12px;
}

.popup-content {
    min-width: 200px;
}

.popup-title {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 8px;
    color: #333;
}

.popup-address {
    font-size: 13px;
    color: #666;
    margin-bottom: 10px;
}

.popup-distance {
    font-size: 14px;
    color: #16a34a;
    font-weight: 700;
    padding: 6px 12px;
    background: #f0fdf4;
    border-radius: 8px;
    display: inline-block;
    margin-top: 8px;
}

.popup-certified-badge {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
}

.popup-non-certified-badge {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
}

.popup-btn-details {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    margin-top: 5px;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
    transition: all 0.3s;
}

.popup-btn-details:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}

.popup-actions {
    margin-top: 10px;
}

.km-label {
    font-size: 12px;
    color: #666;
}

.no-results-hint {
    font-size: 12px;
    margin-top: 10px;
}

.details-panel-type {
    color: #666;
    font-size: 13px;
    margin: 5px 0;
}

/* Distance Badge */
.distance-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    padding: 5px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
}

/* Details Panel */
.details-panel {
    position: absolute;
    bottom: 20px;
    left: 20px; /* Changed from right: 20px to left: 20px */
    z-index: 1000;
    display: none;
    animation: slideUp 0.3s ease-out;
}

.details-panel.active {
    display: block;
}

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

.details-panel-content {
    padding: 25px;
    background: linear-gradient(to bottom, #ffffff 0%, #f0fdf4 100%);
    border-radius: 16px;
    max-width: 420px;
    margin: 20px;
    box-shadow: 0 8px 32px rgba(34, 197, 94, 0.25);
    border: 2px solid #dcfce7;
}

.details-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.details-panel-title {
    margin: 0;
    color: #333;
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.details-panel-close {
    background: none;
    border: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
}

.details-panel-description {
    margin-bottom: 15px;
}

.details-panel-description p {
    color: #666;
    font-size: 14px;
    line-height: 1.6;
}

.details-panel-address {
    margin-bottom: 15px;
    padding: 14px;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-radius: 10px;
    border: 1px solid #a7f3d0;
}

.details-panel-address p {
    margin: 0;
    color: #333;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.details-panel-distance {
    margin: 8px 0 0 0;
    color: #16a34a;
    font-size: 14px;
    font-weight: 700;
}

.details-panel-contact {
    margin-bottom: 15px;
}

.details-panel-contact strong {
    color: #333;
    font-size: 14px;
    display: block;
    margin-bottom: 8px;
}

.details-panel-contact p {
    margin: 5px 0;
    color: #666;
    font-size: 13px;
}

.details-panel-contact i {
    color: #22c55e;
}

.details-panel-buttons {
    display: flex;
    gap: 8px;
    margin-top: 15px;
}

.btn-get-directions {
    flex: 1;
    padding: 12px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 50%, #15803d 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
    transition: all 0.3s;
}

.btn-get-directions:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(34, 197, 94, 0.4);
}

.btn-close-panel {
    padding: 12px 20px;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    color: #15803d;
    border: 2px solid #a7f3d0;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-close-panel:hover {
    background: linear-gradient(135deg, #dcfce7 0%, #d1fae5 100%);
    transform: translateY(-1px);
}

.details-panel-footer {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid #dcfce7;
}

.details-panel-footer p {
    font-size: 11px;
    color: #999;
    text-align: center;
    margin: 0;
}

.details-panel-footer a {
    color: #22c55e;
    text-decoration: none;
    font-weight: 600;
}

.details-panel-footer a:hover {
    color: #16a34a;
    text-decoration: underline;
}

.details-certified-badge {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(34, 197, 94, 0.3);
}

.details-non-certified-badge {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Custom Halal Marker Styles */
.custom-halal-marker {
    position: relative;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: absolute;
        top: 0;
        right: -100%; /* Changed from left: -100% to right: -100% */
        height: 100%;
        transition: right 0.3s; /* Changed from left to right */
        z-index: 2000;
    }
    
    .sidebar.active {
        right: 0; /* Changed from left: 0 to right: 0 */
    }
    
    .stats-bar {
        right: 20px;
        left: 20px;
        top: 80px;
        flex-wrap: wrap;
    }
    
    .main-container {
        flex-direction: row; /* Reset for mobile */
    }
}
