/* Mobile-optimized styles for SabMap */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

/* Map takes full screen */
#map {
    position: absolute;
    top: 56px; /* Height of navbar */
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

/* Navbar */
.navbar {
    z-index: 1000;
    height: 56px;
}

.navbar-brand {
    font-weight: bold;
    font-size: 1.1rem;
}

/* Center location button */
.map-control {
    position: absolute;
    bottom: 100px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    z-index: 1000;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

/* Zoom controls */
.zoom-controls {
    position: absolute;
    top: 70px;
    right: 10px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.zoom-btn {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    padding: 0;
    border: none;
}

/* Map Settings control */
.settings-control {
    position: absolute;
    top: 70px;
    right: 110px;
    z-index: 1000;
}

.settings-btn {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    padding: 0;
    border: none;
}

.settings-menu {
    position: absolute;
    top: 50px;
    right: 0;
    background: var(--bs-dark);
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    min-width: 220px;
    z-index: 1001;
}

.settings-menu-header {
    padding: 12px 15px;
    border-bottom: 1px solid var(--bs-border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.settings-menu-header h6 {
    margin: 0;
    font-size: 1rem;
}

.settings-menu-body {
    padding: 15px;
}

.settings-menu-body .form-check-label {
    font-size: 0.9rem;
    color: var(--bs-light);
}

/* Layer control */
.layer-control {
    position: absolute;
    top: 70px;
    right: 60px;
    z-index: 1000;
}

.layer-btn {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    padding: 0;
    border: none;
}

.layer-menu {
    position: absolute;
    top: 50px;
    right: 0;
    background: var(--bs-dark);
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    min-width: 180px;
    z-index: 1001;
}

.layer-menu-header {
    padding: 12px 15px;
    border-bottom: 1px solid var(--bs-border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.layer-menu-header h6 {
    margin: 0;
    font-size: 1rem;
}

.layer-menu-body {
    padding: 15px;
}

.layer-option.active {
    background-color: var(--bs-primary) !important;
    border-color: var(--bs-primary) !important;
    color: white !important;
}


/* Crosshair in center of map */
#crosshair {
    position: absolute;
    top: calc(50% + 30px);
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 999;
    pointer-events: none;
    color: #333;
    text-shadow: 0 0 4px white, 0 0 8px white;
}

/* Drop marker button */
.drop-marker-btn {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    padding: 10px 20px;
    font-size: 1rem;
}

/* Marker menu */
.marker-menu {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bs-dark);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    z-index: 1001;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.3);
    max-height: 70vh;
    overflow-y: auto;
}

.marker-menu-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--bs-border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.marker-menu-header h6 {
    margin: 0;
    font-size: 1.1rem;
}

.marker-menu-body {
    padding: 20px;
}

/* Locations menu */
.locations-menu {
    position: absolute;
    top: 70px;
    right: 10px;
    background: var(--bs-dark);
    border-radius: 10px;
    z-index: 1001;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    min-width: 250px;
    max-width: 350px;
    max-height: 70vh;
    overflow-y: auto;
}

.locations-menu-header {
    padding: 15px;
    border-bottom: 1px solid var(--bs-border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: var(--bs-dark);
}

.locations-menu-header h6 {
    margin: 0;
    font-size: 1rem;
}

.locations-menu-body {
    padding: 15px;
}

.location-item {
    padding: 8px 12px;
    margin-bottom: 5px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.location-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.location-item i {
    width: 20px;
    text-align: center;
}


/* User location marker */
.user-location-marker {
    background: transparent;
    border: none;
}

.user-location-dot {
    width: 30px;
    height: 30px;
    background: #007bff;
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 0 0 10px rgba(0, 123, 255, 0.2);
    animation: userPulse 2s infinite;
}

/* Pulse animations */
@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes userPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 123, 255, 0.4);
    }
    70% {
        box-shadow: 0 0 0 20px rgba(0, 123, 255, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 123, 255, 0);
    }
}

/* Custom marker styles */
.custom-marker {
    background: transparent;
    border: none;
}

.live-marker {
    background: transparent;
    border: none;
}

/* Mobile-specific optimizations */
@media (max-width: 768px) {
    .navbar-brand {
        font-size: 1rem;
    }
    
    /* Make navbar buttons more compact on mobile */
    .navbar .btn-sm {
        padding: 0.35rem 0.45rem;
        font-size: 0.875rem;
        min-width: auto;
        min-height: auto;
    }
    
    /* Reduce button margins on mobile */
    .navbar .btn-sm.me-2 {
        margin-right: 0.25rem !important;
    }
    
    /* Adjust navbar content spacing */
    .navbar .d-flex {
        gap: 0.25rem;
    }
    
    /* Hide session indicator on very small screens */
    #sessionIndicator {
        display: none !important;
    }
    
    .map-control {
        bottom: 90px;
        right: 15px;
        width: 45px;
        height: 45px;
    }
    
    .drop-marker-btn {
        bottom: 20px;
        padding: 8px 16px;
        font-size: 0.9rem;
    }
    
    .marker-menu-body .btn {
        padding: 10px;
        font-size: 0.9rem;
    }
}

/* Even smaller mobile screens (below 400px) */
@media (max-width: 400px) {
    /* Further reduce navbar button sizes */
    .navbar .btn-sm {
        padding: 0.3rem 0.4rem;
        font-size: 0.8rem;
    }
    
    /* Make navbar brand smaller */
    .navbar-brand {
        font-size: 0.9rem;
    }
    
    /* Hide brand icon on very small screens to save space */
    .navbar-brand i {
        display: none;
    }
}

/* Prevent text selection on mobile */
* {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Allow text selection in inputs */
input, textarea {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Improve touch targets for mobile - but not for navbar buttons */
.btn:not(.navbar .btn) {
    min-height: 44px;
    min-width: 44px;
}

/* Smooth transitions */
.map-control,
.drop-marker-btn,
.marker-menu,
.options-menu {
    transition: all 0.3s ease;
}

/* Hide default Leaflet zoom controls - we're using custom ones */
.leaflet-control-zoom {
    display: none;
}

/* Ensure popups are readable on mobile */
.leaflet-popup-content {
    font-size: 14px;
    min-width: 150px;
}

/* Fix for iOS Safari */
body {
    -webkit-overflow-scrolling: touch;
}

/* Prevent bounce scrolling on iOS */
#map {
    position: fixed;
}

/* Button active states for better mobile feedback */
.btn:active {
    transform: scale(0.95);
}

/* Glowing green animation for active location sharing */
@keyframes glowGreen {
    0% {
        box-shadow: 0 0 5px rgba(40, 167, 69, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(40, 167, 69, 0.8), 0 0 30px rgba(40, 167, 69, 0.6);
    }
    100% {
        box-shadow: 0 0 5px rgba(40, 167, 69, 0.5);
    }
}

.sharing-active {
    background-color: #28a745 !important;
    border-color: #28a745 !important;
    animation: glowGreen 2s infinite;
}

.sharing-active:hover {
    background-color: #218838 !important;
    border-color: #1e7e34 !important;
}