/**
 * Property Detail Page Styles
 * Adapts to the active theme's color variables where possible.
 * Scoped under .pm-detail-* and .pm-inq-* to prevent conflicts.
 *
 * @package PropertyManagement
 * @since   2.6.0
 */

/* ─────────────────────────────────────────────────────────────────────────────
   CSS Custom Properties  (override per-theme if needed)
──────────────────────────────────────────────────────────────────────────── */
:root {
    --pm-primary:       #667eea;
    --pm-primary-dark:  #5568d3;
    --pm-primary-light: #eef0fd;
    --pm-success:       #27ae60;
    --pm-danger:        #e74c3c;
    --pm-text:          #2c3e50;
    --pm-text-muted:    #7f8c8d;
    --pm-border:        #e0e0e0;
    --pm-bg:            #f8f9fa;
    --pm-white:         #ffffff;
    --pm-radius:        10px;
    --pm-shadow:        0 4px 20px rgba(0,0,0,.10);
    --pm-font:          -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Page wrapper  (sits inside theme's content area)
──────────────────────────────────────────────────────────────────────────── */
.pm-detail-page-wrapper {
    width: 100%;
    padding: 30px 0 60px;
    font-family: var(--pm-font);
    color: var(--pm-text);
    box-sizing: border-box;
}

.pm-detail-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Back link
──────────────────────────────────────────────────────────────────────────── */
.pm-detail-back {
    margin-bottom: 24px;
}

.pm-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--pm-primary);
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    transition: opacity .2s;
}
.pm-back-link:hover { opacity: .75; text-decoration: none; color: var(--pm-primary); }
.pm-back-link .dashicons { font-size: 18px; width: 18px; height: 18px; }

/* ─────────────────────────────────────────────────────────────────────────────
   Page header
──────────────────────────────────────────────────────────────────────────── */
.pm-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 32px;
    padding-bottom: 28px;
    border-bottom: 2px solid var(--pm-border);
}

.pm-detail-title {
    margin: 0 0 10px !important;
    font-size: clamp(22px, 4vw, 34px) !important;
    color: var(--pm-text) !important;
    line-height: 1.2 !important;
}

.pm-detail-location {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--pm-text-muted);
    font-size: 15px;
    margin: 0 !important;
}
.pm-detail-location .dashicons { font-size: 18px; width: 18px; height: 18px; color: var(--pm-primary); }

/* Status pill */
.pm-status-pill {
    display: inline-block;
    padding: 8px 18px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    white-space: nowrap;
    flex-shrink: 0;
}
.pm-status-available { background: #d4edda; color: #155724; }
.pm-status-rented    { background: #e2e3e5; color: #383d41; }

/* ─────────────────────────────────────────────────────────────────────────────
   Two-column grid
──────────────────────────────────────────────────────────────────────────── */
.pm-detail-content-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 32px;
    align-items: start;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Main column — image
──────────────────────────────────────────────────────────────────────────── */
.pm-detail-image-wrap {
    border-radius: var(--pm-radius);
    overflow: hidden;
    background: linear-gradient(135deg, #667eea, #764ba2);
    margin-bottom: 28px;
    box-shadow: var(--pm-shadow);
}

.pm-detail-main-image {
    display: block;
    width: 100%;
    height: 420px;
    object-fit: cover;
    object-position: center;
}

.pm-detail-image-placeholder {
    height: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: rgba(255,255,255,.6);
}
.pm-detail-image-placeholder .dashicons { font-size: 72px; width: 72px; height: 72px; }
.pm-detail-image-placeholder p { margin: 0; font-size: 16px; }

/* ─────────────────────────────────────────────────────────────────────────────
   Spec pills (bedrooms / bathrooms / rent)
──────────────────────────────────────────────────────────────────────────── */
.pm-detail-specs-grid {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 36px;
}

.pm-spec-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--pm-white);
    border: 1.5px solid var(--pm-border);
    border-radius: var(--pm-radius);
    padding: 14px 20px;
    flex: 1;
    min-width: 110px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    transition: box-shadow .2s;
}
.pm-spec-item:hover { box-shadow: var(--pm-shadow); }

.pm-spec-item.pm-spec-rent {
    border-color: var(--pm-primary);
    background: var(--pm-primary-light);
}

.pm-spec-icon {
    font-size: 28px !important;
    width: 28px !important;
    height: 28px !important;
    color: var(--pm-primary);
    flex-shrink: 0;
}

.pm-spec-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}
.pm-spec-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--pm-text);
}
.pm-spec-label {
    font-size: 12px;
    color: var(--pm-text-muted);
    text-transform: uppercase;
    letter-spacing: .4px;
    font-weight: 600;
}
.pm-spec-rent .pm-spec-value { color: var(--pm-primary); }

/* ─────────────────────────────────────────────────────────────────────────────
   Map section
──────────────────────────────────────────────────────────────────────────── */
.pm-detail-map-section { margin-top: 4px; }

.pm-detail-section-title {
    display: flex !important;
    align-items: center;
    gap: 8px;
    font-size: 20px !important;
    color: var(--pm-text) !important;
    margin: 0 0 16px !important;
}
.pm-detail-section-title .dashicons { color: var(--pm-primary); font-size: 22px; width: 22px; height: 22px; }

.pm-detail-map-wrap {
    border-radius: var(--pm-radius);
    overflow: hidden;
    box-shadow: var(--pm-shadow);
    border: 1px solid var(--pm-border);
}
.pm-detail-map-iframe { display: block; }

/* ─────────────────────────────────────────────────────────────────────────────
   Sidebar contact card
──────────────────────────────────────────────────────────────────────────── */
.pm-detail-sidebar { position: sticky; top: 80px; }

.pm-detail-contact-card {
    background: var(--pm-white);
    border: 1.5px solid var(--pm-border);
    border-radius: var(--pm-radius);
    padding: 28px;
    box-shadow: var(--pm-shadow);
}

.pm-contact-card-header h3 {
    margin: 0 0 8px !important;
    font-size: 19px !important;
    color: var(--pm-text) !important;
}
.pm-contact-card-header p {
    margin: 0 0 20px !important;
    color: var(--pm-text-muted);
    font-size: 14px;
    line-height: 1.5;
}

/* Rent highlight */
.pm-rent-highlight {
    display: flex;
    align-items: baseline;
    gap: 4px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--pm-border);
}
.pm-rent-amount {
    font-size: 40px;
    font-weight: 800;
    color: var(--pm-primary);
    line-height: 1;
}
.pm-rent-period { font-size: 16px; color: var(--pm-text-muted); font-weight: 500; }

/* Rented notice */
.pm-rented-notice {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 6px;
    padding: 12px 14px;
    font-size: 13px;
    color: #5d4037;
    margin-bottom: 16px;
    line-height: 1.4;
}
.pm-rented-notice .dashicons { color: #f59e0b; flex-shrink: 0; margin-top: 1px; }

/* Contact button */
.pm-btn-contact {
    width: 100%;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    font-size: 16px;
    border-radius: 8px;
    margin-bottom: 22px;
}

/* Sidebar detail rows */
.pm-sidebar-details { display: flex; flex-direction: column; gap: 10px; }
.pm-sidebar-detail-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
    color: var(--pm-text-muted);
}
.pm-sidebar-detail-row .dashicons { color: var(--pm-primary); font-size: 18px; width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.pm-sidebar-detail-row strong { color: var(--pm-text); }

/* ─────────────────────────────────────────────────────────────────────────────
   Shared button base (mirrors frontend.css but scoped for detail page additions)
──────────────────────────────────────────────────────────────────────────── */
.pm-detail-page-wrapper .pm-btn,
.pm-inq-modal .pm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: 6px;
    font-family: var(--pm-font);
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: background .2s, transform .15s, box-shadow .2s;
    line-height: 1;
    box-sizing: border-box;
}
.pm-btn-primary { background: var(--pm-primary); color: #fff !important; }
.pm-btn-primary:hover { background: var(--pm-primary-dark); transform: translateY(-2px); box-shadow: 0 6px 16px rgba(102,126,234,.35); color: #fff !important; }
.pm-btn-secondary { background: #95a5a6; color: #fff !important; padding: 12px 28px; font-size: 15px; }
.pm-btn-secondary:hover { background: #7f8c8d; color: #fff !important; }
.pm-btn-block { width: 100%; display: flex; padding: 15px 24px; font-size: 16px; }

/* ─────────────────────────────────────────────────────────────────────────────
   Inquiry Popup Modal
──────────────────────────────────────────────────────────────────────────── */
.pm-inq-modal {
    display: none;
    position: fixed;
    z-index: 99999;
    inset: 0;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}
.pm-inq-modal.active { display: flex; }

/* Overlay */
.pm-inq-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.65);
    cursor: pointer;
    animation: pmFadeIn .25s ease;
}

/* Modal box */
.pm-inq-modal-box {
    position: relative;
    z-index: 1;
    background: var(--pm-white);
    border-radius: 14px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
    animation: pmSlideUp .3s ease;
}

.pm-inq-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 22px 28px;
    border-bottom: 1px solid var(--pm-border);
    position: sticky;
    top: 0;
    background: var(--pm-white);
    border-radius: 14px 14px 0 0;
    z-index: 2;
}
.pm-inq-modal-header h3 {
    margin: 0 !important;
    font-size: 20px !important;
    color: var(--pm-text) !important;
}
.pm-inq-modal-close {
    background: none;
    border: none;
    font-size: 30px;
    line-height: 1;
    color: var(--pm-text-muted);
    cursor: pointer;
    padding: 0;
    transition: color .15s;
    display: flex;
    align-items: center;
}
.pm-inq-modal-close:hover { color: var(--pm-text); }

.pm-inq-modal-body { padding: 28px; }

.pm-inq-modal-address {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--pm-primary);
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 20px !important;
    padding: 10px 14px;
    background: var(--pm-primary-light);
    border-radius: 6px;
}
.pm-inq-modal-address .dashicons { font-size: 16px; width: 16px; height: 16px; flex-shrink: 0; }

/* Form fields */
.pm-inq-form-group { margin-bottom: 18px; }
.pm-inq-form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 700;
    color: var(--pm-text);
}
.pm-inq-required { color: var(--pm-danger); margin-left: 2px; }

.pm-inq-control {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--pm-border);
    border-radius: 7px;
    font-size: 15px;
    font-family: var(--pm-font);
    color: var(--pm-text);
    background: var(--pm-white);
    box-sizing: border-box;
    transition: border-color .2s, box-shadow .2s;
    -webkit-appearance: none;
}
.pm-inq-control:focus {
    outline: none;
    border-color: var(--pm-primary);
    box-shadow: 0 0 0 3px rgba(102,126,234,.18);
}
.pm-inq-control.pm-inq-invalid { border-color: var(--pm-danger); }

/* Error message */
.pm-inq-error {
    background: #fdecea;
    color: #b71c1c;
    border: 1px solid #f9c0ba;
    border-radius: 6px;
    padding: 12px 14px;
    font-size: 14px;
    margin-bottom: 16px;
}

/* Loading spinner */
.pm-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: pmSpin .7s linear infinite;
    vertical-align: middle;
}

/* Thank-you state */
.pm-inq-thankyou {
    padding: 50px 28px;
    text-align: center;
}
.pm-thankyou-icon {
    width: 80px;
    height: 80px;
    background: #d4edda;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
}
.pm-thankyou-icon .dashicons {
    font-size: 48px !important;
    width: 48px !important;
    height: 48px !important;
    color: var(--pm-success) !important;
}
.pm-inq-thankyou h3 {
    font-size: 26px !important;
    color: var(--pm-text) !important;
    margin: 0 0 12px !important;
}
.pm-inq-thankyou p {
    color: var(--pm-text-muted);
    font-size: 16px;
    margin: 0 0 28px !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Animations
──────────────────────────────────────────────────────────────────────────── */
@keyframes pmFadeIn  { from { opacity: 0 } to { opacity: 1 } }
@keyframes pmSlideUp { from { opacity: 0; transform: translateY(30px) } to { opacity: 1; transform: translateY(0) } }
@keyframes pmSpin    { to { transform: rotate(360deg) } }

/* ─────────────────────────────────────────────────────────────────────────────
   Responsive
──────────────────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .pm-detail-content-grid {
        grid-template-columns: 1fr;
    }
    .pm-detail-sidebar {
        position: static;
        order: -1; /* move contact card above image on mobile */
    }
    .pm-rent-highlight { margin-bottom: 16px; padding-bottom: 16px; }
    .pm-detail-main-image { height: 280px; }
}

@media (max-width: 600px) {
    .pm-detail-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .pm-detail-specs-grid { gap: 10px; }
    .pm-spec-item { padding: 12px 14px; min-width: 90px; }
    .pm-spec-value { font-size: 18px; }
    .pm-inq-modal-header { padding: 18px 20px; }
    .pm-inq-modal-body   { padding: 20px; }
    .pm-detail-contact-card { padding: 20px; }
    .pm-rent-amount { font-size: 32px; }
}
