/* Django Map Project Custom Styles */

/* Global Styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    padding-top: 0; /* Reset any padding */
}

/* Navigation */
.navbar-brand {
    font-weight: bold;
    font-size: 1.5rem;
    position: relative;
    z-index: 1035;
}

/* Ensure navbar is always visible and has proper z-index */
.navbar {
    z-index: 1030;
    position: relative;
}

.navbar-nav .nav-link {
    font-weight: 500;
    margin: 0 10px;
    transition: color 0.3s ease;
}

.navbar-nav .nav-link:hover {
    color: #ffc107 !important;
}

/* Ensure main content doesn't overlap navbar */
main.container-fluid {
    padding-top: 20px; /* Add some space below navbar */
    z-index: 1; /* Ensure main content is below navbar */
}

/* Additional navbar fixes */
.navbar-expand-lg .navbar-nav {
    z-index: 1031;
}

.navbar-expand-lg .navbar-nav .nav-item {
    position: relative;
    z-index: 1032;
}

.navbar-expand-lg .navbar-nav .nav-item.dropdown {
    z-index: 1033;
}

/* Fix dropdown z-index collision */
.navbar {
    z-index: 1030;
    position: relative;
}

.navbar .dropdown-menu {
    z-index: 1100 !important;
    position: absolute;
}

.navbar-brand {
    position: relative;
    z-index: 1035;
}

.navbar-brand .dropdown-menu {
    z-index: 1105 !important;
    position: absolute;
}

/* Search Form Styling */
.navbar .form-control {
    padding: 4px 12px;
    font-size: 0.9rem;
    height: auto;
}

.navbar .form-select {
    padding: 4px 12px;
    font-size: 0.9rem;
    height: auto;
}

.navbar .btn-outline-light {
    padding: 4px 12px;
    font-size: 0.9rem;
    border-width: 1px;
    white-space: nowrap;
}

/* Compact search form */
.navbar .d-flex {
    gap: 8px;
}

.navbar .d-flex .form-control {
    min-width: 200px;
    max-width: 250px;
}

/* Responsive search form */
@media (max-width: 991px) {
    .navbar .d-flex .form-control {
        min-width: 150px;
        max-width: 200px;
    }
    
    .navbar .btn-outline-light {
        padding: 4px 8px;
        font-size: 0.8rem;
    }
}

@media (max-width: 576px) {
    .navbar .d-flex .form-control {
        min-width: 120px;
        max-width: 150px;
    }
    
    .navbar .btn-outline-light {
        padding: 4px 6px;
    }
    
    .navbar .btn-outline-light .fas {
        margin-right: 4px;
    }
}

/* Cards and Components */
.card {
    border: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    z-index: 1;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15);
    z-index: 2;
}

.card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom: none;
    font-weight: bold;
}

/* Buttons */
.btn {
    border-radius: 25px;
    font-weight: 500;
    padding: 10px 20px;
    transition: all 0.3s ease;
}

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

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
}

.btn-success {
    background: linear-gradient(135deg, #56ab2f 0%, #a8e6cf 100%);
    border: none;
}

.btn-info {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    border: none;
}

.btn-warning {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    border: none;
}

/* Map Specific Styles */
#map {
    border: 3px solid #dee2e6;
    border-radius: 15px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.leaflet-popup-content {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.leaflet-popup-content h6 {
    color: #2c3e50;
    margin-bottom: 10px;
}

/* Coordinate Popup Styles */
.coordinate-popup {
    padding: 5px;
    min-width: 280px;
}

.coordinate-popup h6 {
    color: #2c3e50;
    margin-bottom: 15px;
    text-align: center;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 8px;
}

.coordinate-format {
    margin-bottom: 12px;
}

.coordinate-format label {
    display: block;
    font-weight: 600;
    color: #495057;
    margin-bottom: 4px;
    font-size: 0.9rem;
}

.coordinate-value {
    display: flex;
    align-items: center;
    gap: 8px;
}

.coordinate-value span {
    font-family: 'Courier New', Consolas, monospace;
    background: #f8f9fa;
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid #dee2e6;
    flex: 1;
    font-size: 0.85rem;
    word-break: break-all;
}

.coordinate-popup .btn-xs {
    padding: 4px 8px;
    font-size: 0.75rem;
    line-height: 1.2;
    border-radius: 3px;
    border: 1px solid #ced4da;
    background: white;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
}

.coordinate-popup .btn-xs:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    color: #495057;
    transform: translateY(-1px);
}

.coordinate-popup .btn-xs:active {
    transform: translateY(0);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

.coordinate-popup .btn-sm {
    padding: 6px 12px;
    font-size: 0.9rem;
    border-radius: 20px;
    font-weight: 500;
    margin-top: 8px;
}

/* Stats Cards */
.stats-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

.stats-card h3 {
    font-weight: bold;
    margin-bottom: 10px;
}

/* Map Controls */
.map-controls {
    margin-bottom: 25px;
}

.map-controls .btn {
    margin-right: 10px;
    margin-bottom: 10px;
}

/* Table Styles */
.table-responsive {
    border-radius: 10px;
    overflow: hidden;
}

.table {
    margin-bottom: 0;
}

.table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    font-weight: 600;
}

.table td {
    vertical-align: middle;
    border-color: #dee2e6;
}

/* Badges */
.badge {
    font-size: 0.8rem;
    padding: 5px 10px;
    border-radius: 15px;
}

/* Form Styles */
.form-control, .form-select {
    border-radius: 10px;
    border: 2px solid #dee2e6;
    padding: 12px 15px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-control:focus, .form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

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

/* Alert Styles */
.alert {
    border-radius: 10px;
    border: none;
    font-weight: 500;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.alert-success {
    background: linear-gradient(135deg, #56ab2f 0%, #a8e6cf 100%);
    color: white;
}

.alert-danger {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
}

.alert-info {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
}

.alert-warning {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    color: white;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 20px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .stats-card {
        padding: 20px;
        text-align: center;
    }
    
    .map-controls {
        text-align: center;
    }
    
    .map-controls .btn {
        width: 100%;
        margin-bottom: 10px;
        margin-right: 0;
    }
    
    #map {
        height: 60vh;
        min-height: 300px;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

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

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

/* Hover Effects */
.hover-lift {
    transition: transform 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
}

/* Text Utilities */
.text-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: bold;
}

/* Ensure proper layering for dropdowns and modals */
.dropdown-menu {
    z-index: 1050;
}

/* Specific navbar dropdown fixes */
.navbar-nav .dropdown-menu {
    z-index: 1100 !important;
    position: absolute !important;
}

.navbar-collapse {
    z-index: 1040;
}

.navbar-toggler {
    z-index: 1041;
}

/* Force all navbar dropdowns to top layer */
.navbar .dropdown-menu.show {
    z-index: 1110 !important;
}

.modal {
    z-index: 1055;
}

.modal-backdrop {
    z-index: 1040;
}

/* Bootstrap tooltip and popover z-index */
.tooltip {
    z-index: 1070;
}

.popover {
    z-index: 1060;
}