body {
    margin: 0;
    padding: 0;
    display: flex;
    height: 100vh;
    font-family: Arial, sans-serif;
}

#timeline {
    width: 200px;
    height: 100%;
    background: #f5f5f5;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
    z-index: 1000;
    transition: transform 0.3s ease;
}

#timeline.collapsed {
    transform: translateX(-100%);
}

#mobile-toggle {
    display: none;
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 1001;
    background: white;
    border: none;
    padding: 12px;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    cursor: pointer;
}

.mobile-close-button {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    color: #333;
    z-index: 1002;
    display: none;  /* Hidden by default */
}

#logo {
    padding: 10px;
    margin-bottom: 0px;
    display: flex;
    justify-content: center;
    position: relative;
}

#logo img {
    max-width: 200px;
    height: auto;
}

#map-container {
    flex-grow: 1;
    position: relative;
}

#map {
    width: 100%;
    height: 100%;
}

.timeline-date {
    padding: 10px;
    margin: 5px 0;
    background: white;
    border: 1px solid #ddd;
    cursor: pointer;
    border-radius: 4px;
}

.timeline-date:hover {
    background: #e9e9e9;
}

.timeline-date.selected {
    background: #007bff;
    color: white;
}

#info-panel {
    position: fixed;
    background: white;
    border: 1px solid #ddd;
    padding: 15px;
    border-radius: 4px;
    max-width: 300px;
    display: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 1000;
    transform: translate(0, 0);
    margin: 0;
    white-space: pre-line;
}

.country-polygon {
    fill-opacity: 0.4;
    stroke-width: 1;
    stroke: #fff;
    transition: fill-opacity 0.3s;
}

.country-polygon.highlighted {
    fill-opacity: 0.7;
}

.button-container {
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    gap: 5px;
    margin: 5px;
}

.settings-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
}

.settings-btn:hover {
    background-color: #e9e9e9;
    border-radius: 50%;
}

.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.4);
    overflow-y: auto;
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 700px;
    border-radius: 8px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.topic-section {
    margin: 20px 0;
}

.topic-checkbox {
    display: flex;
    align-items: center;
    margin: 10px 0;
    gap: 10px;
    min-height: 44px;
}

.topic-checkbox input[type="checkbox"] {
    width: 24px;
    height: 24px;
}

#close-modal {
    background-color: #007bff;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    min-height: 44px;
}

#close-modal:hover {
    background-color: #0056b3;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 98%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    min-height: 44px;
    box-sizing: border-box;  /* Added this to include padding in width calculation */
}

.button-group {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.primary-btn, .secondary-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    min-height: 44px;
    min-width: 44px;
    font-size: 16px;
}

.primary-btn {
    background-color: #007bff;
    color: white;
}

.secondary-btn {
    background-color: #6c757d;
    color: white;
}

.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #4caf50;
    color: white;
    padding: 16px;
    border-radius: 4px;
    display: none;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    z-index: 2000;
}

.toast-icon {
    font-size: 20px;
}

.settings-btn:hover::after {
    content: attr(title);
    position: absolute;
    background: #333;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    margin-top: -30px;
}

/* Mobile styles */
@media screen and (max-width: 768px) {
    body {
        flex-direction: column;
    }

    #timeline {
        position: fixed;
        left: 0;
        top: 0;
        width: 80%;
        height: 100%;
        max-width: 300px;
    }

    #mobile-toggle {
        display: block;
    }

    .mobile-close-button {
        display: block;
    }

    #map-container {
        width: 100%;
        height: 100vh;
    }

    .modal-content {
        margin: 0;
        width: 100%;
        height: 100%;
        max-width: none;
        border-radius: 0;
    }

    #info-panel {
        position: fixed;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        width: 90%;
        max-width: none;
        max-height: 80vh;
        overflow-y: auto;
        border-radius: 8px;
        padding-top: 40px;
    }

    .button-container {
        justify-content: center;
    }

    .settings-btn, 
    .primary-btn, 
    .secondary-btn {
        padding: 16px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px;
        padding: 16px;
    }
}

#event-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.4);
    overflow-y: auto;
}

.event-modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 600px;
    border-radius: 8px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    white-space: pre-line;
}

.event-modal-header {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1;
}

.event-modal-footer {
    margin-top: 20px;
    text-align: right;
}

.nav-buttons {
    display: flex;
    gap: 5px;
}

.country-nav-btn {
    background-color: #007bff;
    color: white;
    padding: 0;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    flex-shrink: 0;
    font-size: 14px;
    font-weight: bold;
    line-height: 1;
}

.country-nav-btn:hover {
    background-color: #0056b3;
}

.event-modal-close {
    background-color: #007bff;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    min-height: 44px;
}

.event-modal-close:hover {
    background-color: #0056b3;
}

.select-all-controls {
    display: flex;
    gap: 20px;
    padding: 10px 0;
    margin-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.settings-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.lens-section {
    margin: 20px 0;
}

.lens-checkbox {
    display: flex;
    align-items: center;
    margin: 10px 0;
    gap: 10px;
    min-height: 44px;
}

.lens-checkbox input[type="radio"] {
    width: 24px;
    height: 24px;
}

#event-modal-body {
    font-size: 0.95em; /* Decrease font size for all content in modal */
}

#event-modal-body > strong:first-child {
    font-size: 1.05em; /* Restore original size for country title */
}

.country-flag {
    vertical-align: middle;
    margin-right: 5px;
    display: inline-block;
}

#event-modal-body strong:first-child {
    display: flex;
    align-items: center;
    font-size: 1.05em;
}

#event-modal-body strong:first-child img {
    margin-right: 5px;
}

#lens-selector {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    padding: 5px;
}
  
#lens-dropdown {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    background-color: white;
    min-width: 140px;
    min-height: 40px;
    cursor: pointer;
}

#mobile-lens-button {
    display: none; /* Hide mobile button by default on all screens */
}
  
#mobile-lens-panel {
    display: none; /* Hide mobile panel by default on all screens */
}

/* Mobile-specific styles */
@media screen and (max-width: 768px) {
    #lens-dropdown {
        display: none; /* Hide the standard dropdown on mobile */
    }
    
    #lens-selector {
        position: fixed;
        bottom: 10px;
        right: 10px;
        top: auto;
        background-color: rgba(255, 255, 255, 0.9);
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    #mobile-lens-button {
        display: flex; /* Show mobile button ONLY on mobile screens */
        padding: 10px 12px;
        background: #007bff;
        color: white;
        border-radius: 4px;
        border: none;
        font-size: 14px;
        font-weight: bold;
        box-shadow: 0 2px 4px rgba(0,0,0,0.2);
        cursor: pointer;
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        align-items: center;
    }
    
    #mobile-lens-panel {
      display: none;
      position: fixed;
      left: 0;
      bottom: 0;
      width: 100%;
      background: white;
      z-index: 2000;
      box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
      max-height: 50vh;
      overflow-y: auto;
    }
    
    .mobile-lens-option {
      padding: 16px;
      border-bottom: 1px solid #eee;
      font-size: 16px;
      cursor: pointer;
    }
    
    .mobile-lens-option.selected {
      background-color: #f0f8ff;
      font-weight: bold;
      color: #007bff;
    }
    
    .mobile-lens-close {
      padding: 16px;
      text-align: center;
      background: #f5f5f5;
      font-weight: bold;
      border-top: 1px solid #ddd;
    }
  }
