/* Land Direct Custom Map v1.2.0 - Frontend Styles */
/* Matches main Property Map plugin styling for consistency */

/* Reset and Base */
.ldcm-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

.ldcm-error {
    padding: 20px;
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
    border-radius: 4px;
    margin: 10px 0;
}

/* ============================================
   FILTERS - WHITE BACKGROUND
   ============================================ */
.ldcm-filters {
    background: #fff;
    padding: 12px 15px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    box-sizing: border-box;
    border-bottom: 1px solid #e5e7eb;
    flex-wrap: wrap;
}

.ldcm-filter-row {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 8px;
    align-items: center;
    flex: 1;
}

/* Dropdown styling */
.ldcm-filter-select {
    padding: 8px 12px;
    border: 1px solid #000;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    flex: 1 1 0;
    min-width: 80px;
    max-width: 140px;
    color: #000;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23000' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

.ldcm-filter-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.ldcm-filter-select:hover {
    border-color: #666;
}

/* Reset Button */
.ldcm-reset-btn {
    padding: 8px 20px;
    background: #ef4444;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    color: white;
    cursor: pointer;
    font-weight: 600;
    white-space: nowrap;
    transition: background 0.2s;
}

.ldcm-reset-btn:hover {
    background: #dc2626;
}

/* Search Box */
.ldcm-search-box {
    flex: 0 0 auto;
    margin-left: 10px;
}

.ldcm-search-input {
    padding: 8px 12px;
    border: 1px solid #000;
    border-radius: 4px;
    font-size: 14px;
    width: 180px;
    color: #000;
    background: white;
}

.ldcm-search-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.ldcm-search-input::placeholder {
    color: #666;
}

/* View Toggle */
.ldcm-view-toggle {
    display: flex;
    gap: 0;
    flex: 0 0 auto;
    margin-left: 10px;
    border: 1px solid #000;
    border-radius: 4px;
    overflow: hidden;
}

.ldcm-view-btn {
    padding: 8px 16px;
    border: none;
    background: #fff;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    color: #000;
    font-weight: 500;
    transition: all 0.2s;
    border-right: 1px solid #000;
}

.ldcm-view-btn:last-child {
    border-right: none;
}

.ldcm-view-btn.active {
    background: #1e3a5f;
    color: white;
}

.ldcm-view-btn:hover:not(.active) {
    background: #f3f4f6;
}

.ldcm-view-btn svg {
    width: 16px;
    height: 16px;
}

/* ============================================
   MAIN CONTENT - Embedded Height
   ============================================ */
.ldcm-main {
    display: flex;
    width: 100%;
    height: 600px;
    min-height: 400px;
    position: relative;
}

/* Cards Panel - 38% width */
.ldcm-cards-panel {
    width: 38%;
    position: relative;
    background: #f9fafb;
    box-sizing: border-box;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.ldcm-cards-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    padding-bottom: 80px;
}

/* Load More Container - positioned at bottom of cards panel */
.ldcm-load-more-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    padding: 10px 20px;
    text-align: center;
    background: #09589E;
    z-index: 100;
    box-sizing: border-box;
}

/* List view styles */
.ldcm-main[data-view="list"] .ldcm-cards-panel {
    width: 100%;
    height: 100%;
}

.ldcm-main[data-view="list"] .ldcm-cards-scroll {
    padding: 20px;
}

.ldcm-main[data-view="map"] .ldcm-cards-panel {
    display: none;
}

.ldcm-main[data-view="map"] .ldcm-load-more-container {
    display: none !important;
}

/* Map Panel */
.ldcm-map-panel {
    width: 62%;
    position: relative;
    flex: 1;
}

.ldcm-main[data-view="list"] .ldcm-map-panel {
    display: none;
}

.ldcm-main[data-view="map"] .ldcm-map-panel {
    width: 100%;
}

.ldcm-map {
    width: 100%;
    height: 100%;
    min-height: 100%;
}

/* ============================================
   ZOOM INDICATOR
   ============================================ */
.ldcm-zoom-indicator {
    position: absolute;
    top: 10px;
    right: 50px;
    background: rgba(30, 58, 95, 0.9);
    color: #fff;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    z-index: 100;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ============================================
   APN LABEL OVERLAY (for markers)
   ============================================ */
.ldcm-apn-label {
    position: absolute;
    background: rgba(30, 58, 95, 0.9);
    color: #fff;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
    transform: translate(-50%, 8px);
    z-index: 1;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ============================================
   PROPERTY CARDS - 2 COLUMNS IN SPLIT VIEW
   ============================================ */
.ldcm-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

/* List view - 3 columns */
.ldcm-main[data-view="list"] .ldcm-cards {
    grid-template-columns: repeat(3, 1fr);
    max-width: 1400px;
    margin: 0 auto;
    gap: 20px;
}

.ldcm-main[data-view="list"] .ldcm-card {
    max-width: 420px;
    margin: 0 auto;
}

.ldcm-main[data-view="list"] .ldcm-card-image {
    height: 200px;
}

.ldcm-card {
    background: white;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: box-shadow 0.2s;
}

.ldcm-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.ldcm-card.highlighted {
    box-shadow: 0 0 0 3px #3b82f6;
}

.ldcm-card-image {
    position: relative;
    height: 160px;
    background: #e5e7eb;
    overflow: hidden;
}

.ldcm-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ldcm-card-banner {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #10b981;
    color: white;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 3px;
}

.ldcm-card-content {
    padding: 12px;
}

.ldcm-card-location {
    font-size: 11px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.ldcm-card-title {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
}

.ldcm-card-address {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
    line-height: 1.3;
}

.ldcm-card-price {
    font-size: 18px;
    font-weight: 700;
    color: #10b981;
    margin-bottom: 6px;
    line-height: 1.4;
}

.ldcm-card-terms {
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
}

.ldcm-card-features {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 10px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ldcm-card-btn {
    display: block;
    width: 100%;
    padding: 10px;
    background: #1e3a5f;
    color: white !important;
    text-align: center;
    text-decoration: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.2s;
}

.ldcm-card-btn:hover {
    background: #2563eb;
    color: white !important;
}

/* Load More Button */
.ldcm-load-more {
    padding: 12px 40px !important;
    background: #ffffff !important;
    color: #1e3a5f !important;
    border: none !important;
    border-radius: 6px !important;
    font-size: 15px !important;
    cursor: pointer !important;
    font-weight: 700 !important;
    transition: all 0.2s ease;
    outline: none !important;
    box-shadow: none !important;
}

.ldcm-load-more:hover {
    background: #f0f4f8 !important;
    color: #1e3a5f !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
}

/* No Results */
.ldcm-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
}

.ldcm-no-results h3 {
    font-size: 18px;
    color: #374151;
    margin-bottom: 8px;
}

/* Map Error */
.ldcm-map-error {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 400px;
    background: #fef2f2;
    color: #dc2626;
    font-size: 16px;
    text-align: center;
    padding: 20px;
}

/* No Image Placeholder */
.ldcm-no-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e5e7eb;
    color: #9ca3af;
    font-size: 13px;
}

/* Property Count */
.ldcm-property-count {
    padding: 10px 15px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    font-size: 14px;
    color: #6b7280;
    text-align: center;
}

.ldcm-property-count span {
    font-weight: 600;
    color: #1f2937;
}

/* ============================================
   INFO WINDOW
   ============================================ */
.ldcm-info-window {
    max-width: 280px;
    padding: 5px;
}

.ldcm-info-image {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 8px;
}

.ldcm-info-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.ldcm-info-location {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 6px;
}

.ldcm-info-details {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
}

.ldcm-info-price {
    font-weight: 700;
    color: #10b981;
}

.ldcm-info-btn {
    display: block;
    padding: 8px;
    background: #1e3a5f;
    color: white !important;
    text-align: center;
    text-decoration: none;
    border-radius: 4px;
    font-size: 12px;
    transition: background 0.2s;
}

.ldcm-info-btn:hover {
    background: #2563eb;
    color: white !important;
}

/* ============================================
   LOADING STATE
   ============================================ */
.ldcm-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #6b7280;
}

.ldcm-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: ldcm-spin 0.8s linear infinite;
    margin-right: 10px;
}

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

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1200px) {
    .ldcm-filter-select {
        font-size: 13px;
        padding: 7px 10px;
        min-width: 70px;
        max-width: 120px;
    }
    
    .ldcm-reset-btn,
    .ldcm-view-btn {
        font-size: 13px;
        padding: 7px 14px;
    }
    
    .ldcm-main[data-view="list"] .ldcm-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1000px) {
    .ldcm-filters {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .ldcm-filter-row {
        flex-wrap: wrap !important;
        width: 100%;
    }
    
    .ldcm-filter-select {
        flex: 1 1 calc(33% - 8px);
        max-width: none;
    }
    
    .ldcm-view-toggle {
        margin-left: 0;
    }
    
    .ldcm-cards {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .ldcm-main {
        flex-direction: column;
        height: auto;
        min-height: 500px;
    }
    
    .ldcm-cards-panel,
    .ldcm-map-panel {
        width: 100% !important;
    }
    
    .ldcm-cards-panel {
        max-height: 50vh;
    }
    
    .ldcm-map-panel {
        height: 50vh;
    }
    
    .ldcm-filter-select {
        flex: 1 1 calc(50% - 8px);
    }
    
    .ldcm-main[data-view="list"] .ldcm-cards {
        grid-template-columns: 1fr;
    }
    
    .ldcm-search-input {
        width: 140px;
    }
}
