/* explore.css - Updated with Boxicons and Mobile Optimizations */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.explore-container {
    max-width: 1400px;
    margin: 0 auto;
    padding-left: calc(260px + 20px); /* Sidebar width + padding */
    padding-right: 20px;
    min-height: 100vh;
}

/* Header */
.explore-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 0;
    border-radius: 20px;
    margin: 20px 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.search-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.search-box {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 50px;
    padding: 8px 20px;
    width: 70%;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: relative;
}

.search-box i {
    color: #667eea;
    margin-right: 10px;
}

.search-box input {
    flex: 1;
    border: none;
    padding: 10px;
    font-size: 16px;
    outline: none;
    background: transparent;
    z-index: 2;
}

.search-box select {
    border: none;
    padding: 10px;
    margin-right: 10px;
    border-radius: 20px;
    background: #f5f5f5;
    cursor: pointer;
    z-index: 2;
}

.search-box button {
    background: #667eea;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 2;
}

.search-box button:hover {
    background: #5a67d8;
}

.suggestions-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    margin-top: 5px;
}

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

.suggestion-item:hover {
    background: #f7fafc;
}

.suggestion-item h4 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #2d3748;
    margin-bottom: 5px;
}

.suggestion-product .product-company,
.suggestion-company .company-code {
    color: #718096;
    font-size: 13px;
    margin-bottom: 5px;
}

.suggestion-item .product-distance,
.suggestion-item .company-distance {
    color: #48bb78;
    font-size: 12px;
    font-weight: 600;
}

.user-location {
    display: flex;
    align-items: center;
    font-size: 14px;
    background: rgba(255,255,255,0.2);
    padding: 8px 15px;
    border-radius: 20px;
}

.user-location i {
    margin-right: 8px;
}

/* Main Content */
.main-content {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
}

/* Explore Sidebar */
.explore-filters {
    width: 300px;
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.category-filter,
.search-results {
    margin-bottom: 25px;
}

.category-toggle,
.search-results h3 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 15px;
    color: #4a5568;
    font-size: 16px;
}

.category-toggle {
    width: 100%;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

.category-toggle span {
    display: flex;
    align-items: center;
    gap: 10px;
}

.category-toggle i.bx-chevron-down {
    transition: transform 0.2s ease;
    display: none;
}

.category-filter.open .category-toggle i.bx-chevron-down {
    transform: rotate(180deg);
}

.category-options {
    display: none;
    flex-direction: column;
    gap: 10px;
}

.category-filter.open .category-options {
    display: flex;
}

.category-option {
    display: block;
    cursor: pointer;
    position: relative;
}

.category-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.category-pill {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 2px solid #e2e8f0;
    background: #fff;
    color: #4a5568;
    font-weight: 600;
    transition: all 0.2s ease;
}

.category-pill i {
    font-size: 1.2rem;
    color: #94a3b8;
}

.category-option input:checked + .category-pill {
    background: #4361ee;
    border-color: #4361ee;
    color: #fff;
    box-shadow: 0 6px 14px rgba(67, 97, 238, 0.18);
}

.category-option input:checked + .category-pill i {
    color: #fff;
}

.category-pill:hover {
    border-color: #4361ee;
}

/* Map Area */
.map-area {
    flex: 1;
    position: relative;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    height: 400px; /* Reduced height for mobile */
    min-height: 260px;
}

#map {
    width: 100%;
    height: 100%;
    border-radius: 15px;
    min-height: 260px;
}

.map-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
}

.map-controls button {
    width: 40px;
    height: 40px;
    background: white;
    border: none;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4a5568;
    transition: all 0.3s;
}

.map-controls button:hover {
    background: #667eea;
    color: white;
}

/* Companies Section */
.companies-section {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #4a5568;
}

.sort-options select {
    padding: 8px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    cursor: pointer;
}

/* Company Cards */
#companies-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.company-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    transition: transform 0.3s, box-shadow 0.3s;
    border: 1px solid #e2e8f0;
}

.company-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.company-card-header {
    display: flex;
    align-items: flex-start;
    margin-bottom: 15px;
}

.company-logo-container {
    position: relative;
    width: 50px;
    height: 50px;
    min-width: 50px;
    margin-right: 15px;
    border-radius: 10px;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.company-logo-container .company-initials {
    font-size: 18px;
    font-weight: 600;
    color: white;
    z-index: 1;
    position: relative;
}

.company-logo-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 2;
    display: none;
}

.company-info {
    flex: 1;
}

.company-info h3 {
    margin-bottom: 5px;
    color: #2d3748;
}

.company-code {
    color: #718096;
    font-size: 14px;
    margin-bottom: 5px;
}

.company-category-text {
    color: #667eea;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.company-distance {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #48bb78;
    font-weight: 600;
}

.company-card-body {
    margin-bottom: 15px;
}

.company-bio {
    color: #718096;
    font-size: 14px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.company-card-footer {
    display: flex;
    gap: 10px;
}

.company-card-footer button {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
}

.view-company-btn {
    background: #667eea;
    color: white;
}

.view-company-btn:hover {
    background: #5a67d8;
}

.directions-btn {
    background: #edf2f7;
    color: #4a5568;
}

.directions-btn:hover {
    background: #e2e8f0;
}

/* Search Results */
.search-results {
    max-height: 300px;
    overflow-y: auto;
}

.result-item {
    padding: 12px;
    border-bottom: 1px solid #e2e8f0;
    transition: background 0.3s;
}

.result-item:hover {
    background: #f7fafc;
}

.result-item h4 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #2d3748;
    margin-bottom: 5px;
}

.product-company,
.company-code {
    color: #718096;
    font-size: 13px;
    margin-bottom: 5px;
}

.product-price {
    color: #48bb78;
    font-weight: 600;
    margin-bottom: 5px;
}

.product-distance,
.company-distance {
    color: #718096;
    font-size: 12px;
    margin-bottom: 10px;
}

.result-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Loading */
.loading {
    text-align: center;
    padding: 20px;
    color: #718096;
    display: none;
}

.loading i {
    margin-right: 10px;
    color: #667eea;
}

/* Map Markers */
.user-marker-icon {
    background: #667eea;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.company-marker .marker-icon {
    background: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #667eea;
    border: 3px solid #667eea;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

/* Map Popup */
.map-popup {
    min-width: 200px;
}

.map-popup h3 {
    margin-bottom: 10px;
    color: #2d3748;
}

.map-popup p {
    margin-bottom: 5px;
    color: #718096;
    font-size: 14px;
}

.popup-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    width: 100%;
    margin-top: 10px;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .explore-container {
        padding-left: 20px;
        padding-top: 56px;
    }
    
    .explore-header {
        margin: 0 0 15px 0;
    }
    
    .main-content {
        flex-direction: column;
    }
    
    .explore-filters {
        width: 100%;
        order: 2;
    }
    
    .map-area {
        order: 1;
        height: 350px; /* Further reduced for tablets */
    }
    
    .search-container {
        flex-direction: column;
        gap: 15px;
    }
    
    .search-box {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .category-toggle i.bx-chevron-down {
        display: inline-flex;
    }
    #companies-list {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
    
    .map-area {
        height: 320px; /* Reduced for mobile */
        min-height: 320px;
    }

    #map {
        min-height: 320px;
    }
    
    /* Prevent map from capturing scroll */
    .map-area:active {
        cursor: grab;
    }
    
    .map-area:active #map {
        pointer-events: none;
    }
}

@media (max-width: 480px) {
    #companies-list {
        grid-template-columns: 1fr;
    }
    
    .map-area {
        height: 250px; /* Minimum height for mobile */
    }
    
    .company-card-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .company-distance {
        margin-top: 10px;
    }
}

/* Mobile touch improvements */
@media (hover: none) and (pointer: coarse) {
    .map-controls button {
        width: 48px;
        height: 48px;
        font-size: 18px;
    }
    
    .company-card-footer button {
        padding: 12px;
        font-size: 14px;
    }
}

html[data-theme='dark'] body {
    background: #0b1220;
    color: #e2e8f0;
}

html[data-theme='dark'] .explore-header {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    box-shadow: 0 8px 24px rgba(2, 6, 23, 0.52);
}

html[data-theme='dark'] .search-box,
html[data-theme='dark'] .explore-filters,
html[data-theme='dark'] .companies-section,
html[data-theme='dark'] .company-card,
html[data-theme='dark'] .suggestions-dropdown,
html[data-theme='dark'] .sort-options select,
html[data-theme='dark'] .map-controls button {
    background: #111827;
    border-color: #334155;
    color: #e2e8f0;
    box-shadow: 0 10px 26px rgba(2, 6, 23, 0.44);
}

html[data-theme='dark'] .search-box i,
html[data-theme='dark'] .section-header h2,
html[data-theme='dark'] .category-toggle,
html[data-theme='dark'] .company-info h3,
html[data-theme='dark'] .map-popup h3,
html[data-theme='dark'] .result-item h4 {
    color: #f8fafc;
}

html[data-theme='dark'] .search-box input,
html[data-theme='dark'] .search-box select {
    color: #e2e8f0;
    background: #0f172a;
}

html[data-theme='dark'] .search-box select {
    border: 1px solid #334155;
}

html[data-theme='dark'] .search-box input::placeholder {
    color: #94a3b8;
}

html[data-theme='dark'] .user-location {
    background: rgba(148, 163, 184, 0.2);
    color: #cbd5e1;
}

html[data-theme='dark'] .category-pill {
    background: #111827;
    border-color: #334155;
    color: #cbd5e1;
}

html[data-theme='dark'] .category-pill i {
    color: #93c5fd;
}

html[data-theme='dark'] .category-option input:checked + .category-pill {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.34);
}

html[data-theme='dark'] .category-option input:checked + .category-pill i {
    color: #ffffff;
}

html[data-theme='dark'] .category-pill:hover {
    border-color: #60a5fa;
}

html[data-theme='dark'] .suggestion-item,
html[data-theme='dark'] .result-item {
    border-bottom-color: #334155;
}

html[data-theme='dark'] .suggestion-item:hover,
html[data-theme='dark'] .result-item:hover {
    background: #1e293b;
}

html[data-theme='dark'] .suggestion-product .product-company,
html[data-theme='dark'] .suggestion-company .company-code,
html[data-theme='dark'] .company-code,
html[data-theme='dark'] .company-bio,
html[data-theme='dark'] .company-distance,
html[data-theme='dark'] .product-company,
html[data-theme='dark'] .product-distance,
html[data-theme='dark'] .result-item .company-distance,
html[data-theme='dark'] .loading,
html[data-theme='dark'] .map-popup p {
    color: #94a3b8;
}

html[data-theme='dark'] .company-category-text,
html[data-theme='dark'] .loading i,
html[data-theme='dark'] .suggestion-item .product-distance,
html[data-theme='dark'] .suggestion-item .company-distance,
html[data-theme='dark'] .product-price {
    color: #93c5fd;
}

html[data-theme='dark'] .company-card {
    border-color: #334155;
}

html[data-theme='dark'] .company-card:hover {
    border-color: #60a5fa;
    box-shadow: 0 12px 28px rgba(2, 6, 23, 0.58);
}

html[data-theme='dark'] .directions-btn {
    background: #1e293b;
    color: #cbd5e1;
}

html[data-theme='dark'] .directions-btn:hover {
    background: #334155;
    color: #f8fafc;
}

html[data-theme='dark'] .map-controls button:hover {
    background: #2563eb;
    color: #ffffff;
}

html[data-theme='dark'] .user-marker-icon {
    border-color: #0f172a;
}

html[data-theme='dark'] .company-marker .marker-icon {
    background: #0f172a;
    color: #93c5fd;
    border-color: #60a5fa;
}

html[data-theme='dark'] .popup-btn,
html[data-theme='dark'] .result-btn,
html[data-theme='dark'] .view-company-btn,
html[data-theme='dark'] .search-box button {
    background: #2563eb;
    color: #ffffff;
}

html[data-theme='dark'] .popup-btn:hover,
html[data-theme='dark'] .result-btn:hover,
html[data-theme='dark'] .view-company-btn:hover,
html[data-theme='dark'] .search-box button:hover {
    background: #1d4ed8;
}

html[data-theme='dark'] .leaflet-popup-content-wrapper,
html[data-theme='dark'] .leaflet-popup-tip {
    background: #111827;
    color: #e2e8f0;
}