/* Basic style settings */
html, body { margin: 0; padding: 0; height: 100%; }
#map { width: 100%; height: 100%; }

/* Common panel style */
.panel { 
    position: absolute; 
    z-index: 1000;
    background: white;
    padding: 10px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0,0,0,0.2);
}

/* Right-side control panel */
.control-panel { top: 10px; right: 10px; max-width: 250px; }

/* Dropdown menu and button style */
.vehicle-select, .refresh-button { 
    width: 100%;
    margin: 5px 0;
    padding: 5px;
}

/* Refresh button style */
.refresh-button {
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

/* Disabled button style */
.refresh-button:disabled { 
    background: #ccc;
    cursor: not-allowed;
}

/* Status tag style */
.status-tag {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
    margin-left: 5px;
}

.status-moving { background: #4CAF50; color: white; }
.status-stopped { background: #f44336; color: white; }
.status-idle { background: #ff9800; color: white; }

/* Add battery style */
.battery-indicator {
    display: inline-block;
    width: 40px;
    height: 15px;
    border: 1px solid #333;
    position: relative;
    margin-left: 5px;
    border-radius: 2px;
}

.battery-level {
    height: 100%;
    background: linear-gradient(to right, #f44336 0%, #ff9800 30%, #4CAF50 70%);
}

.battery-tip {
    position: absolute;
    top: 0;
    right: -4px;
    width: 3px;
    height: 7px;
    margin-top: 4px;
    background: #333;
    border-radius: 0 2px 2px 0;
}

.battery-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    text-align: center;
    font-size: 10px;
    color: white;
    mix-blend-mode: difference;
}

/* Add nearby scooter style */
.nearby-info {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 10px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0,0,0,0.2);
    z-index: 1000;
    max-width: 80%;
    display: none;
}

.nearby-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 14px;
}

.nearby-table th, .nearby-table td {
    padding: 5px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.nearby-table th {
    background-color: #f2f2f2;
}

.nearby-scooter {
    cursor: pointer;
}

.available-scooter {
    color: green;
}

.low-battery-scooter {
    color: orange;
}

/* Add scooter marker style */
.available-marker {
    border: 2px solid #4CAF50;
    border-radius: 50%;
    text-align: center;
    color: white;
    font-weight: bold;
    background: #4CAF50;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nearby-marker {
    border: 3px solid #9C27B0;
    background: rgba(156, 39, 176, 0.7);
    z-index: 1000 !important;
}

/* Modify scooter marker style */
.scooter-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0px 2px 3px rgba(0,0,0,0.3));
}

.scooter-marker svg {
    width: 100%;
    height: 100%;
}

.nearby-marker {
    filter: drop-shadow(0px 0px 5px #9C27B0);
    z-index: 1000 !important;
}

/* Add hover tooltip style */
.scooter-tooltip {
    font-size: 13px;
    color: #333;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.scooter-tooltip h4 {
    margin: 0 0 10px 0 !important;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
    font-size: 16px;
}

.scooter-tooltip p {
    margin: 6px 0 !important;
}

.scooter-tooltip .navigate-btn,
.scooter-tooltip .reserve-btn,
.scooter-tooltip .cancel-btn {
    margin-top: 8px;
    display: inline-block;
}

.loading-indicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 18px;
    z-index: 2100;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top: 5px solid white;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

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

.loading-tips {
    font-size: 14px;
    margin-top: 10px;
    max-width: 80%;
    text-align: center;
    color: #ccc;
}

/* Add animation effect to nearby markers */
@keyframes pulse {
    0% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.3); opacity: 0.5; }
    100% { transform: scale(1); opacity: 0.7; }
}

.pulse-animation {
    animation: pulse 2s infinite;
    transform-origin: center center;
}

/* Ensure pulsing circle is behind the marker, not blocking clicks */
.leaflet-marker-pane {
    z-index: 600;
}

/* User location popup style */
.user-location-popup {
    font-weight: bold;
    color: #2196F3;
}

/* Reserved status style */
.reserved-marker {
    border: 3px solid #E91E63 !important;
    background: rgba(233, 30, 99, 0.7) !important;
}

.reservation-status {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(233, 30, 99, 0.9);
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    z-index: 1000;
    text-align: center;
    display: none;
    min-width: 300px;
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    transition: all 0.3s ease; /* Add transition effect */
}

.reservation-status h4 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 18px;
}

.timer-container {
    text-align: center;
    margin: 10px 0;
}

.timer-label {
    font-size: 12px;
    opacity: 0.8;
    margin-bottom: 2px;
}

.timer {
    font-weight: bold;
    font-size: 24px;
    margin: 5px 0;
    font-family: monospace;
}

.pulse {
    animation: pulse 1s infinite;
}

#reservedScooterInfo {
    margin-bottom: 15px;
    line-height: 1.5;
}

.reservation-actions {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.reserve-btn, .cancel-btn, .navigate-btn {
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    flex: 1;
}

.reserve-btn {
    background: #2196F3 !important;
    color: white !important;
    border: none !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    padding: 8px 15px !important;
    font-size: 14px !important;
    transition: all 0.2s !important;
    z-index: 1001 !important;
    pointer-events: auto !important;
}

.reserve-btn:hover {
    background: #0b7dda !important;
    transform: translateY(-2px) !important;
}

.cancel-btn {
    background: #f44336;
    color: white;
}

.navigate-btn {
    background: #4CAF50;
    color: white;
}

.reserve-btn:hover, .navigate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.cancel-btn:hover {
    background: #d32f2f;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Reservation action button styles */
.reserve-btn, .cancel-btn, .navigate-btn, .start-btn, .complete-btn {
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    flex: 1;
}

.start-btn {
    background: #4CAF50;
    color: white;
    font-weight: bold;
}

.complete-btn {
    background: #FF9800;
    color: white;
    font-weight: bold;
}

.start-btn:hover, .complete-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Booking notification style */
.reservation-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    max-width: 350px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    z-index: 1000;
    overflow: hidden;
    opacity: 1;
    transition: opacity 0.5s, transform 0.3s;
    transform: translateY(0);
}

.reservation-notification.success {
    border-top: 5px solid #4caf50;
}

.reservation-notification.error {
    border-top: 5px solid #f44336;
}

.notification-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
}

.notification-header h3 {
    margin: 0;
    color: #333;
    font-size: 18px;
}

.close-notify {
    background: none;
    border: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    padding: 0;
    margin: 0;
}

.notification-body {
    padding: 15px;
}

.notification-body p {
    margin: 0;
    color: #555;
    line-height: 1.5;
}

.notification-btn {
    width: 100%;
    padding: 10px;
    background: #f5f5f5;
    border: none;
    border-top: 1px solid #eee;
    color: #333;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.notification-btn:hover {
    background: #e9e9e9;
}

.fade-out {
    opacity: 0;
    transform: translateY(-20px);
}

/* Modify popup styles to remove extra borders */
.leaflet-popup-content-wrapper {
    background: white !important;
    box-shadow: 0 3px 14px rgba(0,0,0,0.4) !important;
    border-radius: 12px !important;
    padding: 1px !important; /* Key change: minimal padding */
    transition: box-shadow 0.3s ease;
}

.leaflet-popup-content-wrapper:hover {
    box-shadow: 0 5px 20px rgba(0,0,0,0.5) !important;
}

.leaflet-popup-tip-container {
    display: block !important;
}

.leaflet-popup-content {
    margin: 13px 19px !important; /* Use Leaflet default padding */
    line-height: 1.4 !important;
    min-width: 210px !important;
    border-radius: 12px !important; /* Keep consistent rounded corners */
}

/* Ensure popup content is not blocked */
.leaflet-popup {
    z-index: 1000 !important;
    margin-bottom: 20px !important;
}

/* Display popup tip */
.leaflet-popup-tip {
    background: white !important;
    box-shadow: 0 3px 14px rgba(0,0,0,0.4) !important;
    width: 17px !important;
    height: 17px !important;
}

/* Ensure no borders */
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
    border: none !important;
}

/* Control close button position */
.leaflet-popup-close-button {
    top: 10px !important;
    right: 10px !important;
}

/* Ensure buttons display correctly on popup */
.leaflet-popup .navigate-btn,
.leaflet-popup .reserve-btn,
.leaflet-popup .cancel-btn {
    padding: 8px 15px !important;
    border: none !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    font-size: 14px !important;
    transition: all 0.2s !important;
    margin-top: 8px !important;
    display: inline-block !important;
}

/* Adjust reservation button style for consistency */
.leaflet-popup .reserve-btn {
    background: #2196F3 !important;
    color: white !important;
}

/* Booking modal style */
.booking-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.booking-modal-content {
    background: white;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    border-radius: 8px;
    overflow-y: auto;
}

.booking-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
}

.booking-modal-header h3 {
    margin: 0;
    color: #333;
}

.booking-close {
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
}

.booking-modal-body {
    padding: 20px;
}

.booking-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.date-selector {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.date-btn {
    background: #f5f5f5;
    border: 1px solid #ddd;
    padding: 10px 15px;
    margin: 0 5px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.date-btn:hover {
    background: #e0e0e0;
}

.date-btn.active {
    background: #4a90e2;
    color: white;
    border-color: #4a90e2;
}

.time-slots {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.time-slot {
    padding: 10px;
    background: #f0f0f0;
    border-radius: 4px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.time-slot:hover {
    background: #e0e0e0;
}

.time-slot.selected {
    background: #4a90e2;
    color: white;
}

.time-slot.unavailable {
    background: #ffdddd;
    color: #999;
    cursor: not-allowed;
    text-decoration: line-through;
}

.submit-btn {
    padding: 14px;
    background-color: #4a90e2;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.submit-btn:hover {
    background-color: #3a80d2;
}

.submit-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

.booking-summary {
    margin-top: 20px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 4px;
    border-left: 4px solid #4a90e2;
}

.vehicle-info {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #f0f7ff;
    border-radius: 5px;
}

.vehicle-image {
    width: 80px;
    height: 80px;
    background: #ddd;
    border-radius: 5px;
    margin-right: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.vehicle-details {
    flex: 1;
}

.vehicle-details h3 {
    margin: 0 0 5px 0;
    color: #333;
}

.vehicle-details p {
    margin: 0;
    color: #666;
}

/* Location permission prompt dialog style */
.permission-prompt {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    display: none; /* Default hidden */
}

.permission-prompt-content {
    background: white;
    padding: 25px;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.permission-prompt-content h3 {
    margin-top: 0;
    color: #333;
    font-size: 20px;
}

.permission-prompt-content p {
    color: #666;
    margin: 15px 0;
    line-height: 1.5;
}

.permission-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.permission-buttons button {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.2s;
}

.permission-buttons .allow-btn {
    background: #4CAF50;
    color: white;
}

.permission-buttons .allow-btn:hover {
    background: #3d8b40;
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.permission-buttons .deny-btn {
    background: #f5f5f5;
    color: #333;
}

.permission-buttons .deny-btn:hover {
    background: #e0e0e0;
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
