/* 
 * Common CSS styles for all demo pages in the OpenEventDatabase
 */

/* General styles */
body { 
    margin: 0; 
    padding: 20px; 
    font-family: Arial, sans-serif;
    background-color: #f5f5f5;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background-color: white;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

h1 { 
    margin-top: 0;
    color: #333;
}

.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

input[type="text"],
input[type="datetime-local"],
select,
textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 14px;
}

.required:after {
    content: " *";
    color: red;
}

.form-row {
    display: flex;
    gap: 15px;
}

.form-row .form-group {
    flex: 1;
}

button {
    background-color: #0078ff;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

button:hover {
    background-color: #0056b3;
}

.note {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

#map {
    width: 100%;
    height: 100vh;
    margin-bottom: 15px;
    border-radius: 4px;
}

#result {
    margin-top: 20px;
    padding: 10px;
    border-radius: 4px;
    display: none;
}

#result.success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

#result.error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.nav-links {
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.nav-links a {
    color: #0078ff;
    text-decoration: none;
    margin-right: 15px;
}

.nav-links a:hover {
    text-decoration: underline;
}

/* Navigation container */
.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

/* Hamburger menu for mobile */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #0078ff;
    padding: 5px;
}

/* Responsive styles */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .menu-toggle {
        display: block;
        align-self: flex-end;
        margin-bottom: 10px;
    }
    
    .nav-links {
        display: none;
        flex-direction: column;
        width: 100%;
    }
    
    .nav-links.active {
        display: flex;
    }
    
    .nav-links a {
        padding: 10px 0;
        border-bottom: 1px solid #eee;
        margin-right: 0;
    }
}

/* Collapsible panel styles */
.collapsible-panel {
    margin-bottom: 15px;
}

.collapsible-header {
    background-color: #f8f9fa;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #e9ecef;
}

.collapsible-header h3 {
    margin: 0;
    font-size: 16px;
}

.collapsible-header .toggle-icon {
    transition: transform 0.3s ease;
}

.collapsible-header.active .toggle-icon {
    transform: rotate(180deg);
}

.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    border-left: 1px solid #e9ecef;
    border-right: 1px solid #e9ecef;
    border-bottom: 1px solid #e9ecef;
    border-radius: 0 0 5px 5px;
}

.collapsible-content.active {
    max-height: 1000px;
}

/* Authentication section styles */
.auth-section {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
}

.auth-section h3 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #333;
}

.auth-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.auth-info img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

/* Improved OSM login button styling */
.osm-login-btn {
    background-color: #7ebc6f;
    color: white;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    border-radius: 4px;
    font-weight: bold;
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.osm-login-btn:hover {
    background-color: #6ba75e;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.osm-logo {
    width: 24px;
    height: 24px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12 12-5.373 12-12S18.627 0 12 0zm-1.66 4.322c.944 0 1.71.766 1.71 1.71s-.766 1.71-1.71 1.71-1.71-.766-1.71-1.71.766-1.71 1.71-1.71zm6.482 13.356H4.322v-1.71h12.5v1.71zm0-3.322H4.322v-1.71h12.5v1.71zm0-3.322H4.322v-1.71h12.5v1.71z"/></svg>');
    background-repeat: no-repeat;
    background-position: center;
}

/* Geolocation button styles */
.geolocation-btn {
    background-color: #28a745;
    margin-bottom: 10px;
}

.geolocation-btn:hover {
    background-color: #218838;
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    margin-right: 10px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Issue buttons styles */
.issue-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.issue-button {
    flex: 1;
    min-width: 120px;
    text-align: center;
    padding: 15px 10px;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.issue-button i {
    font-size: 24px;
}

.issue-button.pothole {
    background-color: #ff9800;
    color: white;
}

.issue-button.obstacle {
    background-color: #f44336;
    color: white;
}

.issue-button.vehicle {
    background-color: #2196f3;
    color: white;
}

.issue-button.danger {
    background-color: #9c27b0;
    color: white;
}

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

/* View saved events link */
.view-saved-events {
    display: block;
    text-align: center;
    margin-top: 20px;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 5px;
    text-decoration: none;
    color: #333;
    border: 1px solid #ddd;
}

.view-saved-events:hover {
    background-color: #e9ecef;
}

/* Map overlay styles */
.map-overlay {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(255, 255, 255, 0.9);
    padding: 15px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    max-width: 300px;
    max-height: 90vh;
    overflow-y: auto;
}

.map-overlay h2 {
    margin-top: 0;
    margin-bottom: 10px;
}

/* Event list styles */
.event-list {
    margin-top: 15px;
    max-height: 60vh;
    overflow-y: auto;
}

.event-item {
    padding: 10px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
}

.event-item:hover {
    background-color: #f5f5f5;
}

.event-item h3 {
    margin: 0 0 5px 0;
    font-size: 16px;
}

.event-item p {
    margin: 0;
    font-size: 14px;
    color: #666;
}

.event-item .event-date {
    font-size: 12px;
    color: #999;
}

.event-item .event-type {
    display: inline-block;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 12px;
    color: white;
    margin-right: 5px;
}

.event-type.pothole {
    background-color: #ff9800;
}

.event-type.obstacle {
    background-color: #f44336;
}

.event-type.vehicle {
    background-color: #2196f3;
}

.event-type.danger {
    background-color: #9c27b0;
}

.event-type.traffic {
    background-color: #ff3860;
}

.event-type.other {
    background-color: #777;
}

.no-events {
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 5px;
    text-align: center;
    color: #666;
}

/* Controls styles */
.controls {
    margin-top: 15px;
    display: flex;
    gap: 10px;
}

.controls button {
    flex: 1;
    padding: 8px;
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
}

.controls button:hover {
    background-color: #e9ecef;
}

.controls button.danger {
    color: #dc3545;
}

/* Popup styles */
.popup-content {
    max-width: 300px;
}

.popup-content h3 {
    margin-top: 0;
    margin-bottom: 10px;
}

.popup-content table {
    width: 100%;
    border-collapse: collapse;
}

.popup-content table td {
    padding: 4px;
    border-bottom: 1px solid #eee;
}

.popup-content table td:first-child {
    font-weight: bold;
    width: 40%;
}

.osm-login-btn{
    padding: 1rem 2rem;
    border-radius: 5px;
}

#report_issue_button{
    /*position: fixed;*/
    /*bottom: 0.5rem;*/
    /*right: 0.5rem;*/
    padding: 2rem 1rem;
}

/* Tab styles */
.tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
    margin-bottom: 20px;
}

.tab-item {
    padding: 10px 20px;
    cursor: pointer;
    border: 1px solid transparent;
    border-bottom: none;
    margin-right: 5px;
    border-radius: 5px 5px 0 0;
    background-color: #f8f9fa;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-item i {
    font-size: 16px;
}

.tab-item:hover {
    background-color: #e9ecef;
}

.tab-item.active {
    background-color: white;
    border-color: #ddd;
    border-bottom-color: white;
    margin-bottom: -1px;
    font-weight: bold;
}

.tab-content {
    margin-bottom: 20px;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* Family-based colors for issue buttons */
.issue-button.road {
    background-color: #2196f3; /* Blue for road issues */
    color: white;
}

.issue-button.rail {
    background-color: #673ab7; /* Purple for rail issues */
    color: white;
}

.issue-button.weather {
    background-color: #ff9800; /* Orange for weather issues */
    color: white;
}

.issue-button.emergency {
    background-color: #f44336; /* Red for emergency issues */
    color: white;
}

/* Disabled button styles */
button:disabled, 
button[disabled] {
    background-color: #cccccc !important;
    color: #666666 !important;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Invalid form field styles */
input:invalid, 
select:invalid {
    border-color: #f44336;
    background-color: #fff8f8;
}

.maplibregl-popup-content{
  min-width: 300px;
    max-width: 95vw;
}
.event-popup h3{
    font-size: 1.5rem !important;
}

.add-event-btn{
    float: left;
    width: 130px;
}

button{
    padding: 1rem 0.5rem;
    border-radius: 5px;
    background-color: #79a2d1;
}

#eventsHistogram{
    height: 150px;
}

.maplibregl-ctrl-attrib + .maplibregl-ctrl-attrib {
    display: none;
}

.icon{
    /*background-color: white; border-radius: 50%; padding: 8px; box-shadow: 0 0 5px rgba(0,0,0,0.3);*/
}