* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5!important;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 10px;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    background-color: white;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 10px;
    flex-shrink: 0;
}

h1 {
    margin-bottom: 8px;
    color: #2c3e50;
    font-size: 1.2rem;
}

/* Measure Tabs */
.measure-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 6px;
}

.measure-tab {
    background: none;
    border: none;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    color: #6c757d;
    cursor: pointer;
    border-radius: 6px 6px 0 0;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.measure-tab:hover {
    background-color: #f8f9fa;
    color: #495057;
}

.measure-tab.active {
    background-color: #007bff;
    color: white;
    box-shadow: 0 2px 4px rgba(0,123,255,0.3);
}

.measure-tab.active:hover {
    background-color: #0056b3;
}

.stats {
    margin-bottom: 8px;
    color: #666;
    font-size: 14px;
}

#measureStats {
    margin-left: 10px;
    font-size: 14px;
    color: #007bff;
    font-weight: 500;
}

/* Property popup links */
.property-links {
    margin-top: 12px;
    display: flex;
    flex-direction: row; /* Side by side instead of stacked */
    gap: 8px;
}

.property-link {
    display: inline-block;
    flex: 1; /* Take equal space when side by side */
    padding: 8px 12px;
    background-color: #4285f4; /* Google blue for high contrast */
    color: white !important; /* Permanent white text for accessibility */
    text-decoration: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600; /* Slightly bolder for better readability */
    text-align: center;
    border: none;
    cursor: pointer;
    min-width: 0; /* Prevent flex issues */
}

/* NO hover effects - permanent high contrast only */
.property-link:hover,
.property-link:focus,
.property-link:active,
.property-link:visited,
.property-link:visited:hover {
    background-color: #4285f4 !important; /* Force same as default */
    color: white !important; /* Force same as default */
    text-decoration: none !important;
    transform: none !important; /* Disable any transforms */
    box-shadow: none !important; /* Disable any box shadows */
}

.property-link:nth-child(2) {
    background-color: #1e7e34; /* Permanent dark green for high contrast */
    color: white; /* Permanent white text for accessibility */
}

.property-link:nth-child(2):hover,
.property-link:nth-child(2):focus,
.property-link:nth-child(2):active,
.property-link:nth-child(2):visited,
.property-link:nth-child(2):visited:hover {
    background-color: #1e7e34 !important; /* Force same as default */
    color: white !important; /* Force same as default */
    text-decoration: none !important;
    transform: none !important; /* Disable any transforms */
    box-shadow: none !important; /* Disable any box shadows */
}

.common-filters, .measure-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 8px;
    background-color: white;
    padding: 10px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.measure-filters {
    border-top: 1px solid #e9ecef;
    background-color: #f8f9fa;
    margin-top: 5px;
}

.measure-filters:empty {
    display: none;
}

/* Info Icon and Tooltip */
.info-icon-container {
    position: relative;
    display: inline-block;
    margin-left: 10px;
}

.info-icon {
    cursor: pointer;
    color: #007bff;
    font-size: 16px;
    font-weight: bold;
    transition: color 0.2s ease;
}

.info-icon:hover {
    color: #0056b3;
}

.measure-criteria-tooltip {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #e8f4fd;
    border: 1px solid #b8ddf2;
    border-radius: 6px;
    padding: 12px;
    font-size: 13px;
    min-width: 300px;
    max-width: 400px;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    margin-top: 8px;
}

.measure-criteria-tooltip:empty {
    display: none;
}

.measure-criteria-tooltip.show {
    opacity: 1;
    visibility: visible;
}

.measure-criteria-tooltip h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: 600;
    color: #0056b3;
}

.criteria-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
}

.criteria-item {
    background-color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    color: #495057;
    border: 1px solid #dee2e6;
}

/* Arrow for tooltip */
.measure-criteria-tooltip {
    --arrow-left: 20px;
    --arrow-right: auto;
}

.measure-criteria-tooltip::before {
    content: '';
    position: absolute;
    top: -6px;
    left: var(--arrow-left);
    right: var(--arrow-right);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid #b8ddf2;
}

.measure-criteria-tooltip::after {
    content: '';
    position: absolute;
    top: -5px;
    left: var(--arrow-left);
    right: var(--arrow-right);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid #e8f4fd;
}

.filter-group {
    margin-right: 0;
}

.filter-group label {
    display: block;
    margin-bottom: 3px;
    font-weight: 500;
    font-size: 13px;
}

.filter-group select,
.filter-group input {
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 100%;
    font-size: 13px;
}

/* Mobile filter improvements */
@media (max-width: 480px) {
    .filter-group label {
        font-size: 12px;
        margin-bottom: 2px;
    }
    
    .filter-group select,
    .filter-group input {
        padding: 5px 6px;
        font-size: 12px;
    }
}

.view-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

.view-controls label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

#map {
    flex: 1;
    min-height: 500px;
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Leaflet Layer Control Styling */
.leaflet-control-layers {
    background: rgba(255, 255, 255, 0.95) !important;
    border-radius: 8px !important;
    border: 1px solid rgba(0,0,0,0.1) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15) !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif !important;
    font-size: 14px !important;
    backdrop-filter: blur(10px);
}

.leaflet-control-layers-expanded {
    padding: 12px !important;
    min-width: 160px !important;
}

.leaflet-control-layers-base label {
    display: flex !important;
    align-items: center !important;
    margin-bottom: 8px !important;
    cursor: pointer !important;
    font-weight: 500 !important;
    color: #2c3e50 !important;
    transition: color 0.2s ease !important;
}

.leaflet-control-layers-base label:hover {
    color: #3498db !important;
}

.leaflet-control-layers-base input[type="radio"] {
    margin-right: 8px !important;
    transform: scale(1.1) !important;
    accent-color: #3498db !important;
}

.leaflet-control-layers-separator {
    margin: 8px 0 !important;
    border-top: 1px solid rgba(0,0,0,0.1) !important;
}

.property-card {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 1000;
}

.property-card.hidden {
    display: none;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
    /* Mobile touch improvements */
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.close-btn:hover {
    color: #333;
    background-color: rgba(0,0,0,0.1);
}

/* Mobile touch improvements */
@media (max-width: 480px) {
    .close-btn {
        font-size: 24px;
        min-width: 48px;
        min-height: 48px;
    }
}

#propertyDetails p {
    margin-bottom: 8px;
    font-size: 14px;
}

#propertyDetails strong {
    color: #2c3e50;
}

footer {
    margin-top: 20px;
    text-align: center;
    color: #666;
    font-size: 0.9em;
}

/* Leaflet custom styles */
.leaflet-popup-content {
    margin: 0;
    padding: 0;
}

.leaflet-popup-content-wrapper {
    padding: 0;
    border-radius: 0;
}

.leaflet-popup-tip {
    background: white;
}

/* Mobile-specific Leaflet fixes */
@media (max-width: 768px) {
    .leaflet-popup {
        /* Prevent popup from being cut off */
        max-width: 90vw !important;
        max-height: 80vh !important;
    }
    
    .leaflet-popup-content-wrapper {
        /* Better mobile styling */
        border-radius: 8px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    }
    
    /* Prevent touch issues with popup */
    .leaflet-popup-content {
        /* Ensure content is touchable */
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -khtml-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
    
    /* Better marker visibility on mobile */
    .leaflet-marker-icon {
        /* Ensure markers are always visible */
        z-index: 1000 !important;
    }
}

.property-popup {
    max-width: 480px; /* Much wider for more square-like proportions */
    min-width: 400px; /* Ensure minimum width */
    padding: 0;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-radius: 8px;
    overflow: hidden;
}

.property-image-container {
    position: relative;
    width: 100%;
    height: 140px; /* Reduced from 200px */
    overflow: hidden;
    background: #f8f9fa;
}

.property-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-nav {
    position: absolute;
    bottom: 8px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 8px;
}

.image-nav button {
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 14px;
    color: white;
    transition: all 0.2s;
}

.image-nav button:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.property-details {
    padding: 12px;
    background: white;
}

.property-details h3 {
    margin: 0 0 8px 0;
    font-size: 15px;
    font-weight: 600;
    color: #212529;
    line-height: 1.2;
}

.property-details p {
    margin: 3px 0;
    font-size: 13px;
    color: #6c757d;
    line-height: 1.3;
}

.property-details b {
    color: #495057;
    font-weight: 600;
}

/* Compact property info grid - optimized for wider popup */
.property-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr; /* 3 columns for wider format */
    gap: 8px 16px;
    margin: 8px 0;
}

/* 2 columns for smaller grids */
.property-info-grid.two-columns {
    grid-template-columns: 1fr 1fr;
}

.property-info-item {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.property-info-label {
    font-size: 11px;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.property-info-value {
    font-size: 13px;
    color: #212529;
    font-weight: 500;
    white-space: normal; /* Allow text to wrap */
    overflow: visible; /* Show all text */
    line-height: 1.3; /* Better spacing for wrapped text */
    word-break: break-word; /* Break long words if needed */
}

/* Full width items for longer content */
.property-info-item.full-width {
    grid-column: 1 / -1;
}

/* Energy rating badge */
.energy-rating-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    color: white;
    background: #dc3545; /* Default red for poor ratings */
}

.energy-rating-badge.rating-a { background: #28a745; }
.energy-rating-badge.rating-b { background: #20c997; }
.energy-rating-badge.rating-c { background: #17a2b8; }
.energy-rating-badge.rating-d { background: #ffc107; color: #212529; }
.energy-rating-badge.rating-e { background: #fd7e14; }
.energy-rating-badge.rating-f { background: #dc3545; }
.energy-rating-badge.rating-g { background: #6f42c1; }

/* Measures list */
.measures-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.measure-badge {
    font-size: 10px;
    padding: 2px 6px;
    background: #e9ecef;
    color: #495057;
    border-radius: 12px;
    font-weight: 500;
}

.see-more-btn {
    display: block;
    width: 100%;
    padding: 8px;
    margin-top: 10px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #333;
    text-align: center;
    cursor: pointer;
    transition: background 0.2s;
}

.see-more-btn:hover {
    background: #e0e0e0;
}

#propertyCard {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    max-width: 400px;
    width: 90%;
    z-index: 1000;
    max-height: 90vh;
    overflow-y: auto;
}

/* Mobile positioning fix */
@media (max-width: 480px) {
    #propertyCard {
        top: 10px;
        right: 10px;
        left: 10px;
        width: auto;
        max-width: none;
        max-height: 80vh;
    }
}

.property-info {
    margin-top: 15px;
}

.property-info p {
    margin: 8px 0;
    font-size: 14px;
    color: #666;
}

.property-info b {
    color: #333;
}

/* Hide markers by default when heatmap is active */
.heatmap-active .leaflet-marker-icon {
    display: none;
}

/* Show markers when zoomed in */
.heatmap-active.zoomed-in .leaflet-marker-icon {
    display: block;
}

/* Use default Leaflet marker */
.leaflet-marker-icon {
    background-image: url('https://unpkg.com/leaflet@1.7.1/dist/images/marker-icon.png');
    background-size: contain;
}

.google-maps-link {
    display: inline-block;
    margin-top: 10px;
    padding: 8px 12px;
    background-color: #4285f4;
    color: #fff !important;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
}

.google-maps-link:hover,
.google-maps-link:active {
    color: #fff !important;
    background-color: #4285f4;
}

.google-maps-link:focus {
    outline: none;
    border: none;
    box-shadow: none;
}

/* Spinner for property image loading */
.property-image-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  background: #f5f5f5;
}
.property-image-spinner .loader {
  border: 4px solid #eee;
  border-top: 4px solid #4285f4;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  0% { transform: rotate(0deg);}
  100% { transform: rotate(360deg);}
} 

#login-container,
#app-container {
  display: none !important;
} 

#logout-link.dropdown-item:active,
#logout-link.dropdown-item:focus,
#logout-link.dropdown-item:focus-visible {
  background-color: transparent !important;
  color: #dc3545 !important;
}

/* Tablet Responsive Styles */
@media (max-width: 768px) and (min-width: 481px) {
    .property-popup {
        max-width: 450px; /* Keep wider on tablets */
        min-width: 350px;
    }
}



/* Mobile Responsive Styles */
@media (max-width: 480px) {
    .info-icon-container {
        margin-left: 5px;
    }
    
    .info-icon {
        font-size: 14px;
    }
    
    .measure-criteria-tooltip {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        min-width: 280px;
        max-width: 320px;
        width: calc(100vw - 40px);
        font-size: 12px;
        padding: 12px;
        margin: 0;
        z-index: 1001;
        box-shadow: 0 8px 32px rgba(0,0,0,0.3);
        border-radius: 8px;
    }
    
    .measure-criteria-tooltip .close-tooltip {
        position: absolute;
        top: 8px;
        right: 8px;
        background: none;
        border: none;
        font-size: 18px;
        color: #666;
        cursor: pointer;
        padding: 0;
        width: 24px;
        height: 24px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
    }
    
    .measure-criteria-tooltip .close-tooltip:hover {
        background-color: #f0f0f0;
        color: #333;
    }
    
    .measure-criteria-tooltip::before,
    .measure-criteria-tooltip::after {
        display: none;
    }
    
    /* Add backdrop for mobile */
    .measure-criteria-tooltip.show::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1000;
    }
    
    .measure-tabs {
        flex-wrap: wrap;
        gap: 4px;
        margin-bottom: 15px;
        overflow-x: auto;
        padding-bottom: 12px;
    }
    
    .measure-tab {
        padding: 8px 12px;
        font-size: 12px;
        white-space: normal;
        text-align: center;
        min-width: 0;
        flex: 1 1 auto;
    }
    
    .common-filters, .measure-filters {
        grid-template-columns: repeat(2, 1fr); /* Force 2 columns on mobile */
        gap: 8px;
        padding: 8px;
    }
    

    
    .measure-criteria {
        padding: 10px 12px;
        margin-bottom: 12px;
        font-size: 13px;
    }
    
    .criteria-list {
        flex-direction: column;
        gap: 6px;
    }
    
    .criteria-item {
        font-size: 12px;
        padding: 3px 6px;
    }
    
    .stats {
        margin-bottom: 12px;
        font-size: 14px;
    }
    
    #measureStats {
        margin-left: 5px;
        font-size: 13px;
    }
    
    .header-content {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .header-content h1 {
        font-size: 20px;
        margin-bottom: 5px;
    }
    
    #map {
        min-height: 450px;
    }
}

@media (max-width: 480px) {
    .measure-tab {
        padding: 6px 8px;
        font-size: 11px;
    }
    
    .measure-criteria h4 {
        font-size: 13px;
    }
    
    .common-filters, .measure-filters {
        grid-template-columns: repeat(2, 1fr); /* Force 2 columns on small mobile */
        gap: 6px;
        padding: 6px;
    }
    
    .criteria-item {
        font-size: 11px;
    }
    
    .measure-tabs {
        gap: 2px;
    }
    
    /* Small mobile property popup adjustments */
    .property-popup {
        max-width: 350px; /* Reasonable width for small mobile */
        min-width: 280px; /* Allow smaller minimum for tiny screens */
    }
    
    .property-image-container {
        height: 120px;
    }
    
    .property-info-grid {
        grid-template-columns: 1fr 1fr; /* Keep 2 columns on small mobile */
        gap: 6px 8px;
    }
    
    .property-info-grid.two-columns {
        grid-template-columns: 1fr 1fr; /* Same as default on mobile */
    }
    
    .property-info-label {
        font-size: 10px;
    }
    
    .property-info-value {
        font-size: 12px;
    }
    
    .property-details h3 {
        font-size: 14px;
    }
    
    .energy-rating-badge {
        font-size: 11px;
        padding: 1px 4px;
    }
    
    .measure-badge {
        font-size: 9px;
        padding: 1px 4px;
    }
    
    .property-links {
        gap: 6px;
        flex-direction: row; /* Keep side by side on mobile */
    }
    
    .property-link {
        flex: 1; /* Maintain equal width on mobile */
        padding: 6px 8px;
        font-size: 12px;
        font-weight: 600; /* Maintain bold text on mobile for accessibility */
    }
    
    /* Ensure green button styling remains on mobile */
    .property-link:nth-child(2) {
        background-color: #1e7e34 !important;
        color: white !important;
    }
}

/* Compact view for smaller screens/laptops */
@media (max-height: 800px) {
    .container {
        padding: 8px;
    }
    
    header {
        padding: 8px 12px;
        margin-bottom: 6px;
    }
    
    h1 {
        font-size: 1.3rem;
        margin-bottom: 6px;
    }
    
    .measure-tabs {
        margin-bottom: 8px;
        padding-bottom: 4px;
    }
    
    .measure-tab {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .stats {
        margin-bottom: 6px;
        font-size: 13px;
    }
    
    .common-filters, .measure-filters {
        padding: 8px;
        margin-bottom: 6px;
    }
    
    .measure-criteria {
        padding: 6px 10px;
        margin-bottom: 4px;
        font-size: 12px;
    }
    
    #map {
        min-height: 400px;
    }
} 