/* Base Styles */
body {
    font-family: 'Inter', Arial, sans-serif;
    background-color: #f7fafc;
    color: #2d3748;
    margin: 0;
    overflow-y: auto;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

h1, h2 {
    color: #1a202c;
    font-weight: 600;
}

/* Navigation */
.navbar {
    background-color: #1a202c;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    color: #ffffff;
    font-size: 1.5rem;
    font-weight: 700;
    text-decoration: none;
    transition: color 0.2s;
}

.navbar-brand:hover {
    color: #e2e8f0;
}

.navbar-nav {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
}

.navbar-nav li {
    margin-left: 1.5rem;
}

.navbar-nav a {
    color: #e2e8f0;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: background-color 0.2s, color 0.2s;
}

.navbar-nav a:hover {
    background-color: #4a5568;
    color: #ffffff;
}

.navbar-nav a.active {
    background-color: #4c51bf;
    color: #ffffff;
}

/* Map */
#map {
    height: 500px;
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

@media (max-width: 640px) {
    #map {
        height: 300px;
    }
}

.leaflet-control-custom a {
    display: block;
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    margin-bottom: 2px;
    color: #4a5568;
    text-decoration: none;
}

.leaflet-control-custom a:hover {
    background: #edf2f7;
}

/* Layer Control */
.leaflet-control-layers {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 8px;
}

.leaflet-control-layers label {
    font-size: 14px;
    color: #2d3748;
    margin: 0;
}

.leaflet-control-layers input[type="radio"] {
    margin-right: 8px;
}

.leaflet-control-layers-expanded {
    background: #ffffff;
}

/* Mapillary Viewer */
#mly {
    resize: both;
    overflow: auto;
    z-index: 2000;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    pointer-events: auto;
}

/* Street View Toggle */
#toggleStreetView {
    background: #4c51bf;
    color: #ffffff;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
    z-index: 1100;
    position: relative;
}

#toggleStreetView:hover {
    background: #5a67d8;
}

/* Calendar */
#calendar {
    min-height: 400px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #ffffff;
    padding: 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.fc-event {
    cursor: pointer;
    border-radius: 4px;
    padding: 2px 4px;
}

.fc-check-event {
    background-color: #bfdbfe;
    border-color: #2563eb;
}

.fc-report-event {
    background-color: #f9a8d4;
    border-color: #db2777;
}

.fc-today-event {
    background-color: #fef08a;
    border-color: #ca8a04;
}

.calendar-tooltip {
    position: absolute;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 8px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    font-size: 14px;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

th, td {
    border: 1px solid #e2e8f0;
    padding: 12px;
    text-align: left;
}

th {
    background-color: #edf2f7;
    font-weight: 600;
    color: #2d3748;
    cursor: pointer;
}

th:hover {
    background-color: #e2e8f0;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 8px 16px;
    margin: 0 2px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    background: #ffffff;
    color: #4a5568;
    cursor: pointer;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: #edf2f7;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: #4c51bf;
    color: #ffffff;
    border-color: #4c51bf;
}

.dataTables_wrapper .dataTables_filter input {
    padding: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    margin-left: 8px;
}

@media (max-width: 640px) {
    table {
        display: block;
        overflow-x: auto;
    }
    table thead {
        display: none;
    }
    table tbody tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #e2e8f0;
        padding: 0.5rem;
    }
    table tbody td {
        display: block;
        text-align: left;
    }
    table tbody td:before {
        content: attr(data-label);
        font-weight: bold;
        margin-right: 0.5rem;
    }
}

/* Buttons */
button {
    background-color: #4c51bf;
    color: #ffffff;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

button:hover {
    background-color: #5a67d8;
}

button:disabled {
    background-color: #a0aec0;
    cursor: not-allowed;
}

/* Forms */
input, select {
    padding: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    width: 100%;
    box-sizing: border-box;
    background: #ffffff;
}

input:focus, select:focus {
    outline: none;
    border-color: #4c51bf;
    box-shadow: 0 0 0 2px rgba(76, 81, 191, 0.2);
}

label {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
    color: #4a5568;
}

/* Dashboard Charts */
.chart-container {
    max-width: 600px;
    height: 300px;
    margin: 1.5rem auto;
    background: #ffffff;
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    position: relative;
}

.chart-container canvas {
    max-height: 100%;
    width: 100%;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .chart-container {
        max-width: 100%;
        height: 250px;
    }
}

/* Filters Section */
.filters form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    padding: 16px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.filters div {
    display: flex;
    flex-direction: column;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
}

.pagination button {
    background-color: #4c51bf;
    color: #ffffff;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.pagination button:hover:not(:disabled) {
    background-color: #5a67d8;
}

.pagination button:disabled {
    background-color: #a0aec0;
    cursor: not-allowed;
}

.pagination span {
    font-size: 1rem;
    color: #2d3748;
}

/* Loading Indicator */
.loading {
    text-align: center;
    padding: 20px;
    color: #4a5568;
}

/* Responsive Layout */
@media (max-width: 768px) {
    .filters form {
        grid-template-columns: 1fr;
    }
    .navbar .container {
        flex-direction: column;
        align-items: flex-start;
    }
    .navbar-nav {
        flex-direction: column;
        width: 100%;
        margin-top: 1rem;
    }
    .navbar-nav li {
        margin: 0.5rem 0;
    }
    .navbar-nav a {
        display: block;
        padding: 0.75rem 1rem;
    }
}