/* Ensure pointer events enabled to avoid blocking location prompt */
.map-container,
.map-wrapper,
#dog-waste-map {
    pointer-events: auto !important;
}

/* Main container for the entire map section */
.map-container {
    padding: 30px 16px;
    background-color: #fff;
    margin: 40px auto;
}

/* Inner wrapper to align text and map together */
.map-container-inner {
    max-width: 85%;
    margin: 0 auto;
    text-align: left;
}

/* Heading */
.map-container h1 {
    margin-top: 3rem;
    font-weight: 600;
    font-size: 22px;
    color: var(--primary-color);
    margin-bottom: 5px;
}

/* Paragraph text */
.map-container p {
    color: #666;
    font-size: 15px;
    margin-bottom: 5px;
    margin-top: 0;
    max-width: 100%;
}

/* Wrapper to allow floating button */
.map-wrapper {
    position: relative;
}

/* Map styling */
#dog-waste-map {
    width: 100%;
    height: 600px;
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: block;
}

.location-button {
    position: absolute;
    top: 102px;
    right: 11px;
    z-index: 500;
    color: white;
    background-color: var(--primary-color);
    border: 1px solid var(--primary-color);
    padding: 9px;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.location-button:hover {
    background-color: var(--primary-color-hover);
}

/* Nearest bin box styling - desktop */
.nearest-bin-box {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 800px;
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    color: #333;
    z-index: 1000;
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.nearest-bin-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex: 1;
}

/* Nearest bin distance text */
#nearest-bin-info {
    font-size: 15px;
    font-weight: 500;
    margin: 0 0 5px 0;
    color: #333;
}

/* Toggle reference button styling */
.nearest-bin-toggle {
    font-size: 12px;
    background: none;
    border: none;
    color: var(--primary-color);
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
    margin: 0;
    text-align: left;
    display: none;
}

/* Show Me button styling */
.nearest-bin-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 16px;
    font-size: 18px;
    border-radius: 20px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    display: none;
    white-space: nowrap;
    margin-left: 15px;
}

.nearest-bin-button i {
    margin-right: 5px;
}

.nearest-bin-button:hover {
    background-color: var(--primary-color-hover);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.nearest-bin-button:active {
    transform: translateY(1px);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

#show-nearest-bin.disabled {
    background-color: #ccc !important;
    color: #666 !important;
    cursor: not-allowed;
    pointer-events: none;
    opacity: 0.6;
}

/* Search form styling */
.postcode-search {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 600px;
}

.search-input-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 12px;
    color: #999;
    font-size: 16px;
    z-index: 1;
}

.voice-search-icon {
    position: absolute;
    right: 12px;
    color: var(--primary-color);
    font-size: 16px;
    cursor: pointer;
    z-index: 1;
    transition: color 0.3s ease;
}

.voice-search-icon:hover {
    color: var(--primary-color-hover);
}

.voice-search-icon.listening {
    color: #B22222;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

#postcode-input {
    flex: 1;
    width: 100%;
    padding: 12px 16px 12px 40px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 15px;
    transition: border-color 0.3s ease;
    outline: none;
}

#postcode-input:focus {
    border-color: var(--primary-color);
}

#postcode-input::placeholder {
    color: #999;
}

.postcode-search button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 15px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease, opacity 0.3s ease;
    white-space: nowrap;
}

.postcode-search button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
}

.postcode-search button:disabled:hover {
    background-color: #cccccc;
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
}

.postcode-search button:hover {
    background-color: var(--primary-color-hover);
}

.postcode-search button:active {
    transform: scale(0.95);
}

.map-layer-toggle-button {
    width: 36px;
    height: 36px;
    background-color: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: absolute;
    z-index: 500;
    transition: all 0.3s ease;
    right: 11px;
}

.bin-layer-toggle-button {
    width: 36px;
    height: 36px;
    background-color: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: absolute;
    z-index: 500;
    transition: all 0.3s ease;
    right: 11px;
}

.bin-layer-toggle-button {
    top: 56px;
}

.map-layer-toggle-button {
    top: 10px;
}

.bin-layer-toggle-button:hover,
.map-layer-toggle-button:hover {
    background-color: #f5f5f5;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.bin-layer-toggle-button i,
.map-layer-toggle-button i {
    color: var(--primary-color);
    font-size: 18px;
    transition: color 0.3s ease;
}

.bin-layer-toggle-menu,
.map-layer-toggle-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    border: none;
    border-radius: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    padding: 2rem;
    margin-top: 0;
    z-index: 9999999;
    display: none;
    flex-direction: column;
    justify-content: flex-start;
    overflow: hidden;
}

.bin-layer-toggle-menu[style*="display: block"],
.map-layer-toggle-menu[style*="display: block"] {
    display: flex;
}

.bin-layer-toggle-menu label,
.map-layer-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    margin: 0.5rem 0;
    color: var(--primary-color);
    font-size: 1rem;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s ease;
    border-bottom: 1px solid #ddd;
}

.bin-layer-toggle-menu label:hover,
.map-layer-option:hover {
    background-color: #f5f5f5;
}

.map-layer-option {
    width: 100%;
    text-align: left;
    border: none;
    background-color: white;
}

.map-layer-option.active {
    background-color: var(--primary-color);
    color: white;
}

.popup-title {
    color: #333;
    font-size: 1.2rem;
    margin-bottom: 1rem;
    margin-top: 2.4rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #333;
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    cursor: pointer;
}

.close-btn::before {
    content: '\f00d';
    font-family: 'FontAwesome';
    font-size: 2rem;
    color: #333;
}

.popup-footer {
    display: flex;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 1rem;
}

.reset-btn {
    padding: 0.5rem 1rem;
    background: white;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    border-radius: 999px;
    cursor: pointer;
    font-size: 1rem;
}

.apply-btn {
    padding: 0.75rem 1.25rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    font-size: 1.1rem;
}

.apply-btn:hover {
    background: var(--primary-color-hover);
}

@media (max-width: 768px) {

    /* Heading */
    .map-container h1 {
        margin-top: 2.1rem;
    }

    .bin-layer-toggle-button,
    .map-layer-toggle-button {
        width: 32px;
        height: 32px;
    }

    .bin-layer-toggle-button i,
    .map-layer-toggle-button i {
        font-size: 16px;
    }

    .bin-layer-toggle-menu,
    .map-layer-toggle-menu {
        min-width: 140px;
    }

    .location-button {
        width: 32px;
        height: 32px;
    }
}


/* Responsive layout adjustments */
@media (max-width: 1024px) {
    .map-container-inner {
        max-width: 90%;
    }
}

@media (max-width: 950px) {
    .nearest-bin-box {
        position: static;
        transform: none;
        margin-top: 20px;
        width: 100%;
        max-width: 100%;
        flex-direction: column;
        align-items: center;
        padding: 15px 20px;
    }

    .nearest-bin-content {
        width: 85%;
        margin: 0 auto 15px auto;
        text-align: center;
        display: block;
    }

    .nearest-bin-toggle {
        width: 85%;
        margin: 0 auto 15px auto;
        text-align: center;
    }

    .nearest-bin-button {
        width: 85%;
        display: block;
        margin: 0 auto;
        padding: 10px 14px;
        font-size: 18px;
    }

    #nearest-bin-info {
        font-size: 14px;
    }
}

@media (max-width: 768px) {
    .location-button {
        position: absolute;
        bottom: 110px;
        right: 11px;
        pointer-events: auto;
    }

    .map-wrapper {
        position: relative;
    }

    #dog-waste-map {
        padding-bottom: 100px;
        height: 500px;
    }

    .map-container-inner {
        max-width: 95%;
    }
}

@media (max-width: 480px) {
    .location-button {
        position: absolute;
        bottom: 110px;
        right: 11px;
        pointer-events: auto;
    }

    .map-wrapper {
        position: relative;
    }

    #dog-waste-map {
        height: 300px;
    }

    .postcode-search {
        flex-direction: column;
        gap: 12px;
    }

    .postcode-search button {
        width: 100%;
        padding: 14px 24px;
    }

    .nearest-bin-box {
        width: 100%;
        padding: 10px 12px;
        bottom: 10px;
    }

    .nearest-bin-content {
        width: 100%;
        margin-bottom: 8px;
    }

    #nearest-bin-info {
        font-size: 12px;
        margin-bottom: 3px;
    }

    .nearest-bin-toggle {
        font-size: 10px;
    }

    .nearest-bin-button {
        padding: 6px 12px;
        font-size: 18px;
        margin-left: auto;
        margin-right: auto;
    }
}

/* Heartbeat animation for nearest bin */
.nearest-bin-marker {
    position: relative;
    z-index: 1;
}

.nearest-bin-marker::before {
    content: '';
    position: absolute;
    width: 30px;
    height: 30px;
    left: 35%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: rgba(46, 74, 125, 0.5);
    border-radius: 50%;
    animation: heartbeat 1.2s ease-out infinite;
    z-index: 0;
    pointer-events: none;
}

@keyframes heartbeat {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }

    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

.bin-layer-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 60%;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 10px;
}

.map-layer-options {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    max-height: 60%;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 10px;
}

.bin-layer-toggle-menu label {
    flex-direction: row-reverse;
    justify-content: flex-end;
    gap: 1rem;
}

.map-layer-option {
    margin: 0;
    border-bottom: none;
}

.bin-layer-toggle-menu input[type="checkbox"] {
    margin: 0;
    margin-right: 10px;
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--primary-color);
    border-radius: 4px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.bin-layer-toggle-menu input[type="checkbox"]:checked {
    background-color: var(--primary-color);
}

.bin-layer-toggle-menu input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    color: white;
    font-size: 14px;
    left: 2px;
    top: -2px;
}

/* Submit a Bin Section */
.submit-bin-section {
    margin-top: 20px;
    text-align: center;
    padding: 0 20px 20px;
}

.submit-bin-button {
    background-color: white;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    border-radius: 4px;
    padding: 8px 16px;
    /* smaller padding */
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    width: auto;
    /* allows it to shrink to fit content */
}

.submit-bin-button i {
    margin-right: 8px;
}

.submit-bin-button:hover {
    background-color: #f0f0f0;
    /* slightly darker than white */
}

/* Submit Bin Popup */
.submit-bin-popup {
    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: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.submit-bin-popup.show {
    opacity: 1;
    visibility: visible;
}

.submit-bin-content {
    background-color: white;
    border-radius: 8px;
    padding: 30px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

@media (max-width: 768px) {
    .submit-bin-content {
        max-height: 80vh;
        -webkit-overflow-scrolling: touch;
    }
}

.submit-bin-content .popup-title {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
    font-size: 24px;
}

.submit-bin-content p {
    margin-bottom: 20px;
    color: #666;
}

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

.bin-submission-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.bin-submission-form input,
.bin-submission-form select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

/* Improved dropdown select for iOS and better chevron */
.bin-submission-form select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    color: #333;
    background-color: white;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231c3c26' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
    margin-left: 0;
    border-radius: 8px;
    text-overflow: ellipsis;
}

.bin-submission-form input:focus,
.bin-submission-form select:focus {
    border-color: var(--primary-color);
    outline: none;
}

.form-footer {
    margin-top: 25px;
    text-align: right;
}

/* Base button */
.submit-bin-form-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    /* space between text and icon */
    position: relative;
    overflow: hidden;
}

/* Hover effect for normal state */
.submit-bin-form-btn:hover {
    background-color: var(--primary-color-hover);
}

/* Icon slide on hover */
.submit-bin-form-btn:hover i.bi {
    transform: translateX(4px);
    transition: transform 0.3s ease;
}

/* Smooth icon transition always */
.submit-bin-form-btn i.bi {
    transition: transform 0.3s ease;
}

/* Disabled style */
.submit-bin-form-btn.disabled {
    background-color: #ccc;
    cursor: not-allowed;
    pointer-events: none;
    opacity: 0.6;
}

.submit-bin-form-btn.loading {
    position: relative;
    color: transparent !important;
}

.submit-bin-form-btn.loading::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 15px;
    height: 15px;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-top-color: #fff;
    border-radius: 50%;
    animation: button-spinner 0.8s linear infinite;
}

@keyframes button-spinner {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.separator-with-text {
    display: flex;
    align-items: center;
    margin: 20px 0;
    font-size: 14px;
    color: #666;
}

.separator-line {
    flex-grow: 1;
    height: 1px;
    background-color: #e5e5e5;
}

.separator-text {
    padding: 0 12px;
    white-space: nowrap;
    color: #999;
    font-weight: 400;
    letter-spacing: 0.5px;
}

/* Use My Location Button */
.location-btn-container {
    text-align: center;
    margin-bottom: 20px;
}

.use-my-location-btn {
    background-color: #f9f9f9;
    color: #111;
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 12px 18px;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.use-my-location-btn:hover {
    background-color: #f2f2f2;
    border-color: #bbb;
}

.use-my-location-btn i {
    margin-right: 8px;
    color: var(--primary-color);
}

.use-my-location-btn.loading {
    background-color: #e0e0e0;
    color: #888;
    cursor: not-allowed;
    position: relative;
}

.use-my-location-btn.loading i {
    color: #888;
}

.use-my-location-btn.loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    right: 15px;
    border: 2px solid transparent;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: location-button-spinner 0.8s linear infinite;
}

@keyframes location-button-spinner {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.bin-submission-form input:disabled {
    background-color: #f5f5f5;
    color: #888;
    cursor: not-allowed;
}

.consent-message {
    font-size: 0.75rem;
    color: rgba(0, 0, 0, 0.45);
    /* lighter text */
    margin-top: -0.25rem;
    /* pulls message closer */
    transition: font-size 0.3s ease, margin-top 0.3s ease;
}

/* Smaller screens */
@media (max-width: 480px) {
    .consent-message {
        font-size: 0.7rem;
        margin-top: -0.2rem;
    }
}

/* Larger screens */
@media (min-width: 1024px) {
    .consent-message {
        font-size: 0.8rem;
        margin-top: -0.3rem;
    }
}

.toggle-section {
    margin-top: 10px;
}

.toggle-btn {
    font-size: 14px;
    padding: 4px 0;
    color: var(--primary-color);
    font-weight: 500;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;

    display: flex;
    justify-content: space-between;
    /* text left, icon right */
    align-items: center;
    /* vertically center */
    width: 100%;
    /* full container width */
}

.toggle-btn:hover {
    text-decoration: underline;
}

.toggle-icon i {
    font-size: 20px;
    /* bigger icon */
    color: var(--primary-color);
    /* use your brand color */
    transition: transform 0.3s ease;
    /* smooth rotation when toggling */
}

/* Rotate icon when active/open - optional */
.toggle-btn.active .toggle-icon i {
    transform: rotate(45deg);
    /* plus → looks like an "x" or minus */
}

.toggle-content {
    margin-top: 12px;
    /* or 16px for more space */
}

.toggle-content input {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px;
    font-size: 15px;
    transition: border-color 0.2s ease;
}

.toggle-content input:focus {
    border-color: var(--primary-color);
    outline: none;
}

.location-section {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 0;
    /* Remove inner padding to keep alignment */
    margin: 10px 0 30px;
    overflow: hidden;
    /* Ensures clean corner clipping for children */
}

/* Wrap the inner content to handle padding inside without shifting alignment */
.location-section-inner {
    padding: 20px;
}

.section-heading.bin-location {
    margin-bottom: 2px;
}

.section-heading {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 10px;
    color: #333;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}