/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Container styles */
.container {
    display: flex;
    height: 100vh;
    width: 100%;
}

#map {
    flex: 1;
    height: 100%;
}

.sidebar {
    width: 300px;
    background-color: #fff;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.sidebar-header {
    padding: 20px;
    background: #fff;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.back-link {
    display: inline-block;
    color: #333;
    text-decoration: none;
    margin-bottom: 15px;
    font-size: 14px;
}

.back-link:hover {
    color: #FF4438;
}

.logo {
    width: 120px;
    height: auto;
    display: block;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.sidebar-bottom {
    padding: 20px;
    background: #fff;
    border-top: 1px solid #eee;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

#map {
    flex-grow: 1;
    height: 100%;
}

#postcode-list {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 20px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 10px;
}

.postcode-item {
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    margin: 4px 0;
    padding: 8px 12px;
    color: #333;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 10px;
}

button {
    padding: 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

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

#download-csv-btn, #download-xls-btn {
    background-color: #FF4438;
    color: white;
}

#download-csv-btn:hover:not(:disabled), 
#download-xls-btn:hover:not(:disabled) {
    background-color: #e63c31;
}

#reset-btn {
    background-color: #333;
    color: white;
    width: 100%;
}

#reset-btn:hover {
    background-color: #444;
}

#city-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 20px 0;
}

.city-item {
    padding: 12px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 4px;
    margin-bottom: 8px;
    position: relative;
}

.city-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-right: 24px;
    margin-bottom: 4px;
}

.city-name {
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

.city-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: #666;
}

.detail-label {
    color: #666;
}

.detail-value {
    text-align: right;
}

.cost-value {
    color: #FF4438;
    font-weight: 500;
}

.remove-city {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 20px;
    height: 20px;
    border: none;
    background: none;
    color: #999;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 50%;
    transition: all 0.2s;
}

.remove-city:hover {
    background: #f5f5f5;
    color: #666;
}

.city-counters {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 15px;
    font-size: 0.9em;
    color: #666;
}

.city-counters div {
    margin-bottom: 2px;
}

.city-counters div:last-child {
    margin-bottom: 0;
    color: #ff4438;
}

#clear-exclusions-btn {
    background-color: #6c757d;
}

#clear-exclusions-btn:hover:not(:disabled) {
    background-color: #5a6268;
}

#clear-exclusions-btn:disabled {
    background-color: #dee2e6;
    cursor: not-allowed;
}

/* Radius Control Styles */
.radius-control {
    background: white;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 10px;
    border: 1px solid #dee2e6;
}

.radius-input-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.radius-control label {
    flex: 1 1 auto;
    margin: 0;
    color: #333;
    min-width: 140px;
}

.radius-control input {
    flex: 0 1 80px;
    padding: 8px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.radius-control button {
    flex: 0 0 auto;
    padding: 8px 15px;
    background-color: #FF4438;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 14px;
}

.radius-control button:hover {
    background-color: #e63e33;
}

/* Diameter Control Styles */
#diameter-control {
    background-color: #f8f9fa;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 15px;
}

#diameter-control label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-size: 14px;
}

.diameter-input-group {
    display: flex;
    gap: 10px;
}

#diameter-input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

#apply-diameter-btn {
    background-color: #2196F3;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

#apply-diameter-btn:hover {
    background-color: #1976D2;
}

/* Postcode Input Styles */
.postcode-input-group {
    margin-top: 15px;
}

.postcode-input-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-size: 14px;
}

.input-with-button {
    display: flex;
    gap: 10px;
}

#postcode-input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    text-transform: uppercase;
}

#apply-postcode-btn {
    background-color: #2196F3;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
    white-space: nowrap;
}

#apply-postcode-btn:hover {
    background-color: #1976D2;
}

/* Map marker styles */
.leaflet-tooltip {
    background-color: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 5px 10px;
    color: #333;
    font-size: 0.9em;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.nearby-marker {
    transition: opacity 0.2s ease-in-out;
}

.nearby-marker-icon {
    background-color: #FF4438;
    border: 2px solid #fff;
    border-radius: 50%;
    width: 12px !important;
    height: 12px !important;
    margin-left: -6px !important;
    margin-top: -6px !important;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: 300px;
    }

    #map {
        height: calc(100vh - 300px);
    }

    .logo {
        width: 120px;
        margin-bottom: 15px;
    }
}

.no-results {
    color: #666;
    text-align: center;
    padding: 20px;
    font-style: italic;
}

.loading, .error {
    text-align: center;
    padding: 15px;
    color: #666;
}

.error {
    color: #dc3545;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
}

/* Filter Button */
.filter-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    border: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: all 0.3s ease;
}

.filter-button:hover {
    background: #f5f5f5;
    transform: scale(1.05);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    position: relative;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.modal-content h2 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 18px;
}

.filter-options {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: #FF4438;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}

.close-button {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
}

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

/* City item modifications for costs */
.city-costs {
    font-size: 11px;
    color: #666;
    margin-top: 4px;
}

.cost-item {
    display: flex;
    justify-content: space-between;
    margin-top: 2px;
}

/* Totals Box Styles */
#totals-box {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 12px;
    margin-bottom: 16px;
    display: none;
}

.totals-header {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
}

.totals-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    font-size: 13px;
}

.totals-row:last-child {
    margin-bottom: 0;
}

.total-label {
    color: #666;
}

.total-value {
    font-weight: 500;
    color: #FF4438;
}
