/* ========================================
   AI Investor Tool - Frontend Styles v5.1.0
   Split-Screen Real Estate Listings with Map
   ======================================== */

/* === Container === */
.ait-container {
    max-width: 100%;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #1a1a1a;
    background: #f8f9fa;
}

/* === Header === */
.ait-header {
    background: #ffffff;
    border-bottom: 1px solid #e1e4e8;
    padding: 20px 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.ait-header-content {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.ait-title {
    font-size: 24px;
    font-weight: 600;
    margin: 0;
    color: #1a1a1a;
}

/* === City Selector === */
.city-selector {
    flex: 0 0 auto;
}

.ait-select {
    padding: 10px 15px;
    font-size: 16px;
    border: 2px solid #e1e4e8;
    border-radius: 8px;
    background: #ffffff;
    color: #1a1a1a;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 180px;
    text-align: center;
}

.ait-select:hover {
    border-color: #0066cc;
}

.ait-select:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

/* Mobile centering for select */
@media (max-width: 480px) {
    .ait-select {
        text-align: center !important;
        text-align-last: center !important;
        -webkit-text-align-last: center !important;
        -moz-text-align-last: center !important;
    }
}

/* === Buttons === */
.ait-button {
    padding: 10px 20px;
    font-size: 16px;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.ait-button-primary {
    background: #0066cc;
    color: #ffffff;
}

.ait-button-primary:hover {
    background: #0052a3;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 102, 204, 0.2);
}

.ait-button-secondary {
    background: #ffffff;
    color: #0066cc;
    border: 2px solid #0066cc;
}

.ait-button-secondary:hover {
    background: #0066cc;
    color: #ffffff;
}

.ait-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* === Results Info === */
.ait-results-info {
    margin-left: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
}

.results-count {
    font-size: 18px;
    font-weight: 600;
    color: #0066cc;
}

.results-timestamp {
    font-size: 12px;
    color: #6c757d;
}

/* === Split Container === */
.ait-split-container {
    display: flex;
    height: calc(100vh - 200px);
    min-height: 600px;
    background: #f8f9fa;
}

/* === Listings Panel === */
.ait-listings-panel {
    flex: 0 0 50%;
    background: #f8f9fa;
    border-right: 1px solid #e1e4e8;
    overflow: hidden;
}

.ait-listings-scroll {
    height: 100%;
    overflow-y: auto;
    padding: 20px;
}

/* Custom scrollbar */
.ait-listings-scroll::-webkit-scrollbar {
    width: 8px;
}

.ait-listings-scroll::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.ait-listings-scroll::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.ait-listings-scroll::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* === Listings Grid === */
.ait-listings-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

/* === Listing Card === */
.ait-listing-card {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    cursor: pointer;
}

.ait-listing-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.12);
}

.ait-listing-highlighted {
    border: 3px solid #0066cc;
    box-shadow: 0 8px 24px rgba(0, 102, 204, 0.3);
}

.ait-listing-image {
    position: relative;
    width: 100%;
    height: 250px;
    overflow: hidden;
}

.ait-listing-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.ait-listing-card:hover .ait-listing-image img {
    transform: scale(1.05);
}

.ait-listing-price {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(0, 102, 204, 0.95);
    color: #ffffff;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 18px;
    font-weight: 700;
}

.ait-listing-content {
    padding: 20px;
}

.ait-listing-address {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 12px 0;
    line-height: 1.4;
}

.ait-listing-meta {
    display: flex;
    gap: 15px;
    margin-bottom: 12px;
    color: #6c757d;
    font-size: 14px;
}

.ait-listing-mls {
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 12px;
}

.ait-listing-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #0066cc;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: color 0.2s ease;
}

.ait-listing-link:hover {
    color: #0052a3;
    text-decoration: underline;
}

/* === Load More === */
.ait-load-more-wrapper {
    text-align: center;
    padding: 20px;
}

#ait-load-more-btn {
    min-width: 200px;
}

/* === Loading Indicator === */
.ait-loading {
    text-align: center;
    padding: 40px 20px;
}

.ait-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e1e4e8;
    border-top-color: #0066cc;
    border-radius: 50%;
    margin: 0 auto 15px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.ait-loading p {
    color: #6c757d;
    font-size: 14px;
}

/* === Map Panel === */
.ait-map-panel {
    flex: 0 0 50%;
    position: relative;
    background: #e1e4e8;
}

.ait-map {
    width: 100%;
    height: 100%;
}

/* === Map Controls === */
.ait-map-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ait-map-control-btn {
    width: 40px;
    height: 40px;
    background: #ffffff;
    border: 2px solid #e1e4e8;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.ait-map-control-btn:hover {
    background: #0066cc;
    color: #ffffff;
    border-color: #0066cc;
}

.ait-map-control-btn .dashicons {
    width: 20px;
    height: 20px;
    font-size: 20px;
}

/* === Map Marker === */
.ait-map-marker {
    background: transparent;
    border: none;
}

.ait-marker-pin {
    width: 30px;
    height: 40px;
    background: #0066cc;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.ait-marker-pin::after {
    content: '';
    width: 16px;
    height: 16px;
    background: #ffffff;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* === Map Popup === */
.ait-popup {
    border-radius: 12px;
    overflow: hidden;
}

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

.ait-popup .leaflet-popup-content {
    margin: 0;
    min-width: 250px;
}

.ait-map-popup {
    background: #ffffff;
}

.ait-popup-image {
    width: 100%;
    height: 150px;
    overflow: hidden;
}

.ait-popup-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ait-popup-content {
    padding: 15px;
}

.ait-popup-price {
    font-size: 18px;
    font-weight: 700;
    color: #0066cc;
    margin-bottom: 8px;
}

.ait-popup-address {
    font-size: 14px;
    font-weight: 500;
    color: #1a1a1a;
    margin-bottom: 8px;
    line-height: 1.4;
}

.ait-popup-meta {
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 12px;
}

.ait-popup-link {
    display: inline-block;
    color: #0066cc;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: color 0.2s ease;
}

.ait-popup-link:hover {
    color: #0052a3;
    text-decoration: underline;
}

/* === Footer === */
.ait-footer {
    background: #ffffff;
    border-top: 1px solid #e1e4e8;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ait-footer-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.ait-footer-credit {
    font-size: 12px;
    color: #6c757d;
}

.ait-footer-credit a {
    color: #0066cc;
    text-decoration: none;
}

.ait-footer-credit a:hover {
    text-decoration: underline;
}

/* === Responsive Design === */

/* Tablet */
@media (max-width: 1024px) {
    .ait-split-container {
        flex-direction: column;
        height: auto;
    }
    
    .ait-listings-panel,
    .ait-map-panel {
        flex: 0 0 auto;
        width: 100%;
        border-right: none;
    }
    
    .ait-listings-panel {
        height: 600px;
        border-bottom: 1px solid #e1e4e8;
    }
    
    .ait-map-panel {
        height: 500px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .ait-header-content {
        flex-direction: column;
        align-items: stretch;
    }
    
    .ait-title {
        font-size: 20px;
        text-align: center;
    }
    
    .city-selector {
        width: 100%;
    }
    
    .ait-select {
        width: 100%;
    }
    
    .ait-button {
        width: 100%;
        justify-content: center;
    }
    
    .ait-results-info {
        align-items: center;
        margin-left: 0;
    }
    
    .ait-listings-panel {
        height: 500px;
    }
    
    .ait-map-panel {
        height: 400px;
    }
    
    .ait-footer {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .ait-header,
    .ait-listings-scroll,
    .ait-footer {
        padding: 15px;
    }
    
    .ait-title {
        font-size: 18px;
    }
    
    .ait-listing-image {
        height: 200px;
    }
    
    .ait-listing-address {
        font-size: 16px;
    }
    
    .ait-map-controls {
        top: 10px;
        right: 10px;
    }
}

/* === Dashicons Support === */
.dashicons {
    width: 20px;
    height: 20px;
    font-size: 20px;
}
