/* Wellness Portal admin – media manager, article editor & lists */
:root {
    --wp-green: #0a4d3c;
    --wp-green-600: #0d6550;
    --wp-green-50: #e9f2ef;
    --wp-amber: #ffa300;
    --wp-amber-50: #fff5e0;
    --wp-ink: #2c241b;
    --wp-muted: #6b6f73;
    --wp-line: #e6e2dd;
    --wp-bg: #f8f6f4;
    --wp-danger: #c0392b;
    --wp-radius: 12px;
    --wp-shadow: 0 1px 2px rgba(20, 20, 20, .04), 0 6px 24px rgba(20, 20, 20, .06);
}

/* ---------- generic buttons ---------- */
.wpm-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid transparent; border-radius: 999px; padding: 8px 16px; font-size: 14px; font-weight: 500; line-height: 1.2; cursor: pointer; transition: background .15s, border-color .15s, color .15s, box-shadow .15s; background: transparent; color: var(--wp-ink); text-decoration: none; white-space: nowrap; }
.wpm-btn:disabled { opacity: .5; cursor: not-allowed; }
.wpm-btn--primary { background: var(--wp-green); color: #fff; }
.wpm-btn--primary:hover:not(:disabled) { background: var(--wp-green-600); color: #fff; }
.wpm-btn--amber { background: var(--wp-amber); color: #2c241b; }
.wpm-btn--amber:hover:not(:disabled) { background: #f59b00; }
.wpm-btn--soft { background: var(--wp-green-50); color: var(--wp-green); }
.wpm-btn--soft:hover:not(:disabled) { background: #d8e9e3; }
.wpm-btn--ghost { border-color: var(--wp-line); background: #fff; }
.wpm-btn--ghost:hover:not(:disabled), .wpm-btn--ghost.is-active { border-color: var(--wp-green); color: var(--wp-green); }
.wpm-btn--danger { background: #fdecea; color: var(--wp-danger); }
.wpm-btn--danger:hover { background: #f9d6d2; }
.wpm-link-danger { background: none; border: 0; color: var(--wp-danger); padding: 0; font-size: 13px; text-decoration: underline; cursor: pointer; margin-top: 8px; }

/* ---------- media library ---------- */
.wpm { position: relative; display: flex; flex-direction: column; min-height: 0; height: 100%; color: var(--wp-ink); }
.wpm-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--wp-line); background: #fff; }
.wpm-upload-btn { display: inline-flex; align-items: center; gap: 6px; margin: 0; background: var(--wp-green); color: #fff; padding: 9px 18px; border-radius: 999px; font-weight: 500; cursor: pointer; font-size: 14px; }
.wpm-upload-btn:hover { background: var(--wp-green-600); }
.wpm-ico { font-size: 16px; line-height: 1; }
.wpm-search { flex: 1 1 220px; max-width: 360px; }
.wpm-search input { width: 100%; border: 1px solid var(--wp-line); border-radius: 999px; padding: 8px 16px; font-size: 14px; background: var(--wp-bg); }
.wpm-search input:focus { outline: none; border-color: var(--wp-green); background: #fff; box-shadow: 0 0 0 3px rgba(10, 77, 60, .12); }
.wpm-count { margin-left: auto; color: var(--wp-muted); font-size: 13px; }
.wpm-body { display: flex; flex: 1; min-height: 0; }
.wpm-main { position: relative; flex: 1; overflow: auto; padding: 18px; background: var(--wp-bg); }
.wpm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.wpm-tile { position: relative; aspect-ratio: 1; border: 0; padding: 0; border-radius: 10px; overflow: hidden; background: #fff; box-shadow: var(--wp-shadow); cursor: pointer; outline: 3px solid transparent; outline-offset: 2px; transition: outline-color .12s, transform .12s; }
.wpm-tile:hover { transform: translateY(-1px); }
.wpm-tile:focus-visible { outline-color: rgba(10, 77, 60, .4); }
.wpm-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wpm-tile.is-selected { outline-color: var(--wp-green); }
.wpm-check { position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 50%; background: var(--wp-green); color: #fff; font-size: 13px; display: none; align-items: center; justify-content: center; box-shadow: 0 0 0 2px #fff; }
.wpm-tile.is-selected .wpm-check { display: flex; }
.wpm-tile.is-uploading { display: flex; flex-direction: column; justify-content: flex-end; padding: 10px; cursor: default; }
.wpm-tile.is-uploading img { position: absolute; inset: 0; opacity: .45; filter: blur(1px); }
.wpm-tile.is-uploading small { position: relative; font-size: 11px; color: var(--wp-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wpm-progress { position: relative; height: 6px; background: rgba(0, 0, 0, .1); border-radius: 6px; overflow: hidden; margin-bottom: 6px; }
.wpm-progress span { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--wp-green); transition: width .15s; }
.wpm-empty { text-align: center; padding: 60px 20px; color: var(--wp-muted); }
.wpm-empty__icon { font-size: 40px; }
.wpm-muted { color: var(--wp-muted); }
.wpm-more { display: block; margin: 18px auto 0; }
.wpm.is-loading .wpm-grid { opacity: .6; }
.wpm-drop { position: absolute; inset: 10px; z-index: 5; display: none; align-items: center; justify-content: center; text-align: center; border: 2px dashed var(--wp-green); border-radius: 14px; background: rgba(233, 242, 239, .92); color: var(--wp-green); pointer-events: none; }
.wpm-drop div { display: flex; flex-direction: column; gap: 4px; font-size: 18px; }
.wpm-drop span { font-size: 13px; color: var(--wp-muted); }
.wpm.is-dragging .wpm-drop { display: flex; }
.wpm-details { width: 300px; flex-shrink: 0; overflow: auto; padding: 18px; border-left: 1px solid var(--wp-line); background: #fff; display: flex; flex-direction: column; gap: 12px; }
.wpm-details[hidden] { display: none; }
.wpm-details__preview { background: var(--wp-bg); border-radius: 10px; overflow: hidden; display: flex; align-items: center; justify-content: center; max-height: 220px; }
.wpm-details__preview img { max-width: 100%; max-height: 220px; object-fit: contain; }
.wpm-details__meta { display: flex; flex-direction: column; font-size: 12px; color: var(--wp-muted); gap: 2px; word-break: break-all; }
.wpm-details__name { color: var(--wp-ink); font-size: 13px; }
.wpm-details__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.wpm-field { display: flex; flex-direction: column; gap: 4px; margin: 0; font-size: 13px; font-weight: 500; }
.wpm-field em { font-style: normal; font-weight: 400; color: var(--wp-muted); font-size: 12px; }
.wpm-field input, .wpm-field textarea { border: 1px solid var(--wp-line); border-radius: 8px; padding: 7px 10px; font-size: 13px; font-weight: 400; resize: vertical; }
.wpm-field input:focus, .wpm-field textarea:focus { outline: none; border-color: var(--wp-green); box-shadow: 0 0 0 3px rgba(10, 77, 60, .12); }
.wpm-saved { font-size: 12px; color: var(--wp-green); min-height: 16px; }

/* modal */
html.wpm-locked { overflow: hidden; }
.wpm-modal { position: fixed; inset: 0; z-index: 2000; background: rgba(23, 28, 26, .55); display: flex; align-items: center; justify-content: center; padding: 24px; animation: wpmFade .15s ease-out; }
.wpm-modal__panel { width: min(1280px, 100%); height: min(860px, 100%); background: #fff; border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 30px 80px rgba(0, 0, 0, .25); }
.wpm-modal__head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--wp-line); }
.wpm-modal__head h2 { font-size: 18px; margin: 0; }
.wpm-close { border: 0; background: none; font-size: 28px; line-height: 1; color: var(--wp-muted); cursor: pointer; padding: 0 6px; }
.wpm-close:hover { color: var(--wp-ink); }
.wpm-modal__lib { flex: 1; min-height: 0; }
.wpm-modal__foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--wp-line); }
.wpm-sel-info { margin-right: auto; color: var(--wp-muted); font-size: 13px; }
@keyframes wpmFade { from { opacity: 0; } to { opacity: 1; } }

/* image editor */
.wpm-editor { position: fixed; inset: 0; z-index: 2100; background: #15191a; display: flex; flex-direction: column; color: #fff; }
.wpm-editor__bar, .wpm-editor__foot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px 18px; background: #1f2526; }
.wpm-editor__foot { justify-content: flex-end; }
.wpm-editor__group { display: inline-flex; background: #2b3233; border-radius: 999px; padding: 3px; }
.wpm-editor__group button { border: 0; background: transparent; color: #dfe5e3; padding: 6px 12px; border-radius: 999px; font-size: 13px; cursor: pointer; }
.wpm-editor__group button:hover { color: #fff; }
.wpm-editor__group button.is-active { background: var(--wp-amber); color: #2c241b; }
.wpm-editor__size { margin-left: auto; color: #aab4b1; font-size: 13px; font-variant-numeric: tabular-nums; }
.wpm-editor__stage { flex: 1; min-height: 0; padding: 18px; }
.wpm-editor__stage img { display: block; max-width: 100%; max-height: 100%; }
.wpm-editor .wpm-btn--ghost { background: transparent; color: #fff; border-color: #475052; }

/* toasts */
.wpm-toasts { position: fixed; right: 20px; top: 72px; z-index: 3000; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 40px)); }
.wpm-toast { background: var(--wp-ink); color: #fff; padding: 12px 16px; border-radius: 10px; font-size: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .2); animation: wpmUp .2s ease-out; transition: opacity .3s, transform .3s; }
.wpm-toast--success { background: var(--wp-green); }
.wpm-toast--error { background: var(--wp-danger); }
.wpm-toast.is-out { opacity: 0; transform: translateY(8px); }
@keyframes wpmUp { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

@media (max-width: 860px) {
    .wpm-modal { padding: 0; }
    .wpm-modal__panel { border-radius: 0; height: 100%; }
    .wpm-body { flex-direction: column; }
    .wpm-details { width: auto; border-left: 0; border-top: 1px solid var(--wp-line); max-height: 45%; }
    .wpm-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
}

/* ---------- page shell helpers ---------- */
.wp-page { padding: 28px 0 60px; }
.wp-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.wp-page-head h1 { font-size: 26px; margin: 4px 0 0; color: var(--wp-ink); }
.wp-page-head .breadcrumb { margin: 0; }
.wp-card { background: #fff; border-radius: var(--wp-radius); box-shadow: var(--wp-shadow); border: 1px solid #efebe7; }
.wp-card__head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--wp-line); font-weight: 600; font-size: 14px; }
.wp-card__body { padding: 18px; }

/* ---------- article editor ---------- */
.wpe-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.wpe-title { width: 100%; border: 0; border-bottom: 2px solid transparent; font-size: 30px; font-weight: 700; padding: 6px 0; background: transparent; color: var(--wp-ink); font-family: Georgia, "Playfair Display", serif; }
.wpe-title:focus { outline: none; border-bottom-color: var(--wp-green); }
.wpe-title::placeholder { color: #b8b2ab; }
.wpe-permalink { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 13px; color: var(--wp-muted); margin: 6px 0 18px; }
.wpe-permalink input { border: 1px solid transparent; border-radius: 6px; padding: 2px 6px; font-size: 13px; color: var(--wp-green); background: transparent; min-width: 120px; }
.wpe-permalink input:hover, .wpe-permalink input:focus { border-color: var(--wp-line); background: #fff; outline: none; }
.wpe-label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; color: var(--wp-ink); }
.wpe-help { font-size: 12px; color: var(--wp-muted); margin-top: 4px; }
.wpe-textarea { width: 100%; border: 1px solid var(--wp-line); border-radius: 10px; padding: 10px 12px; font-size: 14px; resize: vertical; }
.wpe-textarea:focus { outline: none; border-color: var(--wp-green); box-shadow: 0 0 0 3px rgba(10, 77, 60, .12); }
.wpe-side { position: sticky; top: 80px; display: flex; flex-direction: column; gap: 16px; }
.wpe-status { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--wp-muted); flex-wrap: wrap; }
.wpe-badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.wpe-badge--draft { background: var(--wp-amber-50); color: #9a6200; }
.wpe-badge--published { background: var(--wp-green-50); color: var(--wp-green); }
.wpe-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.wpe-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.wpe-actions .wpm-btn { flex: 1 1 auto; justify-content: center; }
.wpe-autosave { font-size: 12px; color: var(--wp-muted); margin-top: 10px; min-height: 18px; display: flex; align-items: center; gap: 6px; }
.wpe-autosave.is-saving::before { content: ""; width: 10px; height: 10px; border: 2px solid var(--wp-line); border-top-color: var(--wp-green); border-radius: 50%; animation: wpSpin .7s linear infinite; }
.wpe-autosave.is-error { color: var(--wp-danger); }
@keyframes wpSpin { to { transform: rotate(360deg); } }
.wpe-links { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; font-size: 13px; }
.wpe-links a, .wpe-links button { color: var(--wp-green); background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }
.wpe-links .is-danger { color: var(--wp-danger); }

.wpe-featured { position: relative; border: 2px dashed var(--wp-line); border-radius: 12px; min-height: 170px; display: flex; align-items: center; justify-content: center; text-align: center; background: var(--wp-bg); cursor: pointer; overflow: hidden; transition: border-color .15s, background .15s; }
.wpe-featured:hover, .wpe-featured.is-dragging { border-color: var(--wp-green); background: var(--wp-green-50); }
.wpe-featured__empty { padding: 20px; color: var(--wp-muted); font-size: 13px; }
.wpe-featured__empty strong { display: block; color: var(--wp-ink); font-size: 14px; margin-bottom: 4px; }
.wpe-featured img { width: 100%; display: block; max-height: 260px; object-fit: cover; }
.wpe-featured.has-image { border-style: solid; cursor: default; }
.wpe-featured .wpm-progress { position: absolute; left: 14px; right: 14px; bottom: 14px; }
.wpe-featured__tools { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.wpe-featured__tools .wpm-btn { padding: 6px 12px; font-size: 13px; }

.wpe-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-radius: 10px; background: var(--wp-amber-50); border: 1px solid #ffd98a; color: #6b4600; margin-bottom: 16px; font-size: 14px; }
.wpe-banner .wpm-btn { padding: 6px 14px; font-size: 13px; }
.wpe-banner span { flex: 1 1 260px; }

.wpe-select2 .select2-container { width: 100% !important; }
.wpe-editor-wrap .tox-tinymce { border-radius: 12px; border-color: var(--wp-line); }

@media (max-width: 1100px) {
    .wpe-layout { grid-template-columns: 1fr; }
    .wpe-side { position: static; }
}

/* ---------- article list ---------- */
.wpl-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.wpl-tabs a { padding: 7px 14px; border-radius: 999px; color: var(--wp-muted); text-decoration: none; font-size: 14px; font-weight: 500; }
.wpl-tabs a:hover { color: var(--wp-green); background: var(--wp-green-50); }
.wpl-tabs a.is-active { background: var(--wp-green); color: #fff; }
.wpl-tabs .wpl-n { opacity: .75; font-weight: 400; margin-left: 2px; }
.wpl-filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--wp-line); }
.wpl-filters input, .wpl-filters select { border: 1px solid var(--wp-line); border-radius: 999px; padding: 7px 14px; font-size: 14px; background: #fff; }
.wpl-filters input { flex: 1 1 240px; max-width: 380px; }
.wpl-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--wp-green-50); color: var(--wp-green); border-radius: 999px; padding: 5px 12px; font-size: 13px; text-decoration: none; }
.wpl-chip:hover { background: #d8e9e3; color: var(--wp-green); }
.wpl-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.wpl-table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--wp-muted); font-weight: 600; padding: 12px 14px; border-bottom: 1px solid var(--wp-line); background: #fcfbfa; white-space: nowrap; }
.wpl-table td { padding: 14px; border-bottom: 1px solid #f1eeea; vertical-align: top; font-size: 14px; }
.wpl-table tr:hover td { background: #fcfbf9; }
.wpl-thumb { width: 84px; height: 60px; border-radius: 8px; object-fit: cover; background: var(--wp-bg); display: block; }
.wpl-title { font-weight: 600; font-size: 15px; color: var(--wp-ink); text-decoration: none; line-height: 1.35; }
.wpl-title:hover { color: var(--wp-green); text-decoration: underline; }
.wpl-row-actions { display: flex; gap: 12px; font-size: 13px; margin-top: 6px; opacity: .0; transition: opacity .15s; }
.wpl-table tr:hover .wpl-row-actions, .wpl-table tr:focus-within .wpl-row-actions { opacity: 1; }
.wpl-row-actions a, .wpl-row-actions button { color: var(--wp-green); background: none; border: 0; padding: 0; text-decoration: none; cursor: pointer; }
.wpl-row-actions .is-danger { color: var(--wp-danger); }
.wpl-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.wpl-tags a { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--wp-bg); color: var(--wp-ink); text-decoration: none; border: 1px solid var(--wp-line); }
.wpl-tags a:hover { border-color: var(--wp-green); color: var(--wp-green); }
.wpl-cat { color: var(--wp-green); text-decoration: none; font-weight: 500; }
.wpl-cat:hover { text-decoration: underline; }
.wpl-date { white-space: nowrap; color: var(--wp-ink); }
.wpl-date small { display: block; color: var(--wp-muted); }
.wpl-empty { padding: 50px 20px; text-align: center; color: var(--wp-muted); }
@media (hover: none) { .wpl-row-actions { opacity: 1; } }
@media (max-width: 860px) {
    .wpl-table thead { display: none; }
    .wpl-table tr { display: grid; grid-template-columns: 84px 1fr; gap: 4px 14px; padding: 14px; border-bottom: 1px solid var(--wp-line); }
    .wpl-table td { padding: 0; border: 0; }
    .wpl-table td.wpl-c-thumb { grid-row: span 4; }
    .wpl-row-actions { opacity: 1; }
}

/* toolbar drafts shortcut */
.wp-toolbar-link { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; margin-right: 8px; border-radius: 999px; font-size: 14px; font-weight: 500; color: var(--wp-ink); text-decoration: none; border: 1px solid var(--wp-line); background: #fff; }
.wp-toolbar-link:hover { border-color: var(--wp-green); color: var(--wp-green); }
.wp-toolbar-link--primary { background: var(--wp-green); color: #fff; border-color: var(--wp-green); }
.wp-toolbar-link--primary:hover { background: var(--wp-green-600); color: #fff; }
.wp-toolbar-link .wp-count { background: var(--wp-amber); color: #2c241b; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 1px 7px; }
@media (max-width: 700px) { .wp-toolbar-link span.wp-tl-text { display: none; } .wp-toolbar-link { padding: 7px 10px; } }
.wpe-permalink input { flex: 1 1 200px; }
.wpe-select2 .select2-container--default .select2-selection--multiple { border-color: var(--wp-line); border-radius: 10px; min-height: 42px; padding: 3px 6px; }
.wpe-select2 .select2-container--default.select2-container--focus .select2-selection--multiple { border-color: var(--wp-green); box-shadow: 0 0 0 3px rgba(10, 77, 60, .12); }
.wpe-select2 .select2-container--default .select2-selection--multiple .select2-selection__choice { background: var(--wp-green-50); border: 0; color: var(--wp-green); border-radius: 999px; padding: 2px 10px 2px 22px; font-size: 13px; position: relative; }
.wpe-select2 .select2-container--default .select2-selection--multiple .select2-selection__choice__remove { color: var(--wp-green); border: 0; background: none; position: absolute; left: 6px; top: 50%; transform: translateY(-50%); padding: 0; }
.wpe-select2 .select2-container--default .select2-selection--multiple .select2-selection__choice__display { color: var(--wp-green); padding: 0; }
.wpm-editor__stage { position: relative; flex: 1 1 auto; height: 0; overflow: hidden; }
.wpm-editor__stage .cropper-container { max-height: 100%; }
.wpm-editor__bar, .wpm-editor__foot { position: relative; z-index: 2; }
.wpm-editor__stage { height: auto; min-height: 0; padding: 18px; }
.wpm-editor__canvas { margin: 0 auto; }
.wpm-editor__canvas img { display: block; max-width: 100%; max-height: 100%; }
