/* ============================================================
   Dubai Property CRM — Frontend Styles
   Shared by the Search Bar and Property Listing Grid widgets.
   ============================================================ */

/* ── CSS Variables ── */
:root {
    --dpc-primary:       #0f6cbd;
    --dpc-primary-dark:  #0d5ca5;
    --dpc-accent:        #f59e0b;
    --dpc-text:          #1e293b;
    --dpc-text-muted:    #64748b;
    --dpc-border:        #e2e8f0;
    --dpc-bg-input:      #f8fafc;
    --dpc-radius:        10px;
    --dpc-card-radius:   14px;
    --dpc-shadow:        0 4px 16px rgba(0,0,0,0.08);
    --dpc-shadow-hover:  0 8px 28px rgba(0,0,0,0.14);
    --dpc-transition:    all 0.25s ease;
}

/* ── New Search Bar (Elementor-styleable) ── */
.dpc-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    box-sizing: border-box;
}

.dpc-f-field {
    flex: 1 1 auto;
    position: relative;
}

.dpc-f-input,
.dpc-f-select {
    width: 100%;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    appearance: none;
    -webkit-appearance: none;
}

/* Dropdown arrow indicator */
.dpc-f-has-arrow::after {
    content: '';
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 0; height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid #9ca3af;
    pointer-events: none;
}

/* Keyword search icon */
.dpc-f-keyword {
    position: relative;
}
.dpc-f-keyword .dpc-keyword-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}
.dpc-f-keyword .dpc-f-input {
    padding-left: 42px !important;
}

/* Search button */
.dpc-f-btn-search {
    flex: 0 0 auto;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s;
}
.dpc-f-btn-search:hover {
    transform: scale(1.06);
}
.dpc-f-btn-search:active {
    transform: scale(0.98);
}

@media (max-width: 768px) {
    .dpc-filter-bar {
        border-radius: 16px !important;
    }
    .dpc-f-field {
        flex: 1 1 calc(50% - 8px);
        min-width: calc(50% - 8px) !important;
    }
    .dpc-f-keyword {
        flex: 1 1 100% !important;
    }
}
@media (max-width: 480px) {
    .dpc-f-field {
        flex: 1 1 100% !important;
    }
}

/* ── Custom Filter Field ── */
.dpc-f-custom {
    position: relative;
    transition: all 0.2s ease;
}
.dpc-f-custom .dpc-f-input:hover,
.dpc-f-custom .dpc-f-select:hover {
    border-color: #cbd5e1;
    transition: border-color 0.2s ease;
}

/* ── Field Labels ── */
.dpc-f-label {
    display: none;
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    line-height: 1;
}
.dpc-filter-bar.dpc-show-labels .dpc-f-label {
    display: block;
}
.dpc-filter-bar.dpc-show-labels .dpc-f-has-arrow::after {
    top: calc(50% + 8px);
}
.dpc-filter-bar.dpc-show-labels .dpc-f-keyword .dpc-keyword-icon {
    top: calc(50% + 8px);
}

/* ── Number Range Group ── */
.dpc-f-range-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.dpc-f-range-group .dpc-f-label {
    flex: 0 0 100%;
}
.dpc-f-range-sep {
    font-size: 12px;
    color: #9ca3af;
    white-space: nowrap;
    flex-shrink: 0;
}
.dpc-f-range-input {
    width: 80px;
    min-width: 60px;
    flex: 1 1 auto;
}
/* Hide number input spinner for range fields */
.dpc-f-range-input::-webkit-inner-spin-button,
.dpc-f-range-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.dpc-f-range-input[type="number"] {
    -moz-appearance: textfield;
}

/* ── Legacy Search Form (kept for backward compat) ── */
.dpc-search-form-wrapper {
    background: #fff;
    border-radius: var(--dpc-radius, 10px);
    box-shadow: var(--dpc-shadow, 0 4px 16px rgba(0,0,0,0.08));
    padding: 24px 28px;
}
.dpc-search-form {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: flex-end;
}
.dpc-btn-search {
    background: var(--dpc-primary, #0f6cbd);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 24px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

/* ── Results toolbar ── */
.dpc-results-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.dpc-results-count {
    font-size: 14px;
    color: var(--dpc-text-muted);
}

.dpc-results-count strong {
    color: var(--dpc-text);
    font-weight: 700;
}

/* ── Property Grid ── */
.dpc-property-grid {
    display: grid;
    grid-template-columns: repeat(var(--dpc-cols, 3), 1fr);
    gap: 24px;
}

@media (max-width: 1024px) {
    .dpc-property-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .dpc-property-grid { grid-template-columns: 1fr; }
    .dpc-search-form { gap: 10px; }
    .dpc-field-group { flex: 1 1 100%; }
}

/* ── Property Card ── */
.dpc-property-card {
    background: #fff;
    border-radius: var(--dpc-card-radius);
    overflow: hidden;
    box-shadow: var(--dpc-shadow);
    transition: var(--dpc-transition);
    display: flex;
    flex-direction: column;
}

.dpc-property-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--dpc-shadow-hover);
}

.dpc-card-image-link {
    display: block;
    text-decoration: none;
}

.dpc-card-image {
    width: 100%;
    height: 220px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #e2e8f0;
    position: relative;
}

.dpc-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #fff;
}

.badge-sale    { background: #16a34a; }
.badge-rent    { background: var(--dpc-primary); }
.badge-offplan { background: var(--dpc-accent); color: #1a1a1a; }
.badge-generic { background: #64748b; }

.dpc-card-body {
    padding: 18px 20px 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 6px;
}

.dpc-card-price {
    font-size: 20px;
    font-weight: 800;
    color: var(--dpc-primary);
    letter-spacing: -0.3px;
}

.dpc-card-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    line-height: 1.4;
}

.dpc-card-title a {
    color: var(--dpc-text);
    text-decoration: none;
    transition: color 0.2s;
}

.dpc-card-title a:hover {
    color: var(--dpc-primary);
}

.dpc-card-community {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--dpc-text-muted);
    margin: 0;
}

.dpc-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 4px;
    padding-top: 10px;
    border-top: 1px solid var(--dpc-border);
}

.dpc-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--dpc-text-muted);
    font-weight: 500;
}

.dpc-icon {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.dpc-card-btn {
    display: inline-block;
    margin-top: auto;
    padding-top: 14px;
    font-size: 13px;
    font-weight: 700;
    color: var(--dpc-primary);
    text-decoration: none;
    transition: color 0.2s;
    letter-spacing: 0.02em;
}

.dpc-card-btn:hover {
    color: var(--dpc-primary-dark);
}

/* ── No Results State ── */
.dpc-no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--dpc-text-muted);
}

.dpc-no-results-icon {
    font-size: 52px;
    display: block;
    margin-bottom: 14px;
}

.dpc-no-results p {
    font-size: 16px;
    margin: 4px 0;
}

.dpc-no-results-hint {
    font-size: 14px;
    color: #94a3b8;
}

/* ── Loading Overlay ── */
.dpc-listing-wrapper {
    position: relative;
}

.dpc-loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: var(--dpc-card-radius);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.dpc-listing-wrapper.dpc-is-loading .dpc-loading-overlay {
    opacity: 1;
    pointer-events: all;
}

.dpc-spinner {
    width: 42px;
    height: 42px;
    border: 4px solid var(--dpc-border);
    border-top-color: var(--dpc-primary);
    border-radius: 50%;
    animation: dpc-spin 0.75s linear infinite;
}

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

/* ── Pagination ── */
.dpc-pagination {
    margin-top: 36px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.dpc-page-btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: 1.5px solid var(--dpc-border);
    background: #fff;
    color: var(--dpc-text);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--dpc-transition);
}

.dpc-page-btn:hover,
.dpc-page-btn.active {
    background: var(--dpc-primary);
    border-color: var(--dpc-primary);
    color: #fff;
}

.dpc-page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
