/*
 * HM Classifieds — New Features CSS
 * Report, Messaging, Offers, Map, Ratings
 * @package HM_Classifieds
 * @since 1.3.0
 */

/* ============================================================
   REPORT LISTING
   ============================================================ */
.hm-report-wrap {
    margin-top: 1rem;
    text-align: right;
}
.hm-report-trigger {
    background: none;
    border: none;
    color: var(--hm-text-muted, #888);
    font-size: 0.8rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
}
.hm-report-trigger:hover { color: var(--hm-danger, #c0392b); background: #fff5f5; }

.hm-report-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.hm-report-modal[hidden] { display: none; }
.hm-report-modal__inner {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    max-width: 420px;
    width: 100%;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.hm-report-modal__close {
    position: absolute;
    top: 1rem; right: 1rem;
    background: none; border: none;
    font-size: 1.1rem; cursor: pointer;
    color: #666; line-height: 1;
}
.hm-report-form__reasons { display: flex; flex-direction: column; gap: 8px; margin: 1rem 0; }
.hm-report-reason {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}
.hm-report-reason:hover { border-color: var(--hm-primary, #2563eb); background: #f0f7ff; }
.hm-report-reason input { accent-color: var(--hm-primary, #2563eb); }
.hm-report-form__details {
    width: 100%; resize: vertical;
    border: 1px solid #e5e7eb; border-radius: 8px;
    padding: 8px 12px; font-size: 0.9rem;
    font-family: inherit;
}
.hm-report-form__actions { display: flex; gap: 8px; margin-top: 1rem; }
.hm-report-form__feedback {
    margin-top: 0.75rem; padding: 10px 12px;
    border-radius: 8px; font-size: 0.875rem;
}
.hm-report-form__feedback--success { background: #f0fdf4; color: #166534; }
.hm-report-form__feedback--error   { background: #fef2f2; color: #991b1b; }

/* ============================================================
   MESSAGE DRAWER
   ============================================================ */
.hm-message-drawer {
    position: fixed;
    bottom: 0; right: 1.5rem;
    width: 360px;
    max-height: 520px;
    background: #fff;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.15);
    z-index: 8000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.hm-message-drawer[hidden] { display: none; }

.hm-message-drawer__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--hm-primary, #2563eb);
    color: #fff;
}
.hm-message-drawer__title {
    display: flex; align-items: center; gap: 8px; min-width: 0;
}
.hm-message-drawer__title strong { display: block; font-size: 0.9rem; }
.hm-message-drawer__title span { font-size: 0.75rem; opacity: 0.8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hm-message-drawer__close {
    background: none; border: none; color: #fff;
    font-size: 1rem; cursor: pointer; flex-shrink: 0;
}
.hm-message-drawer__history {
    flex: 1; overflow-y: auto; padding: 12px 16px;
    display: flex; flex-direction: column; gap: 8px;
}
.hm-message-empty { color: #888; font-size: 0.875rem; text-align: center; margin: auto 0; }
.hm-message-form { padding: 8px 12px 12px; border-top: 1px solid #f0f0f0; }
.hm-message-form__input {
    width: 100%; resize: none;
    border: 1px solid #e5e7eb; border-radius: 8px;
    padding: 8px 10px; font-size: 0.875rem;
    font-family: inherit; margin-bottom: 8px;
}
.hm-message-form__actions { text-align: right; }

/* Message bubbles */
.hm-msg-bubble { max-width: 80%; }
.hm-msg-bubble--mine { align-self: flex-end; }
.hm-msg-bubble--mine .hm-msg-bubble__body {
    background: var(--hm-primary, #2563eb); color: #fff; border-radius: 12px 12px 2px 12px;
}
.hm-msg-bubble--theirs .hm-msg-bubble__body {
    background: #f3f4f6; color: #111; border-radius: 12px 12px 12px 2px;
}
.hm-msg-bubble__body { padding: 8px 12px; font-size: 0.875rem; line-height: 1.45; }
.hm-msg-bubble__time { font-size: 0.7rem; color: #aaa; margin-top: 3px; text-align: right; }

/* ============================================================
   OFFER FORM
   ============================================================ */
.hm-offer-section {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.25rem;
    margin-top: 1.5rem;
}
.hm-offer-section__header h3 { margin: 0 0 4px; font-size: 1rem; }
.hm-offer-section__header p  { margin: 0 0 1rem; color: #666; font-size: 0.875rem; }
.hm-offer-form__amount-row {
    display: flex; align-items: center;
    border: 2px solid #e5e7eb; border-radius: 8px;
    overflow: hidden; margin-bottom: 10px;
}
.hm-offer-form__currency {
    padding: 10px 12px; background: #f9fafb;
    font-weight: 600; color: #374151; font-size: 1rem;
    border-right: 1px solid #e5e7eb;
}
.hm-offer-form__amount {
    border: none; outline: none; padding: 10px 12px;
    font-size: 1rem; width: 100%; font-family: inherit;
}
.hm-offer-form__amount:focus { border-color: var(--hm-primary, #2563eb); }
.hm-offer-form__message {
    width: 100%; resize: none;
    border: 1px solid #e5e7eb; border-radius: 8px;
    padding: 8px 10px; font-family: inherit;
    font-size: 0.875rem; margin-bottom: 10px;
}
.hm-offer-pending {
    display: flex; align-items: center;
    justify-content: space-between;
    background: #fefce8; border: 1px solid #fde047;
    border-radius: 8px; padding: 10px 14px;
}
.hm-offer-pending__badge {
    display: flex; align-items: center; gap: 6px;
    font-size: 0.875rem; color: #713f12;
}
.hm-offer-form__feedback {
    margin-top: 8px; padding: 8px 12px;
    border-radius: 8px; font-size: 0.875rem;
}

/* ============================================================
   INBOX (My Ads → Messages tab)
   ============================================================ */
.hm-inbox {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 520px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
}
@media (max-width: 640px) { .hm-inbox { grid-template-columns: 1fr; } }
.hm-inbox__sidebar { border-right: 1px solid #e5e7eb; overflow-y: auto; }
.hm-inbox__thread {
    display: flex; gap: 10px; padding: 12px 14px;
    border-bottom: 1px solid #f3f4f6;
    text-decoration: none; color: inherit;
    transition: background 0.15s;
    position: relative;
}
.hm-inbox__thread:hover { background: #f9fafb; }
.hm-inbox__thread--active { background: #f0f7ff; }
.hm-inbox__thread--unread .hm-inbox__thread-name { font-weight: 700; }
.hm-inbox__thread-avatar { position: relative; flex-shrink: 0; }
.hm-inbox__unread-dot {
    position: absolute; top: 0; right: 0;
    width: 8px; height: 8px;
    background: var(--hm-primary, #2563eb); border-radius: 50%;
    border: 2px solid #fff;
}
.hm-inbox__thread-info { min-width: 0; }
.hm-inbox__thread-name  { font-size: 0.875rem; font-weight: 600; }
.hm-inbox__thread-listing { font-size: 0.75rem; color: #888; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hm-inbox__thread-preview { font-size: 0.8rem; color: #666; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.hm-inbox__main { display: flex; flex-direction: column; }
.hm-inbox__thread-header {
    padding: 12px 16px; border-bottom: 1px solid #f0f0f0;
}
.hm-inbox__listing-link {
    display: flex; align-items: center; gap: 8px;
    text-decoration: none; color: inherit; font-size: 0.875rem; font-weight: 600;
}
.hm-inbox__messages {
    flex: 1; overflow-y: auto; padding: 16px;
    display: flex; flex-direction: column; gap: 10px;
}
.hm-inbox__message { display: flex; flex-direction: column; }
.hm-inbox__message--mine { align-items: flex-end; }
.hm-inbox__message--theirs { align-items: flex-start; }
.hm-inbox__message-bubble {
    max-width: 75%; padding: 8px 12px;
    border-radius: 12px; font-size: 0.875rem; line-height: 1.45;
}
.hm-inbox__message--mine .hm-inbox__message-bubble { background: var(--hm-primary, #2563eb); color: #fff; border-radius: 12px 12px 2px 12px; }
.hm-inbox__message--theirs .hm-inbox__message-bubble { background: #f3f4f6; border-radius: 12px 12px 12px 2px; }
.hm-inbox__message-time { font-size: 0.7rem; color: #aaa; margin-top: 2px; }
.hm-inbox__reply-form {
    padding: 10px 14px; border-top: 1px solid #f0f0f0;
    display: flex; gap: 8px; align-items: flex-end;
}
.hm-inbox__reply-form textarea {
    flex: 1; resize: none; border: 1px solid #e5e7eb;
    border-radius: 8px; padding: 8px 10px;
    font-family: inherit; font-size: 0.875rem;
}
.hm-inbox__select-prompt {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    color: #bbb; gap: 12px;
}
.hm-inbox__empty { padding: 2rem; text-align: center; color: #888; }

/* ============================================================
   OFFERS DASHBOARD
   ============================================================ */
.hm-offers-section { margin-bottom: 2rem; }
.hm-offers-section__title { font-size: 1rem; font-weight: 700; margin-bottom: 1rem; display: flex; align-items: center; gap: 8px; }
.hm-offer-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; border: 1px solid #e5e7eb; border-radius: 10px;
    margin-bottom: 8px; background: #fff;
}
.hm-offer-row--accepted { border-color: #86efac; background: #f0fdf4; }
.hm-offer-row--declined { border-color: #fca5a5; background: #fef2f2; opacity: 0.75; }
.hm-offer-row--withdrawn { opacity: 0.5; }
.hm-offer-row__amount  { font-size: 1.1rem; font-weight: 700; color: var(--hm-primary, #2563eb); }
.hm-offer-row__listing { font-size: 0.875rem; color: #374151; }
.hm-offer-row__listing a { text-decoration: none; color: inherit; }
.hm-offer-row__from    { font-size: 0.8rem; color: #666; display: flex; align-items: center; gap: 5px; }
.hm-offer-row__message { font-size: 0.8rem; color: #555; font-style: italic; margin-top: 2px; }
.hm-offer-row__time    { font-size: 0.75rem; color: #aaa; }
.hm-offer-row__actions { display: flex; gap: 6px; flex-shrink: 0; }
.hm-offer-status       { font-size: 0.8rem; font-weight: 600; padding: 3px 8px; border-radius: 12px; }
.hm-offer-status--accepted  { background: #dcfce7; color: #166534; }
.hm-offer-status--declined  { background: #fee2e2; color: #991b1b; }
.hm-offer-status--pending   { background: #fef9c3; color: #713f12; }
.hm-offer-status--withdrawn { background: #f3f4f6; color: #6b7280; }

/* ============================================================
   MAP VIEW
   ============================================================ */
.hm-view-toggle {
    display: flex; gap: 0;
    border: 1px solid #e5e7eb; border-radius: 8px; overflow: hidden;
    width: fit-content; margin-bottom: 1rem;
}
.hm-view-toggle__btn {
    display: flex; align-items: center; gap: 6px;
    padding: 7px 14px; background: #fff; border: none;
    font-size: 0.875rem; cursor: pointer; color: #555;
    transition: background 0.15s, color 0.15s;
}
.hm-view-toggle__btn + .hm-view-toggle__btn { border-left: 1px solid #e5e7eb; }
.hm-view-toggle__btn--active { background: var(--hm-primary, #2563eb); color: #fff; }
.hm-view-toggle__btn:hover:not(.hm-view-toggle__btn--active) { background: #f3f4f6; }

.hm-map-container { margin-bottom: 1.5rem; }
.hm-map-container[hidden] { display: none; }
.hm-map-filters { display: flex; gap: 10px; margin-bottom: 10px; }
.hm-map-filters__category {
    padding: 6px 10px; border: 1px solid #e5e7eb; border-radius: 8px;
    font-size: 0.875rem; background: #fff;
}
.hm-leaflet-map { height: 480px; border-radius: 12px; overflow: hidden; border: 1px solid #e5e7eb; }

.hm-map-popup { font-size: 0.85rem; min-width: 200px; }
.hm-map-popup__thumb img { width: 100%; height: 120px; object-fit: cover; border-radius: 6px 6px 0 0; }
.hm-map-popup__body { padding: 8px 10px; }
.hm-map-popup__title { font-weight: 600; color: inherit; text-decoration: none; display: block; margin-bottom: 4px; }
.hm-map-popup__title:hover { color: var(--hm-primary, #2563eb); }
.hm-map-popup__meta { display: flex; justify-content: space-between; font-size: 0.8rem; color: #666; }
.hm-map-popup__price { font-weight: 700; color: var(--hm-primary, #2563eb); }

/* ============================================================
   SELLER RATINGS
   ============================================================ */
.hm-seller-rating-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: 20px;
    font-size: 0.8rem; font-weight: 600;
}
.hm-rating--high { background: #dcfce7; color: #166534; }
.hm-rating--mid  { background: #fef9c3; color: #713f12; }
.hm-rating--low  { background: #fee2e2; color: #991b1b; }
.hm-seller-rating-badge__count { font-weight: 400; opacity: 0.8; }

.hm-rate-transaction {
    border: 1px solid #e5e7eb; border-radius: 12px;
    padding: 1.25rem; margin-top: 1.5rem; background: #fafafa;
}
.hm-rate-transaction h4 { margin: 0 0 4px; font-size: 0.95rem; }
.hm-rate-transaction p  { margin: 0 0 1rem; color: #666; font-size: 0.875rem; }
.hm-rating-form__scores {
    display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap;
}
.hm-rating-score {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 14px; border: 2px solid #e5e7eb; border-radius: 8px;
    cursor: pointer; transition: border-color 0.15s, background 0.15s;
    font-size: 0.875rem;
}
.hm-rating-score:has(input:checked) { border-color: var(--hm-primary, #2563eb); background: #f0f7ff; }
.hm-rating-score__icon { font-size: 1.1rem; }
.hm-rating-form__comment {
    width: 100%; resize: none; border: 1px solid #e5e7eb; border-radius: 8px;
    padding: 8px 10px; font-family: inherit; font-size: 0.875rem; margin-bottom: 10px;
}
.hm-rating-form__feedback { margin-top: 8px; padding: 8px 12px; border-radius: 8px; font-size: 0.875rem; }

/* Saved search alert button */
.hm-save-search-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 14px; border: 1px solid #e5e7eb; border-radius: 8px;
    background: #fff; font-size: 0.875rem; cursor: pointer;
    color: #555; transition: border-color 0.2s, color 0.2s;
}
.hm-save-search-btn:hover { border-color: var(--hm-primary, #2563eb); color: var(--hm-primary, #2563eb); }
.hm-save-search-btn--saved { border-color: var(--hm-primary, #2563eb); background: #f0f7ff; color: var(--hm-primary, #2563eb); }

/* Danger button variant */
.hm-btn--danger {
    background: var(--hm-danger, #c0392b);
    color: #fff; border: none;
}
.hm-btn--danger:hover { background: #a93226; }

/* ── Push notification toggle ── */
#hm-push-toggle {
  display: none;
  background: none;
  border: 1px solid var(--hm-border, #ddd);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--hm-muted, #666);
  transition: border-color 0.2s, color 0.2s;
}
#hm-push-toggle:hover {
  border-color: var(--hm-primary, #0073aa);
  color: var(--hm-primary, #0073aa);
}
