/**
 * ToAssign Map Page Styles
 *
 * Styles for the interactive real estate map page
 * with filters, markers, and property sidebar.
 *
 * @package ToAssign_Sync
 * @since 1.0.0
 */

.toassign-map-page-wrapper {
    --toassign-ink: #0f172a;
    --toassign-muted: #64748b;
    --toassign-border: #e2e8f0;
    --toassign-surface: #ffffff;
    --toassign-surface-alt: #f8fafc;
    --toassign-accent: #1e3a5f;
    --toassign-accent-strong: #0f2a47;
    --toassign-success: #10b981;
    --toassign-warning: #f59e0b;
    --toassign-danger: #ef4444;
    font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
}

/* ============================================
   Container Layout
   ============================================ */
.toassign-map-container,
.toassign-map-container.toassign-map-layout-modern {
    display: grid !important;
    grid-template-areas:
        "filters filters"
        "sidebar map";
    grid-template-columns: 360px 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    position: relative;
    width: 100%;
    height: 100%;
    background: transparent;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.12);
}

/* ============================================
   Filters Panel (Left Side)
   ============================================ */
.toassign-map-filters {
    grid-area: filters;
    width: 100%;
    background: var(--toassign-surface);
    border-bottom: 1px solid var(--toassign-border);
    display: flex;
    flex-direction: column;
    z-index: 10;
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
}

.toassign-filters-header {
    display: none;
}

.toassign-filters-body {
    flex: 1;
    padding: 16px 22px;
    display: grid;
    grid-template-columns: minmax(220px, 1.6fr) repeat(3, minmax(150px, 1fr)) minmax(200px, 1.2fr) minmax(200px, 1.2fr) auto;
    gap: 14px;
    align-items: end;
    background: #ffffff;
}

.toassign-filter-group {
    margin-bottom: 0;
}

.toassign-filter-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--toassign-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.toassign-filter-group input[type="text"],
.toassign-filter-group input[type="number"],
.toassign-filter-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--toassign-border);
    border-radius: 10px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #ffffff;
    color: var(--toassign-ink);
}

.toassign-filter-group input:focus,
.toassign-filter-group select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.toassign-price-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toassign-price-inputs input {
    flex: 1;
    min-width: 0;
}

.toassign-price-inputs span {
    color: #94a3b8;
    font-weight: 500;
}

.toassign-filter-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    grid-column: auto;
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.toassign-btn-primary {
    width: auto;
    padding: 12px 16px;
    background: var(--toassign-accent);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.toassign-btn-primary:hover {
    background: var(--toassign-accent-strong);
}

.toassign-btn-secondary {
    width: auto;
    padding: 12px 16px;
    background: #ffffff;
    color: var(--toassign-ink);
    border: 1px solid var(--toassign-border);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.toassign-map-fullpage {
    height: 100vh !important;
    min-height: 100vh !important;
}

.toassign-btn-secondary:hover {
    background: #f9fafb;
}

/* ============================================
   Map Area (Center)
   ============================================ */
.toassign-map-area {
    grid-area: map;
    flex: 1;
    position: relative;
    min-width: 0;
    background: #ffffff;
    height: 100%;
}

.toassign-map-area.full-width {
    grid-column: 1 / -1;
}

#toassign-google-map {
    width: 100%;
    height: 100%;
    min-height: 100%;
}

.toassign-map-results-count {
    position: absolute;
    top: 16px;
    left: 16px;
    background: #ffffff;
    padding: 10px 16px;
    border-radius: 12px;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.15);
    font-size: 14px;
    font-weight: 500;
    color: var(--toassign-ink);
    z-index: 5;
}

.toassign-map-results-count span {
    font-weight: 700;
    color: var(--toassign-accent);
}

.toassign-map-controls {
    position: absolute;
    bottom: 24px;
    left: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 5;
}

.toassign-map-controls button {
    width: 40px;
    height: 40px;
    background: #ffffff;
    border: none;
    border-radius: 12px;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, transform 0.2s;
}

.toassign-map-controls button:hover {
    background: #f3f4f6;
    transform: scale(1.05);
}

.toassign-map-controls button.active {
    background: var(--toassign-accent);
    color: #ffffff;
}

.toassign-map-controls button .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* ============================================
   Properties Sidebar (Right Side)
   ============================================ */
.toassign-map-sidebar {
    grid-area: sidebar;
    width: 100%;
    min-width: 0;
    background: #ffffff;
    border-right: 1px solid var(--toassign-border);
    display: flex;
    flex-direction: column;
    z-index: 10;
    transition: transform 0.3s, opacity 0.3s;
}

.toassign-map-sidebar.hidden {
    display: none;
}

.toassign-sidebar-header {
    padding: 16px 20px;
    background: var(--toassign-surface-alt);
    border-bottom: 1px solid var(--toassign-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.toassign-sidebar-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--toassign-accent);
}

.toassign-sidebar-sort select {
    padding: 8px 12px;
    border: 1px solid var(--toassign-border);
    border-radius: 10px;
    font-size: 13px;
    background: #ffffff;
    cursor: pointer;
}

.toassign-sidebar-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #ffffff;
}

/* ============================================
   Property Card
   ============================================ */
.toassign-property-card {
    background: #ffffff;
    border: 1px solid var(--toassign-border);
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 16px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.toassign-property-card:hover,
.toassign-property-card.highlighted {
    transform: translateY(-2px);
    box-shadow: 0 16px 30px rgba(15, 23, 42, 0.15);
    border-color: #3b82f6;
}

.toassign-property-card.active {
    border-color: var(--toassign-accent);
    box-shadow: 0 0 0 2px rgba(30, 58, 95, 0.2);
}

.toassign-property-image {
    position: relative;
    height: 170px;
    overflow: hidden;
    background: #e2e8f0;
}

.toassign-property-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.toassign-property-card:hover .toassign-property-image img {
    transform: scale(1.05);
}

.toassign-property-status {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 10px;
    background: var(--toassign-accent);
    color: #ffffff;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 4px;
}

.toassign-property-status.available,
.toassign-property-status.active {
    background: var(--toassign-success);
}

.toassign-property-status.sold,
.toassign-property-status.leased {
    background: var(--toassign-danger);
}

.toassign-property-status.pending,
.toassign-property-status.conditional {
    background: var(--toassign-warning);
}

.toassign-property-content {
    padding: 16px;
}

.toassign-property-price {
    font-size: 20px;
    font-weight: 700;
    color: var(--toassign-accent);
    margin-bottom: 6px;
}

.toassign-property-title {
    margin: 0 0 6px 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--toassign-ink);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.toassign-property-address {
    margin: 0 0 12px 0;
    font-size: 13px;
    color: var(--toassign-muted);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.toassign-property-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--toassign-border);
}

.toassign-property-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--toassign-muted);
}

.toassign-property-meta .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    color: #94a3b8;
}

.toassign-property-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toassign-property-als {
    font-size: 12px;
    color: #94a3b8;
}

.toassign-property-link {
    font-size: 13px;
    font-weight: 600;
    color: #2563eb;
    text-decoration: none;
    transition: color 0.2s;
}

.toassign-property-link:hover {
    color: var(--toassign-accent);
}

/* ============================================
   Info Window
   ============================================ */
.toassign-infowindow {
    min-width: 280px;
    max-width: 320px;
}

.toassign-infowindow-image {
    position: relative;
    height: 140px;
    margin: -8px -8px 0 -8px;
    overflow: hidden;
}

.toassign-infowindow-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.toassign-infowindow-status {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 10px;
    background: var(--toassign-accent);
    color: #ffffff;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 4px;
}

.toassign-infowindow-status.available,
.toassign-infowindow-status.active {
    background: var(--toassign-success);
}

.toassign-infowindow-status.sold,
.toassign-infowindow-status.leased {
    background: var(--toassign-danger);
}

.toassign-infowindow-status.pending,
.toassign-infowindow-status.conditional {
    background: var(--toassign-warning);
}

.toassign-infowindow-content {
    padding: 12px 0 0;
}

.toassign-infowindow-content h4 {
    margin: 0 0 6px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--toassign-accent);
    line-height: 1.3;
}

.toassign-infowindow-address {
    margin: 0 0 6px 0;
    font-size: 12px;
    color: var(--toassign-muted);
}

.toassign-infowindow-price {
    margin: 0 0 10px 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--toassign-accent);
}

.toassign-infowindow-meta {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--toassign-border);
    font-size: 12px;
    color: var(--toassign-muted);
}

.toassign-infowindow-link {
    display: inline-block;
    padding: 8px 16px;
    background: var(--toassign-accent);
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.toassign-infowindow-link:hover {
    background: var(--toassign-accent-strong);
    color: #ffffff;
}

/* Hide default Google Maps info window close button styling */
.gm-style-iw-c {
    padding: 8px !important;
    border-radius: 12px !important;
}

.gm-style-iw-d {
    overflow: hidden !important;
}

/* ============================================
   Loading and Empty States
   ============================================ */
.toassign-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: var(--toassign-muted);
}

.toassign-loading .spinner {
    margin: 0 0 12px 0;
}

.toassign-no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: var(--toassign-muted);
}

.toassign-error {
    padding: 20px;
    background: #fef2f2;
    color: #dc2626;
    border-radius: 8px;
    text-align: center;
}

/* ============================================
   Responsive Styles
   ============================================ */
@media (max-width: 1200px) {
    .toassign-map-container {
        grid-template-columns: 320px 1fr;
    }
}

@media (max-width: 992px) {
    .toassign-map-container {
        grid-template-areas:
            "filters"
            "map"
            "sidebar";
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr;
        height: auto !important;
    }
    
    .toassign-map-filters {
        width: 100%;
        min-width: 100%;
        position: relative;
    }
    
    .toassign-filters-body {
        grid-template-columns: repeat(2, minmax(160px, 1fr));
    }
    
    .toassign-map-area {
        width: 100%;
        height: 400px !important;
    }
    
    #toassign-google-map {
        min-height: 400px;
    }
    
    .toassign-map-sidebar {
        width: 100%;
        min-width: 100%;
        max-height: 400px;
        border-right: none;
        border-top: 1px solid var(--toassign-border);
    }
    
    .toassign-map-sidebar.hidden {
        display: none;
    }
    
    #toassign-toggle-sidebar {
        display: none;
    }
    
    .toassign-filter-actions {
        flex-direction: row;
        justify-content: flex-start;
        grid-column: 1 / -1;
        margin-top: 6px;
    }
}

@media (max-width: 600px) {
    .toassign-property-card {
        border-radius: 8px;
    }
    
    .toassign-property-image {
        height: 150px;
    }
    
    .toassign-property-content {
        padding: 12px;
    }
    
    .toassign-filters-body {
        padding: 16px;
    }
    
    .toassign-filter-group {
        margin-bottom: 16px;
    }
    
    .toassign-sidebar-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .toassign-sidebar-sort {
        width: 100%;
    }
    
    .toassign-sidebar-sort select {
        width: 100%;
    }

    .toassign-filter-actions {
        flex-direction: column;
        align-items: stretch;
    }
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    .toassign-map-container {
        display: none !important;
    }
}

/* Full Page Map Styles */
.toassign-map-error-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    padding: 40px 20px;
}
.toassign-error-content {
    text-align: center;
    max-width: 500px;
    padding: 40px;
    background: #fef2f2;
    border-radius: 12px;
    border: 1px solid #fecaca;
}
.toassign-error-content h2 {
    color: #dc2626;
    margin: 0 0 16px 0;
}
.toassign-error-content p {
    color: #7f1d1d;
    margin: 0 0 24px 0;
}
.toassign-error-btn {
    display: inline-block;
    padding: 12px 24px;
    background: #1e3a5f;
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
}
.toassign-error-btn:hover {
    background: #2d5a8a;
    color: #fff;
}

.toassign-map-page-wrapper {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
}

.toassign-map-page-header {
    background: linear-gradient(135deg, #1e3a5f 0%, #2d5a8a 100%);
    color: #ffffff;
    padding: 40px 20px;
    text-align: center;
}

.toassign-map-header-content {
    max-width: 800px;
    margin: 0 auto;
}

.toassign-map-page-header h1 {
    margin: 0 0 10px 0;
    font-size: 32px;
    font-weight: 700;
    color: #ffffff;
}

.toassign-map-page-header p {
    margin: 0;
    font-size: 16px;
    opacity: 0.9;
}

.toassign-map-fullpage {
    height: calc(100vh - 180px);
    min-height: 600px;
    border-radius: 0;
    box-shadow: none;
}

/* Override container max-width from theme */
.toassign-map-page-wrapper .toassign-map-container {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
}

/* Responsive adjustments */
@media (max-width: 992px) {
    .toassign-map-page-header {
        padding: 30px 20px;
    }
    
    .toassign-map-page-header h1 {
        font-size: 24px;
    }
    
    .toassign-map-fullpage {
        height: auto;
        min-height: auto;
    }
}
