* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    height: 100vh;
    overflow: hidden;
    background-color: #f8f9fa;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(5px);
}

.loading-overlay p {
    color: #6c757d;
    font-weight: 500;
}

.logo-container {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    border-radius: 16px;
    padding: 12px 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(0, 0, 0, 0.08);
    z-index: 999;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 200px;
}

.logo-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s ease;
}

.logo-container:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(0, 123, 255, 0.2);
}

.logo-container:hover::before {
    left: 100%;
}

.logo-container:active {
    transform: translateY(0) scale(0.98);
    transition-duration: 0.1s;
}

.logo-banner,
.logo-red {
    height: 32px;
    width: auto;
    object-fit: contain;
    transition: all 0.3s ease;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.1));
}

.logo-red {
    display: none;
}

.logo-container:hover .logo-banner {
    display: none;
}

.logo-container:hover .logo-red {
    display: block;
    animation: logoSwap 0.3s ease;
}

@keyframes logoSwap {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@media (max-width: 768px) {
    .logo-container {
        bottom: 15px;
        left: 15px;
        padding: 10px 12px;
        border-radius: 12px;
        max-width: 160px;
        gap: 6px;
    }

    .logo-banner,
    .logo-red {
        height: 28px;
    }
}

@media (max-width: 576px) {
    .logo-container {
        bottom: 10px;
        left: 10px;
        padding: 8px 10px;
        border-radius: 10px;
        max-width: 140px;
        gap: 4px;
    }

    .logo-banner,
    .logo-red {
        height: 24px;
    }
}

@media (max-width: 480px) {
    .logo-container {
        bottom: 8px;
        left: 8px;
        padding: 6px 8px;
        border-radius: 8px;
        max-width: 120px;
    }

    .logo-banner,
    .logo-red {
        height: 20px;
    }
}

@media (prefers-color-scheme: dark) {
    .logo-container {
        background: rgba(33, 37, 41, 0.95);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .logo-container:hover {
        background: rgba(33, 37, 41, 0.98);
        border-color: rgba(0, 123, 255, 0.3);
    }

    .logo-banner,
    .logo-red {
        filter: drop-shadow(0 1px 3px rgba(255, 255, 255, 0.1));
    }
}

@media (prefers-reduced-motion: reduce) {

    .logo-container,
    .logo-banner,
    .logo-red {
        transition: none;
        animation: none;
    }

    .logo-container:hover .logo-banner {
        display: block;
    }

    .logo-container:hover .logo-red {
        display: none;
    }
}


.map-container {
    position: relative;
    width: 100%;
    height: 100vh;
}

.map {
    width: 100%;
    height: 100%;
    border: none;
    outline: none;
}

.legend-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.1);
    min-width: 250px;
    z-index: 1000;
    transition: all 0.3s ease;
}

.legend-panel.hidden {
    display: none !important;
}


.legend-title {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 1.1rem;
    font-weight: 600;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 8px;
}

.legend-items {
    margin-bottom: 15px;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    padding: 8px;
    border-radius: 8px;
    transition: background-color 0.2s ease;
    color: #2c3e50;
}

.legend-item:hover {
    background-color: rgba(0, 123, 255, 0.1);
}

.legend-item span {
    color: #2c3e50;
    font-weight: 500;
}

.legend-icon {
    width: 24px;
    height: 24px;
    margin-right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    position: relative;
    overflow: hidden;
}

.disaster-icon {
    background-image: url('/images/afet.png');
}

.disaster-icon::before {
    content: "!";
    position: absolute;
    color: white;
    font-weight: bold;
    font-size: 14px;
    z-index: -1;
}

.village-icon {
    background-image: url('/images/koy.png');
}

.village-icon::before {
    content: "V";
    position: absolute;
    color: white;
    font-weight: bold;
    font-size: 14px;
    z-index: -1;
}

.school-icon {
    background-image: url('/images/liselim.png');
}

.school-icon::before {
    content: "S";
    position: absolute;
    color: white;
    font-weight: bold;
    font-size: 14px;
    z-index: -1;
}

.legend-stats {
    border-top: 1px solid #e9ecef;
    padding-top: 10px;
    text-align: center;
}

.legend-stats .text-muted {
    color: #6c757d !important;
}

.info-panel {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.1);
    min-width: 300px;
    max-width: 400px;
    z-index: 1000;
    animation: slideInUp 0.3s ease;
}

@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.info-panel .btn-close {
    position: absolute;
    top: 10px;
    right: 10px;
}

.info-panel h6 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-weight: 600;
}

.info-panel p {
    margin-bottom: 8px;
    color: #495057;
}

.info-panel strong {
    color: #2c3e50;
}

.controls-panel {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: row;
    gap: 2px;
    z-index: 1001;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 12px;
    padding: 6px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(15px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.controls-row {
    display: flex;
    gap: 4px;
    justify-content: center;
}

.btn-map-control {
    width: 40px;
    height: 40px;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #4a5568;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    font-weight: 400;
}

.btn-map-control:hover {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

.btn-map-control:active {
    background: rgba(59, 130, 246, 0.15);
    transform: translateY(0) scale(0.98);
}

.btn-map-control:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.btn-map-control i {
    font-size: 18px;
    line-height: 1;
    opacity: 0.9;
    transition: all 0.2s ease;
}

.btn-map-control:hover i {
    opacity: 1;
    transform: scale(1.1);
}

/* Active state for location tracking button */
.btn-map-control.active {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
}

.btn-map-control.active:hover {
    background: rgba(34, 197, 94, 0.2);
    color: #16a34a;
}


#error-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9998;
    max-width: 400px;
    text-align: center;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.leaflet-popup-content-wrapper {
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.nearest-results {
    max-height: 400px;
    overflow-y: auto;
}

.result-item {
    display: flex;
    align-items: center;
    padding: 12px;
    margin-bottom: 8px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    background: #f8f9fa;
    transition: all 0.2s ease;
    cursor: pointer;
}

.result-item:hover {
    background: #e3f2fd;
    border-color: #2196f3;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.result-icon {
    width: 32px;
    height: 32px;
    margin-right: 12px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    border-radius: 4px;
    flex-shrink: 0;
}

.result-info {
    flex: 1;
    min-width: 0;
}

.result-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    color: #6c757d;
}

.result-distance {
    font-weight: 500;
    color: #28a745;
    white-space: nowrap;
}

.result-type {
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: #e9ecef;
    color: #495057;
}

.modal-content {
    border-radius: 12px;
    border: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.modal-header {
    border-bottom: 1px solid #e9ecef;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px 12px 0 0;
}

.modal-header .btn-close {
    filter: invert(1);
}

.modal-footer {
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
    border-radius: 0 0 12px 12px;
}

.bg-gradient-primary {
    background: linear-gradient(135deg, #495057 0%, #6c757d 100%) !important;
    color: white !important;
}

.modal-content {
    border: none;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

.modal-header.bg-gradient-primary {
    border-bottom: none;
    padding: 1rem 1.25rem;
}

.modal-body {
    background: #fdfdfd;
}

.modal-footer.bg-light {
    background: #f8f9fa !important;
}

.form-select.form-select-sm {
    border-color: #dee2e6;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.form-select.form-select-sm:focus {
    border-color: #495057;
    box-shadow: 0 0 0 0.15rem rgba(73, 80, 87, 0.15);
}

.btn-primary {
    background: #495057;
    border-color: #495057;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: #343a40;
    border-color: #343a40;
    transform: translateY(-1px);
    box-shadow: 0 3px 12px rgba(73, 80, 87, 0.25);
}

.btn-outline-secondary {
    border-color: #6c757d;
    color: #6c757d;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-outline-secondary:hover {
    background-color: #6c757d;
    border-color: #6c757d;
    transform: translateY(-1px);
}

.alert {
    font-size: 0.875rem;
}

.border-bottom {
    border-color: #e9ecef !important;
}

@media (prefers-color-scheme: dark) {
    .modal-body {
        background: #1e1e1e;
        color: #f8f9fa;
    }
    
    .modal-footer.bg-light {
        background: #2a2a2a !important;
    }
    
    .form-select.form-select-sm {
        background-color: #2a2a2a;
        border-color: #404040;
        color: #f8f9fa;
    }
    
    .alert-light {
        background-color: #2a2a2a !important;
        border-color: #404040 !important;
        color: #a0a0a0 !important;
    }
    
    .bg-gradient-primary {
        background: linear-gradient(135deg, #2a2a2a 0%, #404040 100%) !important;
    }
    
    .border-bottom {
        border-color: #404040 !important;
    }
}


.user-location-marker {
    background: transparent !important;
    border: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-location-dot {
    width: 14px;
    height: 14px;
    background: #007bff;
    border: 3px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: locationPulse 2s infinite ease-in-out;
}

.user-location-dot::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #007bff;
    border-radius: 50%;
    animation: locationRipple 2s infinite ease-out;
    opacity: 0;
}

.user-location-pulse {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #007bff;
    position: relative;
}

.user-location-pulse::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border: 2px solid #007bff;
    border-radius: 50%;
    animation: locationRipple 2s infinite;
    opacity: 0;
}

@keyframes locationPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes locationRipple {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

.location-accuracy-circle {
    pointer-events: none;
}

.highlighted-marker {
    filter: drop-shadow(0 0 10px #ffd700) brightness(1.2);
    z-index: 1000;
}

#findBtn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}


@media (max-width: 768px) {
    .legend-panel {
        top: 10px;
        right: 10px;
        left: 10px;
        min-width: auto;
        padding: 15px;
    }

    .info-panel {
        bottom: 10px;
        left: 10px;
        right: 10px;
        min-width: auto;
        max-width: none;
    }

    .controls-panel {
        top: 15px;
        left: 50%;
        transform: translateX(-50%);
        gap: 1px;
        padding: 4px;
        border-radius: 10px;
        z-index: 1002;
        max-width: calc(100vw - 30px);
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }


    .controls-panel::-webkit-scrollbar {
        display: none;
    }

    .controls-row {
        gap: 2px;
    }

    .controls-row:first-child {
        gap: 4px;
    }

    .btn-map-control {
        width: 36px;
        height: 36px;
        font-size: 16px;
        border-radius: 6px;
        flex-shrink: 0;
    }

    .btn-map-control i {
        font-size: 16px;
    }

    .legend-title {
        font-size: 1rem;
    }

    .legend-item {
        padding: 6px;
        margin-bottom: 8px;
    }

    .legend-icon {
        width: 20px;
        height: 20px;
        margin-right: 10px;
    }

    .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }

    .result-item {
        padding: 10px;
        margin-bottom: 6px;
    }

    .result-icon {
        width: 28px;
        height: 28px;
        margin-right: 10px;
    }

    .result-name {
        font-size: 0.9rem;
    }

    .result-details {
        font-size: 0.8rem;
    }

    .nearest-results {
        max-height: 300px;
    }
}

@media (max-width: 576px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100vw - 1rem);
        height: calc(100vh - 1rem);
    }

    .modal-content {
        height: 100%;
        border-radius: 8px;
    }

    .modal-body {
        padding: 1rem;
        flex: 1;
        overflow-y: auto;
    }

    .modal-header {
        padding: 0.75rem 1rem;
        border-radius: 8px 8px 0 0;
    }

    .modal-title {
        font-size: 1rem;
    }

    .modal-footer {
        padding: 0.5rem;
        border-radius: 0 0 8px 8px;
        gap: 0.5rem;
    }

    .nearest-results {
        max-height: none;
        flex: 1;
    }

    .result-item {
        padding: 0.75rem;
        margin-bottom: 0.5rem;
        border-radius: 6px;
    }

    .result-icon {
        width: 24px;
        height: 24px;
        margin-right: 8px;
    }

    .result-name {
        font-size: 0.875rem;
        line-height: 1.2;
    }

    .result-details {
        font-size: 0.75rem;
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    .result-type {
        font-size: 0.6875rem;
        padding: 1px 4px;
    }
}


@media (max-width: 480px) {
    .legend-panel {
        padding: 12px;
    }

    .info-panel {
        padding: 15px;
    }

    .controls-panel {
        top: 10px;
        left: 50%;
        transform: translateX(-50%);
        max-width: calc(100vw - 16px);
        padding: 2px;
    }


    .controls-row {
        gap: 2px;
        flex: 1;
        justify-content: space-evenly;
    }

    .btn-map-control {
        width: 32px;
        height: 32px;
        font-size: 14px;
        border-radius: 5px;
    }

    .btn-map-control i {
        font-size: 14px;
    }

    .legend-panel {
        top: 50px;
        right: 8px;
        left: 8px;
    }
}

@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a1a1a;
    }

    .legend-panel,
    .info-panel {
        background: rgba(33, 37, 41, 0.98);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .legend-title,
    .info-panel h6,
    .info-panel strong,
    .legend-item span {
        color: #f8f9fa;
    }

    .legend-item:hover {
        background-color: rgba(255, 255, 255, 0.1);
    }

    .info-panel p {
        color: #ced4da;
    }

    .controls-panel {
        background: rgba(26, 32, 44, 0.98);
        border: 1px solid rgba(255, 255, 255, 0.08);
    }

    .btn-map-control {
        color: #a0aec0 !important;
    }

    .btn-map-control:hover {
        background: rgba(59, 130, 246, 0.15) !important;
        color: #60a5fa !important;
        box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3) !important;
    }

    .btn-map-control:active {
        background: rgba(59, 130, 246, 0.2) !important;
    }

    .btn-map-control.active {
        background: rgba(34, 197, 94, 0.2) !important;
        color: #4ade80 !important;
        box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.3) !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.btn:focus,
.legend-item:focus {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

@media (prefers-contrast: high) {

    .legend-panel,
    .info-panel {
        border: 2px solid #000;
        background: #fff;
    }

    .btn {
        border: 2px solid #000;
    }
}

.footer-container {
    position: absolute;
    bottom: 5px;
    right: 0px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    border-radius: 12px 0 0 12px;
    padding: 12px 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(0, 0, 0, 0.08);
    z-index: 1000 !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 280px;
}

.footer-container p {
    margin: 0;
    font-size: 12px;
    color: #495057;
    font-weight: 500;
    line-height: 1.4;
    text-align: center;
}

.footer-container .bi-heart-fill {
    color: #CE1F26;
    font-size: 11px;
    margin: 0 2px;
    animation: heartbeat 2s ease-in-out infinite;
}

@keyframes heartbeat {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

.footer-container:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(206, 31, 38, 0.2);
}

@media (max-width: 768px) {
    .footer-container {
        bottom: 5px;
        right: 0px;
        padding: 10px 12px;
        border-radius: 12px;
        max-width: 240px;
    }

    .footer-container p {
        font-size: 11px;
    }
}

@media (max-width: 576px) {
    .footer-container {
        bottom: 5px;
        right: 0px;
        padding: 8px 10px;
        border-radius: 10px;
        max-width: 245px;
    }

    .footer-container p {
        font-size: 10px;
    }

    .footer-container .bi-heart-fill {
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    .footer-container {
        bottom: 5px;
        right: 0px;
        padding: 6px 8px;
        border-radius: 8px;
        max-width: 230px;
    }
}

@media (prefers-color-scheme: dark) {
    .footer-container {
        background: rgba(33, 37, 41, 0.95);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .footer-container p {
        color: #ced4da;
    }

    .footer-container:hover {
        background: rgba(33, 37, 41, 0.98);
        border-color: rgba(206, 31, 38, 0.3);
    }
}

@media (prefers-reduced-motion: reduce) {
    .footer-container .bi-heart-fill {
        animation: none;
    }

    .footer-container {
        transition: none;
    }
}


