/* ═══════════════════════════════════════════
   Realmap Users – Plugin Styles
   Uses theme CSS variables from :root
   ═══════════════════════════════════════════ */

/* ── Shared ── */
.rm-required { color: #e53e3e; }

.rm-alert {
    padding: 12px 16px;
    border-radius: var(--og-radius, 8px);
    margin-bottom: 24px;
    font-size: 14px;
    line-height: 1.5;
}
.rm-alert p { margin: 0; }
.rm-alert p + p { margin-top: 4px; }
.rm-alert--error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}
.rm-alert--success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

[data-theme="dark"] .rm-alert--error {
    background: #3b1111;
    border-color: #7f1d1d;
    color: #fca5a5;
}
[data-theme="dark"] .rm-alert--success {
    background: #0d2818;
    border-color: #14532d;
    color: #86efac;
}

/* ── Buttons ── */
.rm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--og-radius, 8px);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
    white-space: nowrap;
}
.rm-btn--primary {
    background: var(--og-primary, #1a56db);
    color: #fff;
    border-color: var(--og-primary, #1a56db);
}
.rm-btn--primary:hover {
    background: var(--og-primary-hover, #1648b8);
    border-color: var(--og-primary-hover, #1648b8);
    color: #fff;
}
.rm-btn--outline {
    background: transparent;
    color: var(--og-text, #101828);
    border-color: var(--og-border, #e5e7eb);
}
.rm-btn--outline:hover {
    background: var(--og-surface-hover, #f3f4f6);
    color: var(--og-text, #101828);
}
.rm-btn--ghost {
    background: transparent;
    color: var(--og-text-soft, #475467);
    border-color: transparent;
}
.rm-btn--ghost:hover {
    background: var(--og-surface-hover, #f3f4f6);
    color: var(--og-text, #101828);
}
.rm-btn--danger {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
}
.rm-btn--danger:hover {
    background: #dc2626;
    color: #fff;
    border-color: #dc2626;
}
[data-theme="dark"] .rm-btn--danger {
    background: #3b1111;
    border-color: #7f1d1d;
    color: #f87171;
}
[data-theme="dark"] .rm-btn--danger:hover {
    background: #dc2626;
    color: #fff;
}
.rm-btn--full { width: 100%; }
.rm-btn--sm { padding: 6px 14px; font-size: 13px; }
.rm-btn--lg { padding: 14px 28px; font-size: 16px; }

/* ── Forms ── */
.rm-form { display: flex; flex-direction: column; gap: 20px; }

.rm-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.rm-field label {
    font-size: 14px;
    font-weight: 500;
    color: var(--og-text, #101828);
}
.rm-field input,
.rm-field select,
.rm-field textarea {
    padding: 10px 14px;
    border: 1px solid var(--og-border, #e5e7eb);
    border-radius: var(--og-radius, 8px);
    font-size: 15px;
    background: var(--og-surface, #fff);
    color: var(--og-text, #101828);
    transition: border-color 0.15s;
    font-family: inherit;
    width: 100%;
    box-sizing: border-box;
}
.rm-field input:focus,
.rm-field select:focus,
.rm-field textarea:focus {
    outline: none;
    border-color: var(--og-primary, #1a56db);
    box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.1);
}
.rm-field textarea { resize: vertical; }
.rm-field-hint {
    font-size: 12px;
    color: var(--og-text-soft, #475467);
}

.rm-form-row { display: flex; gap: 16px; }
.rm-form-row--half > * { flex: 1; min-width: 0; }
.rm-form-row--third > * { flex: 1; min-width: 0; }
@media (max-width: 600px) {
    .rm-form-row { flex-direction: column; }
}

.rm-field--inline {
    flex-direction: row;
    align-items: center;
}

.rm-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--og-text, #101828);
}
.rm-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--og-primary, #1a56db);
    cursor: pointer;
}

.rm-checkboxes-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 24px;
    margin-top: 8px;
}

.rm-checkboxes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.rm-fieldset {
    border: 1px solid var(--og-border, #e5e7eb);
    border-radius: var(--og-radius, 8px);
    padding: 24px;
    margin: 0;
    background: var(--og-surface, #fff);
}
.rm-fieldset legend {
    font-size: 16px;
    font-weight: 600;
    padding: 0 8px;
    color: var(--og-text, #101828);
}
.rm-fieldset__hint {
    font-size: 13px;
    color: var(--og-text-soft, #475467);
    margin: 0 0 12px;
}

.rm-form-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 8px;
}

/* ── Auth pages ── */
.rm-auth-wrap {
    display: flex;
    justify-content: center;
    padding: 48px 16px 64px;
    min-height: 50vh;
}
.rm-auth-card {
    background: var(--og-surface, #fff);
    border: 1px solid var(--og-border, #e5e7eb);
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 460px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.rm-auth-card h2 {
    margin: 0 0 6px;
    font-size: 24px;
    font-weight: 700;
}
.rm-auth-subtitle {
    color: var(--og-text-soft, #475467);
    margin: 0 0 28px;
    font-size: 15px;
}
.rm-auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: var(--og-text-soft, #475467);
}
.rm-auth-footer a {
    color: var(--og-primary, #1a56db);
    text-decoration: none;
    font-weight: 600;
}
.rm-auth-footer a:hover {
    text-decoration: underline;
}

/* ── Dashboard ── */
.rm-dashboard {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 16px 64px;
}
.rm-dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}
.rm-dashboard-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
}

.rm-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}
.rm-stat {
    background: var(--og-surface, #fff);
    border: 1px solid var(--og-border, #e5e7eb);
    border-radius: var(--og-radius, 8px);
    padding: 16px 20px;
    text-align: center;
}
.rm-stat__number {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: var(--og-text, #101828);
    line-height: 1.2;
}
.rm-stat__label {
    font-size: 13px;
    color: var(--og-text-soft, #475467);
}
.rm-stat--published .rm-stat__number { color: #16a34a; }
.rm-stat--pending .rm-stat__number { color: #d97706; }
.rm-stat--draft .rm-stat__number { color: var(--og-text-soft, #475467); }

.rm-dashboard-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}
.rm-tabs {
    display: flex;
    gap: 4px;
    background: var(--og-surface-alt, #f2f4f7);
    border-radius: var(--og-radius, 8px);
    padding: 4px;
}
.rm-tab {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--og-text-soft, #475467);
    text-decoration: none;
    transition: all 0.15s;
}
.rm-tab:hover {
    color: var(--og-text, #101828);
    background: var(--og-surface, #fff);
}
.rm-tab--active {
    background: var(--og-surface, #fff);
    color: var(--og-text, #101828);
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.rm-dashboard-links {
    display: flex;
    gap: 8px;
}

/* ── Listing cards ── */
.rm-listings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}
.rm-listing-card {
    background: var(--og-surface, #fff);
    border: 1px solid var(--og-border, #e5e7eb);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s;
}
.rm-listing-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.rm-listing-card__image {
    position: relative;
    aspect-ratio: 16/10;
    background: var(--og-surface-alt, #f2f4f7);
    overflow: hidden;
}
.rm-listing-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.rm-listing-card__noimage {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 14px;
    color: var(--og-text-soft, #475467);
}
.rm-listing-card__status {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.rm-listing-card__status--publish {
    background: #dcfce7;
    color: #166534;
}
.rm-listing-card__status--pending {
    background: #fef3c7;
    color: #92400e;
}
.rm-listing-card__status--draft {
    background: var(--og-surface-alt, #f2f4f7);
    color: var(--og-text-soft, #475467);
}
[data-theme="dark"] .rm-listing-card__status--publish {
    background: #14532d;
    color: #86efac;
}
[data-theme="dark"] .rm-listing-card__status--pending {
    background: #78350f;
    color: #fcd34d;
}
.rm-listing-card__body {
    padding: 16px;
    flex: 1;
}
.rm-listing-card__title {
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
}
.rm-listing-card__location {
    margin: 0 0 8px;
    font-size: 13px;
    color: var(--og-text-soft, #475467);
}
.rm-listing-card__meta {
    display: flex;
    gap: 12px;
    font-size: 13px;
    color: var(--og-text-soft, #475467);
}
.rm-listing-card__price {
    font-weight: 700;
    color: var(--og-text, #101828);
}
.rm-listing-card__actions {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--og-border, #e5e7eb);
}

/* ── Empty state ── */
.rm-empty-state {
    text-align: center;
    padding: 64px 20px;
    background: var(--og-surface, #fff);
    border: 2px dashed var(--og-border, #e5e7eb);
    border-radius: 12px;
}
.rm-empty-state__icon {
    font-size: 48px;
    margin-bottom: 16px;
}
.rm-empty-state h3 {
    margin: 0 0 8px;
    font-size: 20px;
    font-weight: 600;
}
.rm-empty-state p {
    margin: 0 0 24px;
    color: var(--og-text-soft, #475467);
    font-size: 15px;
}

/* ── Pagination ── */
.rm-pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 32px;
}
.rm-pagination__link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--og-radius, 8px);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    color: var(--og-text-soft, #475467);
    border: 1px solid var(--og-border, #e5e7eb);
    transition: all 0.15s;
}
.rm-pagination__link:hover {
    background: var(--og-surface-hover, #f3f4f6);
    color: var(--og-text, #101828);
}
.rm-pagination__link--active {
    background: var(--og-primary, #1a56db);
    color: #fff;
    border-color: var(--og-primary, #1a56db);
}

/* ── Profile page ── */
.rm-profile-wrap {
    display: flex;
    justify-content: center;
    padding: 32px 16px 64px;
}
.rm-profile-card {
    width: 100%;
    max-width: 680px;
}
.rm-profile-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.rm-profile-card__header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
}

/* ── Submit listing page ── */
.rm-submit-wrap {
    max-width: 800px;
    margin: 0 auto;
    padding: 32px 16px 64px;
}
.rm-submit-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.rm-submit-card__header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
}

.rm-listing-form {
    gap: 28px;
}

/* ── Map ── */
.rm-map {
    height: 320px;
    border-radius: var(--og-radius, 8px);
    border: 1px solid var(--og-border, #e5e7eb);
    overflow: hidden;
}

/* ── Image uploader ── */
.rm-image-previews {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.rm-image-preview {
    position: relative;
    aspect-ratio: 4/3;
    border-radius: var(--og-radius, 8px);
    overflow: hidden;
    border: 2px solid var(--og-border, #e5e7eb);
    background: var(--og-surface-alt, #f2f4f7);
}
.rm-image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.rm-image-preview__cover-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    background: var(--og-primary, #1a56db);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: 4px;
}
.rm-image-preview__actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    gap: 1px;
    opacity: 0;
    transition: opacity 0.15s;
}
.rm-image-preview:hover .rm-image-preview__actions {
    opacity: 1;
}
.rm-image-preview__actions button {
    flex: 1;
    padding: 6px;
    border: none;
    background: rgba(0,0,0,0.6);
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.15s;
}
.rm-image-preview__actions button:hover {
    background: rgba(0,0,0,0.8);
}

.rm-image-dropzone {
    position: relative;
    border: 2px dashed var(--og-border, #e5e7eb);
    border-radius: var(--og-radius, 8px);
    padding: 32px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
}
.rm-image-dropzone:hover,
.rm-image-dropzone.rm-dragover {
    border-color: var(--og-primary, #1a56db);
    background: rgba(26, 86, 219, 0.03);
}
.rm-image-dropzone__input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}
.rm-image-dropzone__label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    pointer-events: none;
}
.rm-image-dropzone__icon {
    font-size: 28px;
    margin-bottom: 4px;
}
.rm-image-dropzone__label span {
    font-size: 14px;
    font-weight: 500;
    color: var(--og-text, #101828);
}
.rm-image-dropzone__label small {
    font-size: 12px;
    color: var(--og-text-soft, #475467);
}

.rm-image-preview--uploading {
    opacity: 0.5;
}
.rm-image-preview--uploading::after {
    content: '';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.7);
}

/* ── Confirm dialog ── */
.rm-confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
}
.rm-confirm-dialog {
    background: var(--og-surface, #fff);
    border-radius: 12px;
    padding: 28px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.rm-confirm-dialog h3 {
    margin: 0 0 8px;
    font-size: 18px;
}
.rm-confirm-dialog p {
    margin: 0 0 24px;
    font-size: 14px;
    color: var(--og-text-soft, #475467);
}
.rm-confirm-dialog__actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ── Header auth links (injected by plugin) ── */
.rm-header-auth {
    display: flex;
    align-items: center;
    gap: 8px;
}
.rm-header-auth__login {
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 500;
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    border-radius: var(--og-radius, 8px);
    transition: color 0.15s;
}
.rm-header-auth__login:hover {
    color: #fff;
}
.rm-header-auth__register {
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    background: var(--og-primary, #1a56db);
    text-decoration: none;
    border-radius: var(--og-radius, 8px);
    transition: background 0.15s;
}
.rm-header-auth__register:hover {
    background: var(--og-primary-hover, #1648b8);
    color: #fff;
}
.rm-header-auth__submit {
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #1a1a2e;
    background: #9ddf25;
    text-decoration: none;
    border-radius: var(--og-radius, 8px);
    transition: opacity 0.15s;
}
.rm-header-auth__submit:hover {
    opacity: 0.9;
    color: #1a1a2e;
}
.rm-header-auth__menu {
    position: relative;
}
.rm-header-auth__trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px 4px 4px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 50px;
    cursor: pointer;
    transition: background 0.15s;
    color: #fff;
    font-family: inherit;
}
.rm-header-auth__trigger:hover {
    background: rgba(255,255,255,0.18);
}
.rm-header-auth__avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--og-primary, #1a56db);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}
.rm-header-auth__name {
    font-size: 13px;
    font-weight: 500;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.rm-header-auth__dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: var(--og-surface, #fff);
    border: 1px solid var(--og-border, #e5e7eb);
    border-radius: var(--og-radius, 8px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    min-width: 180px;
    z-index: 1000;
    overflow: hidden;
}
.rm-header-auth__dropdown--open {
    display: block;
}
.rm-header-auth__dropdown a {
    display: block;
    padding: 10px 16px;
    font-size: 14px;
    color: var(--og-text, #101828);
    text-decoration: none;
    transition: background 0.1s;
}
.rm-header-auth__dropdown a:hover {
    background: var(--og-surface-hover, #f3f4f6);
}
@media (max-width: 600px) {
    .rm-header-auth { gap: 4px; }
    .rm-header-auth__name { display: none; }
    .rm-header-auth__submit span { display: none; }
}

/* ── Page-level language switcher ── */

.rm-lang-switcher--page {
    display: flex;
    justify-content: flex-end;
    gap: 2px;
    margin-bottom: 12px;
    background: #f3f4f6;
    border-radius: 6px;
    padding: 2px;
    width: fit-content;
    margin-left: auto;
}

.rm-lang-switcher--page .rm-lang-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: #6b7280;
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
    line-height: 1;
    cursor: pointer;
}

.rm-lang-switcher--page .rm-lang-btn:hover {
    color: #111827;
    background: #e5e7eb;
}

.rm-lang-switcher--page .rm-lang-btn.is-active {
    color: #fff;
    background: #1a56db;
    pointer-events: none;
}
