/* Dealer Page Styles - Simple and Direct */
.dealer-container {
    background-color: #f8f9fa;
    min-height: auto; /* Change from 100vh to auto */
    padding: 5px 0 20px 0; /* Reduce top padding from 20px to 5px */
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100vw !important;
    margin-bottom: 0 !important; /* Remove bottom margin */
}

/* Container with fixed height for 3 dealers + scroll for more */
.dealer-sidebar-container {
    height: auto !important;
    max-height: none !important;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 0;
    overflow: visible !important;
    display: flex;
    flex-direction: column;
    box-sizing: border-box !important;
    min-height: 500px; /* Reduced to accommodate pagination */
}

.dealer-info-header {
    flex-shrink: 0;
    padding: 20px 20px 0 20px;
    max-height: 100px;
    overflow: hidden;
}

.dealer-info-header .alert {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border: none;
    border-radius: 12px;
    margin: 0;
}

.dealer-list-content {
    flex: 1;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 15px 20px 10px 20px;
    min-height: 0;
    max-height: 450px; /* Reduced to leave space for pagination */
}

/* Optimized for 10 dealers per page - show 3, scroll for more */
.dealer-list-content .dealer-item {
    margin-bottom: 10px;
}

.dealer-list-content .dealer-item:last-child {
    margin-bottom: 0;
}

.dealer-list-content::-webkit-scrollbar {
    width: 6px;
}

.dealer-list-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.dealer-list-content::-webkit-scrollbar-thumb {
    background: #dc3545;
    border-radius: 3px;
}

.dealer-list-content::-webkit-scrollbar-thumb:hover {
    background: #c82333;
}

/* Smooth scrolling */
.dealer-list-content {
    scroll-behavior: smooth;
}

.dealer-pagination-footer {
    background: white;
    padding: 8px 20px;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
    margin-top: 8px;
    margin-bottom: 0; /* Remove bottom margin */
    height: 50px; /* Fixed height for pagination */
    display: flex;
    align-items: center;
}

/* Custom pagination styling for dealer page */
.dealer-pagination-footer .pagination {
    margin: 0;
    justify-content: center;
    gap: 4px;
}

.dealer-pagination-footer .page-item {
    margin: 0;
}

.dealer-pagination-footer .page-link {
    border: 1px solid #dee2e6;
    color: #6c757d;
    padding: 6px 10px;
    font-size: 0.875rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-weight: 500;
    min-width: 36px;
    text-align: center;
    line-height: 1.2;
}

.dealer-pagination-footer .page-link:hover {
    background-color: #fff5f5;
    border-color: #dc3545;
    color: #dc3545;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.2);
}

.dealer-pagination-footer .page-item.active .page-link {
    background-color: #dc3545;
    border-color: #dc3545;
    color: white;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

.dealer-pagination-footer .page-item.disabled .page-link {
    color: #adb5bd;
    background-color: #f8f9fa;
    border-color: #dee2e6;
    opacity: 0.6;
    cursor: not-allowed;
}

.dealer-pagination-footer .page-link.text-basic {
    color: #dc3545;
    font-weight: 600;
}

.dealer-pagination-footer .page-link.btn-basic {
    background-color: #dc3545;
    border-color: #dc3545;
    color: white;
    font-weight: 600;
}

/* Previous/Next button styling */
.dealer-pagination-footer .page-item:first-child .page-link,
.dealer-pagination-footer .page-item:last-child .page-link {
    font-weight: 600;
    padding: 6px 12px;
}

.dealer-pagination-footer .page-item:first-child .page-link:hover,
.dealer-pagination-footer .page-item:last-child .page-link:hover {
    background: linear-gradient(45deg, #dc3545, #e74c3c);
    color: white;
    border-color: #dc3545;
}

.map-section-container {
    height: auto;
    min-height: 550px; /* Adjusted for 500px map */
    overflow: hidden !important;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 20px;
}

.map-container {
    height: 100%;
    overflow: hidden !important;
    border-radius: 8px;
}

#map {
    height: 500px !important; /* Set to 500px */
    min-height: 500px !important;
    max-height: 500px !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
}

.dealer-item {
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
}

.dealer-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    border-color: #dc3545;
}

.dealer-item.selected {
    border: 2px solid #dc3545 !important;
    background-color: #fff5f5;
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.2);
}

.dealer-item .card-title {
    color: #dc3545;
    font-weight: 600;
    font-size: 1rem;
}

.dealer-item .card-text {
    color: #6c757d;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Force all child elements to stay within container */
.dealer-sidebar-container * {
    box-sizing: border-box !important;
}

.dealer-item {
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 12px;
    background: white;
    flex-shrink: 0;
}

.dealer-item .card-body {
    padding: 15px !important;
}

.dealer-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    border-color: #dc3545;
}

.dealer-item.selected {
    border: 2px solid #dc3545 !important;
    background-color: #fff5f5;
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.2);
}

.dealer-item .card-title {
    color: #dc3545;
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 8px !important;
}

.dealer-item .card-text {
    color: #6c757d;
    font-size: 0.85rem;
    line-height: 1.4;
    margin-bottom: 4px !important;
}

.dealer-item .btn {
    font-size: 0.8rem;
    padding: 6px 12px;
}

.search-card {
    border: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    margin-bottom: 20px;
}

.map-controls {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 15px;
}

.btn-group .btn {
    border-radius: 0;
    border-color: #dee2e6;
}

.btn-group .btn:first-child {
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
}

.btn-group .btn:last-child {
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
}

.btn-group .btn.active {
    background-color: #dc3545;
    border-color: #dc3545;
    color: white;
    box-shadow: none;
}

.map-controls {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-group .btn {
    border-radius: 0;
    border-color: #dee2e6;
}

.btn-group .btn:first-child {
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
}

.btn-group .btn:last-child {
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
}

.btn-group .btn.active {
    background-color: #dc3545;
    border-color: #dc3545;
    color: white;
    box-shadow: none;
}

.btn-danger {
    background-color: #dc3545;
    border-color: #dc3545;
    font-weight: 500;
}

.btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

.btn-outline-success:hover {
    background-color: #28a745;
    border-color: #28a745;
}

.dealer-info-badge {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 0.8rem;
    color: #6c757d;
}

.no-dealers {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.no-dealers i {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

/* Responsive Design */
@media (max-width: 768px) {
    .dealer-container {
        padding: 10px 0;
    }
    
    .dealer-sidebar-container,
    .map-section-container {
        height: auto;
        min-height: 450px; /* Mobile height match */
        margin-bottom: 0; /* Remove bottom margin */
    }
    
    .dealer-container .container-fluid {
        padding: 0 10px !important;
    }
    
    .dealer-list-content {
        margin: 0 -5px;
        padding: 10px 5px 5px 5px;
        height: auto;
        max-height: 400px; /* Mobile scroll height */
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }
    
    #map {
        height: 400px !important; /* Mobile map height adjusted */
    }
    
    /* Mobile pagination styling */
    .dealer-pagination-footer {
        padding: 6px 15px !important;
        margin-top: 8px !important;
        margin-bottom: 0 !important; /* Remove bottom margin */
    }
    
    .dealer-pagination-footer .page-link {
        padding: 4px 6px;
        font-size: 0.8rem;
        min-width: 32px;
    }
    
    .dealer-pagination-footer .pagination {
        flex-wrap: wrap;
        justify-content: center;
        gap: 2px;
    }
}

/* Animation untuk loading */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #dc3545;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Simple Map Styles */
.simple-map-container {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
}

.map-header {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%) !important;
}

.map-content {
    background-color: #f8f9fa !important;
}

.map-dealer-card {
    transition: all 0.3s ease;
    border: 1px solid #dee2e6;
}

.map-dealer-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.map-dealer-card.border-danger {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.map-dealer-card .card-title {
    font-size: 1rem;
    font-weight: 600;
}

.map-dealer-card .btn {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
}

/* Custom Info Window Styles */
.gm-style .gm-style-iw-c {
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.gm-style .gm-style-iw-d {
    overflow: hidden !important;
}

/* Marker cluster styles */
.cluster {
    background: #dc3545;
    border-radius: 50%;
    color: white;
    font-weight: bold;
    text-align: center;
    font-size: 12px;
    line-height: 40px;
    width: 40px;
    height: 40px;
}