body,
html {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Adjust for fixed header and footer */
body {
    padding-top: 56px;
    /* Bootstrap navbar height */
    padding-bottom: 40px;
    /* Footer height estimate */
}

.main-container {
    height: 100%;
    position: relative;
    /* Map takes remaining height */
    height: calc(100vh - 56px - 40px);
}

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

/* InfoWindow styling customizations */
.gm-style-iw {
    font-weight: 400;
}

/* Remove default padding from the wrapper if possible or reduce it */
.gm-style-iw-c {
    padding-top: 10px !important;
    padding-bottom: 10px !important;
    padding-left: 10px !important;
    /* keep padding-right standard to avoid X overlap, or handle in h3 */
}

.info-window-content {
    /* Reduce inner padding since we are controlling outer padding */
    padding: 0 5px 0 0;
    max-width: 260px;
    /* Ensure it doesn't get too wide */
}

.info-window-content h3 {
    margin: 0 20px 8px 0;
    /* Right margin to avoid the X */
    color: #2e7d32;
    font-size: 16px;
    line-height: 1.3;
}

.info-window-content h3 {
    margin: 0 0 8px 0;
    color: #2e7d32;
    /* Green shade */
    font-size: 16px;
}

.info-window-content p {
    margin: 5px 0;
    font-size: 13px;
    color: #555;
}

.info-window-content a {
    color: #1976d2;
    text-decoration: none;
    font-weight: 600;
    display: inline-block;
    margin-top: 5px;
}

.info-window-content a:hover {
    text-decoration: underline;
}

/* Custom Modal for Best Bet (Overlay) */
.modal-custom {
    display: none;
    position: fixed;
    z-index: 2000;
    /* Higher than Bootstrap modal (1055) */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    justify-content: center;
    align-items: center;
}

.modal-custom.show {
    display: flex;
}

.modal-content-custom {
    background-color: #fefefe;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 500px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

/* Best Bet FAB */
.fab-btn {
    position: fixed;
    bottom: 80px;
    /* Moved up to clear footer */
    right: 30px;
    background-color: #ffffff;
    color: #2e7d32;
    border: 3px solid #f9a825;
    /* Added border for visibility */
    border-radius: 50px;
    padding: 15px 25px;
    font-size: 18px;
    /* Slightly larger text */
    font-weight: bold;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    z-index: 900;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s;
}

.fab-btn:hover {
    transform: translateY(-4px);
    /* Larger lift */
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    background-color: #fffde7;
}

.fab-btn .icon {
    font-size: 24px;
    animation: pulse 2s infinite;
}

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

    50% {
        transform: scale(1.2);
    }

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

/* Best Bet Form Styling */
.best-bet-content {
    text-align: left;
}

.close-modal {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
}

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

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #444;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box;
    /* Fix padding expanding width */
    font-size: 14px;
}

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

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

.radio-group {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.radio-group label {
    font-weight: normal;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Toggle Switch */
.toggle-container {
    display: flex;
    align-items: center;
    gap: 15px;
    justify-content: flex-start;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #8bc34a;
    /* Green for Cheap */
    -webkit-transition: .4s;
    transition: .4s;
}

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

/* Checked = Speed (Blue/Red?) Let's go with Blue for Speed */
input:checked+.slider {
    background-color: #2196F3;
}

input:checked+.slider:before {
    -webkit-transform: translateX(24px);
    -ms-transform: translateX(24px);
    transform: translateX(24px);
}

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

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

.action-btn {
    width: 100%;
    padding: 12px;
    background-color: #2e7d32;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 10px;
}

.action-btn:hover {
    background-color: #1b5e20;
}

/* Result Card */
#recommendation-result {
    margin-top: 20px;
    /* Clear default styling as we now have individual cards */
    background: transparent;
    border: none;
    padding: 0;
}

#recommendation-result.hidden {
    display: none;
}

.result-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s;
}

.result-card.best-match {
    background: #e8f5e9;
    border: 2px solid #2e7d32;
    transform: scale(1.02);
}

.result-card:hover {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

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

.result-header h4 {
    margin: 0;
    font-size: 16px;
    color: #333;
    flex-grow: 1;
    margin-left: 10px;
}

.rec-badge {
    background: #2e7d32;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    white-space: nowrap;
}

.rank-badge {
    background: #757575;
    color: white;
    padding: 4px 8px;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    min-width: 24px;
    text-align: center;
}

.result-body p {
    margin: 4px 0;
    font-size: 13px;
    color: #555;
}

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

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

/* Loading Spinner */
.loading-container {
    text-align: center;
    padding: 20px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #f9a825;
    /* Yellow/Gold */
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

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