* {
    box-sizing: border-box;
}

body {
    font-family: sans-serif;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

#map-type-control-container {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 1;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    overflow: hidden;
}

.map-type-btn {
    background-color: transparent;
    border: none;
    padding: 10px 15px;
    font-weight: bold;
    cursor: pointer;
    color: #333;
}

    .map-type-btn.active {
        background-color: #4285f4;
        color: white;
    }
#map {
    height: 100vh;
    width: 100%;
}

#add-pin-btn, #info-btn, #locate-me-btn, #filter-btn, #reset-filter-btn {
    position: absolute;
    bottom: 20px;
    z-index: 1;
    background-color: #4285f4;
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 30px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s;
}

#add-pin-btn {
    left: 20px;
}

#info-btn {
    left: 260px;
    font-size: 24px; /* Adjusted for 'i' character */
    font-weight: bold;
}

#locate-me-btn {
    left: 200px;
    font-size: 24px;
    transform: rotate(-45deg);
}

#filter-btn {
    left: 80px;
    font-size: 24px;
}


#add-pin-btn:hover, #info-btn:hover, #locate-me-btn:hover, #filter-btn:hover, #reset-filter-btn:hover {
    transform: scale(1.1);
}

#reset-filter-btn {
    left: 140px;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.reset-rotating {
    animation: reset-spin 0.6s ease;
}

@keyframes reset-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

#filter-dropdown {
    position: absolute;
    bottom: 80px;
    left: 20px; /* Adjusted for mobile */
    right: 20px; /* Added for mobile */
    z-index: 1;
    max-width: 500px; /* Keep max-width for larger screens */
    width: calc(100% - 40px); /* Responsive width */
    background-color: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
}

#filter-dropdown.hidden {
    display: none;
}

#filter-container {
    max-height: 50vh; /* 50% of the viewport height */
    overflow-y: auto;
}

#filter-container label {
    display: block;
    margin-bottom: 5px;
    color: #333;
}

.filter-date-range {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 0;
    margin-bottom: 15px;
    color: #1f1f1f;
    display: flex;
    gap: 10px;
    align-items: center;
}

#filter-date-range-input {
    flex: 1;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(66, 133, 244, 0.35);
    background-color: rgba(255, 255, 255, 0.95);
    font-size: 14px;
    color: #333;
    outline: none;
    cursor: pointer;
}

#filter-date-range-input:focus {
    border-color: #4285f4;
    box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.2);
}

.filter-search {
    display: flex;
    gap: 10px;
    margin: 0 0 15px;
}

.filter-search input {
    flex: 1;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(66, 133, 244, 0.35);
    background-color: rgba(255, 255, 255, 0.95);
    font-size: 14px;
    color: #333;
    outline: none;
}

.filter-search input:focus {
    border-color: #4285f4;
    box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.2);
}

#filter-date-range-input + #filter-search-btn {
    padding: 10px 18px;
    border: none;
    border-radius: 10px;
    background-color: #4285f4;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

#filter-date-range-input + #filter-search-btn:hover,
#filter-date-range-input + #filter-search-btn:focus {
    background-color: #2f6bdc;
    transform: translateY(-1px);
}

#pin-form {
    position: absolute;
    bottom: 80px;
    left: 20px;
    background-color: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
    z-index: 1;
    width: 350px;
    transform: translateY(100%);
    transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55), opacity 0.5s ease-out, visibility 0.5s ease-out;
}

#pin-form:not(.hidden) {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

#pin-form.hidden {
    transform: translateY(100vh);
    opacity: 0;
    visibility: hidden;
}

#pin-form h2 {
    margin-top: 0;
    color: #333;
    text-align: center;
}

#pin-form input,
#pin-form select,
#pin-form textarea,
#pin-form #lifetime-date-picker {
    display: block;
    width: calc(100% - 10px);
    margin-bottom: 15px;
    padding: 12px;
    border: none;
    border-radius: 10px;
    background-color: rgba(255, 255, 255, 0.2);
    color: #333;
    font-size: 14px;
}

#pin-form input::placeholder,
#pin-form textarea::placeholder {
    color: #666;
    font-family: sans-serif;
}

#pin-form button {
    display: block;
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 10px;
    background-color: #4285f4;
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.2s;
}

#pin-form button:hover {
    background-color: #357ae8;
}

#lifetime-date-picker {
    margin-top: 10px;
}

#metrics-container {
    position: absolute;
    top: 50px;
    left: 10px;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

#unique-ips-count, #active-pins-count {
    background-color: rgba(255, 255, 255, 0.8);
    padding: 10px 15px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    font-weight: bold;
    font-size: 0.8rem;
}



.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background-color: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(10px);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-height: 80%;
    max-width: 500px;
    position: relative;
    transform: translateY(0);
    transition: transform 0.3s ease;
    overflow-y: auto; /* Added this line */
}

.modal-overlay.hidden .modal-content {
    transform: translateY(-20px);
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #aaa;
}

.close-btn:hover {
    color: #333;
}

.custom-info-window {
    position: absolute;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    color: white;
    padding: 20px;
    width: 300px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -110%);
}

.info-window-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.info-window-category {
    font-weight: bold;
    font-size: 1.618em;
    color: #88b0f1;
}

.close-info-window {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
}

.info-window-title {
    font-weight: bold;
    font-size: 1.5em;
    margin-bottom: 10px;
}

.info-window-description {
    margin-bottom: 20px;
    font-size: 1.2em;
}

.info-window-when {
    font-size: 1.2em;
    color: #ccc;
    margin-bottom: 10px;
}

.info-window-link {
    font-size: 1.2em;
    color: #90f2a8;
    text-decoration: none;
    margin-bottom: 15px;
    margin-top: 15px;
    word-wrap: break-word;
}

.info-window-actions {
    margin: 12px 0;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 12px;
}

.info-window-actions .edit-btn {
    margin-right: auto;
}

.navigate-btn {
    background-color: #34a853;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.navigate-btn:hover,
.navigate-btn:focus {
    background-color: #2c8d45;
    transform: translateY(-1px);
}

.navigation-modal {
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    background: rgba(0, 0, 0, 0.35);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    z-index: 1500;
}

.navigation-modal--open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.navigation-modal__sheet {
    width: 100%;
    max-width: 420px;
    background: rgba(12, 18, 34, 0.92);
    color: #f1f5f9;
    border-radius: 18px 18px 0 0;
    padding: 16px 20px 14px;
    transform: translateY(32px);
    transition: transform 0.25s ease;
    backdrop-filter: blur(18px);
    box-shadow: 0 -20px 40px rgba(0, 0, 0, 0.35);
}

.navigation-modal--open .navigation-modal__sheet {
    transform: translateY(0);
}

.navigation-modal__handle {
    width: 48px;
    height: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.25);
    margin: 0 auto 12px;
}

.navigation-modal__title {
    font-size: 1.1em;
    font-weight: 600;
    margin: 0 0 12px;
    text-align: center;
    color: #f8fafc;
}

.navigation-modal__options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.navigation-modal__option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    border-radius: 12px;
    padding: 14px 16px;
    color: inherit;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.navigation-modal__option:hover,
.navigation-modal__option:focus {
    background: rgba(66, 133, 244, 0.25);
    transform: translateY(-1px);
}

.navigation-modal__option-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.navigation-modal__option-title {
    font-size: 1em;
    font-weight: 600;
    color: #f8fafc;
}

.navigation-modal__option-hint {
    font-size: 0.8em;
    color: rgba(241, 245, 249, 0.75);
}

.navigation-modal__option-arrow {
    font-size: 1.2em;
    color: rgba(241, 245, 249, 0.6);
}

.navigation-modal__cancel {
    margin-top: 14px;
    width: 100%;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 12px;
    padding: 12px;
    color: #f8fafc;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.navigation-modal__cancel:hover,
.navigation-modal__cancel:focus {
    background: rgba(255, 255, 255, 0.25);
}

.info-window-vote {
    margin-top: 10px;
    display: flex;
    align-items: center;
    font-size: 1.5em;
}

.info-window-vote button {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    margin-right: 5px;
    color: white;
}

.info-window-vote span {
    margin-right: 15px;
}

.edit-btn {
    background-color: #4285f4;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 10px 15px;
    cursor: pointer;
    font-size: 14px;
    margin-left: 0px;
}

.edit-btn:hover {
    background-color: #357ae8;
    color: #ffffff;
}

.info-window-vote-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 10px;
}

.info-window-vote-actions .info-window-vote {
    margin: 0;
}
