/* =====================================================
   Better Messages — Project Workflow
   ===================================================== */

.dp-workflow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 6px;
    vertical-align: middle;
}

.dp-wf-loading {
    color: #9ca3af;
    font-size: 16px;
    letter-spacing: 3px;
    line-height: 1;
}

.dp-wf {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.dp-wf__label {
    font-size: 0.78rem;
    color: #6b7280;
    font-weight: 500;
    white-space: nowrap;
}

.dp-wf__price {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--dp-ink);
    background: #e8edf3;
    padding: 2px 8px;
    border-radius: 999px;
    white-space: nowrap;
}

.dp-wf__reviewed {
    font-size: 0.78rem;
    color: #16a34a;
    font-weight: 600;
    white-space: nowrap;
}

/* ─── Buttons ───────────────────────────────────────── */
/* Selectors are scoped to .dp-workflow and use !important to win over Better
   Messages' own button styling, which otherwise repaints these solid blue. */

.dp-workflow .dp-btn {
    display: inline-flex !important;
    align-items: center;
    gap: 7px;
    border: none !important;
    border-radius: 10px !important;
    cursor: pointer;
    font-size: 0.8rem !important;
    font-weight: 600 !important;
    letter-spacing: 0.01em;
    padding: 8px 16px !important;
    line-height: 1.2 !important;
    color: #fff !important;
    text-shadow: none;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.10), 0 2px 6px rgba(16, 24, 40, 0.08);
    transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
    white-space: nowrap;
}

.dp-workflow .dp-btn:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(16, 24, 40, 0.16);
    filter: brightness(1.06);
}
.dp-workflow .dp-btn:not(:disabled):active { transform: translateY(0); filter: brightness(0.98); }

.dp-workflow .dp-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

/* Font Awesome icon before each label (FA is enqueued site-wide). */
.dp-workflow .dp-btn::before {
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    font-size: 0.78em;
    opacity: 0.95;
}

.dp-workflow .dp-btn--begin {
    background: linear-gradient(135deg, #3a5a98 0%, #1f3360 100%) !important;
}
.dp-workflow .dp-btn--begin::before { content: "\f04b"; } /* play */

.dp-workflow .dp-btn--complete {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%) !important;
}
.dp-workflow .dp-btn--complete::before { content: "\f00c"; } /* check */

.dp-workflow .dp-btn--review {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%) !important;
}
.dp-workflow .dp-btn--review::before { content: "\f005"; } /* star */

/* Secondary action — clean light button, not a heavy coloured slab. */
.dp-workflow .dp-btn--new-project {
    background: #ffffff !important;
    color: #475569 !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
}
.dp-workflow .dp-btn--new-project::before { content: "\f067"; } /* plus */
.dp-workflow .dp-btn--new-project:not(:disabled):hover {
    background: #f8fafc !important;
    color: #1e293b !important;
    border-color: #cbd5e1 !important;
    filter: none;
}

/* ─── Price area (mutually-approved price) ─────────────── */
.dp-wf__price-area {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.dp-wf__price-pill {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--dp-ink);
    background: #e8edf3;
    padding: 3px 10px;
    border-radius: 999px;
    white-space: nowrap;
}

.dp-wf__price-prompt {
    font-size: 0.78rem;
    color: #374151;
    white-space: nowrap;
}
.dp-wf__price-prompt strong { color: var(--dp-ink); }

.dp-wf__price-note {
    font-size: 0.72rem;
    color: #9ca3af;
    white-space: nowrap;
}

.dp-workflow .dp-btn--price-set,
.dp-workflow .dp-btn--price-accept,
.dp-workflow .dp-btn--price-decline {
    padding: 5px 12px !important;
    font-size: 0.75rem !important;
}

.dp-workflow .dp-btn--price-accept {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%) !important;
}
.dp-workflow .dp-btn--price-accept::before { content: "\f00c"; } /* check */

.dp-workflow .dp-btn--price-set,
.dp-workflow .dp-btn--price-decline {
    background: #ffffff !important;
    color: #475569 !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
}
.dp-workflow .dp-btn--price-set::before { content: "\f153"; } /* euro sign */
.dp-workflow .dp-btn--price-decline::before { content: "\f00d"; } /* times */
.dp-workflow .dp-btn--price-set:not(:disabled):hover,
.dp-workflow .dp-btn--price-decline:not(:disabled):hover {
    background: #f8fafc !important;
    color: #1e293b !important;
    border-color: #cbd5e1 !important;
    filter: none;
}

/* Read-only agreed price on the review form */
.dp-review-form__agreed {
    margin: 0;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.dp-review-form__agreed-amount {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--dp-ink);
}

/* ─── Workflow event messages (rendered as centered system notes) ─────────
   These are real messages (so they notify natively), tagged with dp_event meta
   and given the .dp-event-msg class by the single_message_class JS filter. We
   restyle them to read as a neutral system note rather than a chat bubble:
   no avatar, no name/time, centered muted text with a small icon.
   Selectors are defensive (Better Messages' message markup is React-rendered);
   adjust if a future plugin update changes the internal classes. */

.bm-message.dp-event-msg {
    justify-content: center !important;
    text-align: center;
    margin: 10px 0 !important;
}

/* Hide the avatar and the name/time meta for these rows. */
.bm-message.dp-event-msg img,
.bm-message.dp-event-msg [class*="avatar"],
.bm-message.dp-event-msg .bm-message-info {
    display: none !important;
}

/* Strip the bubble and centre the text. */
.bm-message.dp-event-msg .bm-message-content {
    background: transparent !important;
    box-shadow: none !important;
    margin: 0 auto !important;
    max-width: 90%;
    padding: 0 !important;
}

.bm-message.dp-event-msg .bm-message-content-text,
.bm-message.dp-event-msg .bm-message-content {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    justify-content: center;
    background: #eef1f4 !important;
    border-radius: 999px;
    padding: 5px 14px !important;
    font-size: 0.78rem !important;
    font-weight: 600;
    font-style: normal !important;
    line-height: 1.3;
}

/* Force readable dark text. Better Messages colours EVERY descendant of an
   outgoing ("my") bubble white via a 10-class !important rule, which buried a
   normal override — so this selector is deliberately built to outrank it
   (≈0,11,0) and is side-agnostic so both parties' notices read the same. */
.bp-messages-wrap .bm-messages-list .bm-list .bm-messages-stack .bm-content .bm-messages-listing .bm-message.dp-event-msg.dp-event-msg .bm-message-content:not(.bm-hide-background),
.bp-messages-wrap .bm-messages-list .bm-list .bm-messages-stack .bm-content .bm-messages-listing .bm-message.dp-event-msg.dp-event-msg .bm-message-content:not(.bm-hide-background) * {
    color: #374151 !important;
}

/* Per-event icon (Font Awesome is enqueued site-wide), in a strong colour so it
   stands out against the muted note. ::before isn't hit by the white-text rule
   above, so an explicit colour here wins outright. */
.bm-message.dp-event-msg .bm-message-content-text::before {
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    font-size: 0.9em;
}
.bm-message.dp-event-msg--begin    .bm-message-content-text::before { content: "\f04b"; color: #2563eb !important; } /* play  — blue  */
.bm-message.dp-event-msg--price    .bm-message-content-text::before { content: "\f2b5"; color: #16a34a !important; } /* handshake — green */
.bm-message.dp-event-msg--complete .bm-message-content-text::before { content: "\f00c"; color: #16a34a !important; } /* check — green */
.bm-message.dp-event-msg--review   .bm-message-content-text::before { content: "\f005"; color: #f59e0b !important; } /* star  — gold  */
.bm-message.dp-event-msg--info     .bm-message-content-text::before { content: "\f05a"; color: #2563eb !important; } /* info  — blue  */

/* ─── Price modal ───────────────────────────────────── */

.dp-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.52);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
}

.dp-modal {
    background: #fff;
    border-radius: 10px;
    padding: 28px 30px 24px;
    width: min(360px, 90vw);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.22);
}

.dp-modal__title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--dp-ink);
    margin: 0 0 6px;
}

.dp-modal__sub {
    font-size: 0.8rem;
    color: #6b7280;
    margin: 0 0 18px;
    line-height: 1.45;
}

.dp-modal__price-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 20px;
}

.dp-modal__currency {
    font-size: 1.05rem;
    font-weight: 700;
    color: #374151;
}

.dp-modal__price-input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.13s;
}
.dp-modal__price-input:focus { border-color: var(--dp-ink); }

.dp-modal__actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.dp-modal__skip {
    background: transparent;
    border: 1px solid #d1d5db;
    color: #6b7280;
    border-radius: 6px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 500;
    transition: background 0.13s;
}
.dp-modal__skip:hover { background: #f3f4f6; }

.dp-modal__confirm {
    background: var(--dp-primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 18px;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 700;
    transition: background 0.13s;
}
.dp-modal__confirm:hover { background: var(--dp-primary-dark); }

/* ─── Leave a Review page ───────────────────────────────── */

.dp-review-page {
    max-width: 620px;
    margin: 48px auto;
    padding: 0 20px;
}

.dp-review-page__inner {
    background: #fff;
    border-radius: 10px;
    padding: 36px 40px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.08);
}

.dp-review-page__title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--dp-ink);
    margin: 0 0 24px;
    line-height: 1.3;
}

.dp-review-page__name {
    color: #2d4a7a;
}

.dp-review-page__body {
    color: #4b5563;
    margin: 0 0 20px;
}

.dp-review-page__back {
    color: #6b7280;
    font-size: 0.88rem;
    text-decoration: none;
}
.dp-review-page__back:hover { color: var(--dp-ink); }

.dp-review-page__error {
    background: #fef2f2;
    color: #dc2626;
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 0.88rem;
    margin-bottom: 20px;
}

/* ─── Review form fields ─────────────────────────────────── */

.dp-review-form__field {
    margin-bottom: 22px;
}

.dp-review-form__label {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.dp-review-form__optional {
    font-weight: 400;
    color: #9ca3af;
    margin-left: 4px;
}

.dp-review-form__textarea {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 10px 14px;
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    outline: none;
    transition: border-color 0.13s;
    box-sizing: border-box;
}
.dp-review-form__textarea:focus { border-color: var(--dp-ink); }

.dp-review-form__price-row {
    display: flex;
    align-items: center;
    gap: 6px;
    max-width: 180px;
}

.dp-review-form__currency {
    font-weight: 700;
    color: #374151;
}

.dp-review-form__price-input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.13s;
}
.dp-review-form__price-input:focus { border-color: var(--dp-ink); }

.dp-review-form__note {
    font-size: 0.78rem;
    color: #9ca3af;
    margin: 5px 0 0;
}

.dp-review-form__submit {
    background: var(--dp-primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 10px 22px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.13s;
    margin-top: 6px;
}
.dp-review-form__submit:hover { background: var(--dp-primary-dark); }

/* ─── Star rating input ──────────────────────────────────── */

/*
 * Stars are rendered in reverse DOM order (5→1) so that the CSS
 * general-sibling selector (~) can highlight "this star and lower"
 * without JavaScript. flex-direction: row-reverse restores visual
 * left-to-right order (1→5) on screen.
 */

.dp-star-rating {
    display: inline-flex;
    flex-direction: row-reverse;
    gap: 2px;
}

.dp-star-rating input[type="radio"] {
    display: none;
}

.dp-star-rating label {
    font-size: 2rem;
    color: #d1d5db;
    cursor: pointer;
    transition: color 0.1s;
    line-height: 1;
    padding: 0 2px;
}

/* Checked: colour the selected star and every star to its left (visually),
   which are its following siblings in the reversed DOM order. */
.dp-star-rating input:checked + label,
.dp-star-rating input:checked ~ label {
    color: #f59e0b;
}

/* Hover: same pattern — highlight hovered star + all to its left. */
.dp-star-rating label:hover,
.dp-star-rating label:hover ~ label {
    color: #f59e0b;
}

/* ─── Push opt-in banner (messages page, above the chat) ─────────────────
   Rendered hidden by push.php::inject_prompt_banner(); push-init.js reveals
   it only when push is supported and permission hasn't been asked yet. */

.dp-push-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin: 0 0 16px;
    padding: 12px 16px;
    background: var(--dp-chip-bg);
    border: 1px solid var(--dp-chip-border);
    border-radius: 8px;
}

/* display:flex above would defeat the hidden attribute — restore it. */
.dp-push-banner[hidden] {
    display: none;
}

.dp-push-banner__text {
    color: var(--dp-ink);
    font-size: 14px;
    line-height: 1.4;
}

.dp-push-banner__text::before {
    content: "\f0f3"; /* bell */
    font-family: "Font Awesome 5 Free", "FontAwesome";
    font-weight: 900;
    color: var(--dp-primary);
    margin-right: 8px;
}

.dp-push-banner__button {
    flex-shrink: 0;
    padding: 8px 16px;
    background: var(--dp-primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.dp-push-banner__button:hover {
    background: var(--dp-primary-dark);
}

/* =====================================================
   PWA install nudge bar (site-wide, fixed to bottom)
   Rendered hidden by includes/pwa.php; revealed by
   assets/js/pwa-install.js only when install is possible.
   Mimics Chrome's own mini-infobar placement.
   ===================================================== */
.dp-install-banner {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 99990;
    max-width: 560px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px 16px;
    padding: 12px 16px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.18);
}

/* The [hidden] attribute must win over display:flex above */
.dp-install-banner[hidden] {
    display: none;
}

.dp-install-banner__text {
    color: var(--dp-ink);
    font-size: 14px;
    line-height: 1.4;
}

.dp-install-banner__text::before {
    content: "\f3cd"; /* mobile-alt */
    font-family: "Font Awesome 5 Free", "FontAwesome";
    font-weight: 900;
    color: var(--dp-ink);
    margin-right: 8px;
}

.dp-install-banner__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.dp-install-banner__button {
    padding: 8px 16px;
    background: var(--dp-primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.dp-install-banner__button:hover {
    background: var(--dp-primary-dark);
}

.dp-install-banner__button[hidden] {
    display: none;
}

.dp-install-banner__dismiss {
    padding: 4px 8px;
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.dp-install-banner__dismiss:hover {
    color: #475569;
}

/* =====================================================
   First-launch notification ask (installed app only)
   Rendered hidden by includes/push.php; revealed by
   assets/js/push-init.js on first standalone launch.
   z-index above everything incl. the BM fullscreen chat.
   ===================================================== */
.dp-push-welcome {
    position: fixed;
    inset: 0;
    z-index: 2147483600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.55);
}

.dp-push-welcome[hidden] {
    display: none;
}

.dp-push-welcome__card {
    background: #ffffff;
    border-radius: 14px;
    padding: 28px 24px;
    max-width: 360px;
    width: 100%;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}

.dp-push-welcome__card::before {
    content: "\f0f3"; /* bell */
    font-family: "Font Awesome 5 Free", "FontAwesome";
    font-weight: 900;
    display: block;
    font-size: 34px;
    color: var(--dp-primary);
    margin-bottom: 12px;
}

.dp-push-welcome__title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--dp-ink);
    margin: 0 0 8px;
}

.dp-push-welcome__text {
    font-size: 14px;
    color: #475569;
    line-height: 1.5;
    margin: 0 0 20px;
}

.dp-push-welcome__enable {
    display: block;
    width: 100%;
    padding: 12px 16px;
    background: var(--dp-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.dp-push-welcome__enable:hover {
    background: var(--dp-primary-dark);
}

.dp-push-welcome__later {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 10px;
    background: none;
    border: none;
    color: #64748b;
    font-size: 14px;
    cursor: pointer;
}

.dp-push-welcome__later:hover {
    color: #334155;
}
