/*
 * Helpy Saved Pros (Favourites) Page Styles
 * Version: 1.1c
 * Scope: .helpy-saved-pros-page (favourite-listings.php template)
 * Brand: #6f2dbd
 *
 * Path:    wp-content/themes/classima/assets/css/helpy-saved-pros.css
 * Enqueue: registered in inc/scripts.php (HELPY PATCH-C block)
 *
 * Changes vs v1.0c:
 *  - Compact header (~90px instead of ~150px)
 *  - "Choose project above" pill removed → replaced by hint banner above the list
 *  - Trash icon: hover-only
 *  - Thumb: 64×64 (was 88×88)
 *  - Counter inline with title via "· N" separator
 */

/* ─── Page wrap & tokens ───────────────────────────────── */

.helpy-saved-pros-page {
    --hsp-brand: #6f2dbd;
    --hsp-brand-dark: #5a2298;
    --hsp-brand-soft: #f3eaff;
    --hsp-brand-soft-border: #cfc9f0;
    --hsp-text: #1a1730;
    --hsp-text-muted: #7a7490;
    --hsp-text-light: #9491a1;
    --hsp-border: #e4e1ea;
    --hsp-border-soft: #ede9f4;
    --hsp-bg-soft: #faf9fd;
    --hsp-success-bg: #ecfdf3;
    --hsp-success-fg: #027a48;
    --hsp-danger-bg: #fef3f2;
    --hsp-danger-fg: #b42318;
    --hsp-danger-border: #fda29b;

    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--hsp-text);
}

/* ─── Header (compact) ─────────────────────────────────── */

.helpy-saved-pros-page .helpy-saved-pros-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 22px;
    background: #fff;
    border: 1px solid var(--hsp-border);
    border-radius: 14px;
    margin-bottom: 10px;
}

.helpy-saved-pros-header__main {
    flex: 1 1 280px;
    min-width: 0;
}

/* Eyebrow no longer used in v1.1 — kept for backward safety */
.helpy-saved-pros-header__eyebrow {
    display: none;
}

.helpy-saved-pros-header__title {
    font-size: 18px;
    font-weight: 700;
    color: var(--hsp-text);
    margin: 0 0 2px;
    line-height: 1.2;
}

.helpy-saved-pros-header__subtitle {
    font-size: 12px;
    color: var(--hsp-text-muted);
    margin: 0;
    line-height: 1.4;
}

.helpy-saved-pros-header__subtitle a {
    color: var(--hsp-brand);
    font-weight: 500;
    text-decoration: none;
}

.helpy-saved-pros-header__subtitle a:hover {
    text-decoration: underline;
}

.helpy-saved-pros-header__hint {
    font-size: 12px;
    color: var(--hsp-text-light);
    margin: 2px 0 0;
}

.helpy-saved-pros-header__actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    flex-shrink: 0;
}

/* ─── Project picker ───────────────────────────────────── */

.helpy-saved-pros-project-picker {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.helpy-saved-pros-project-picker select {
    min-width: 220px;
    height: 36px;
    padding: 0 32px 0 12px;
    font-size: 13px;
    color: var(--hsp-text);
    background: #fff
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>")
        no-repeat right 10px center;
    background-size: 12px;
    border: 1px solid var(--hsp-border);
    border-radius: 8px;
    appearance: none;
    cursor: pointer;
    font-family: inherit;
}

.helpy-saved-pros-project-picker select:focus {
    outline: none;
    border-color: var(--hsp-brand);
    box-shadow: 0 0 0 3px rgba(111, 45, 189, 0.1);
}

/* ─── Buttons ──────────────────────────────────────────── */

.helpy-saved-pros-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    padding: 0 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.13s, border-color 0.13s, color 0.13s;
    line-height: 1;
    white-space: nowrap;
}

.helpy-saved-pros-btn--primary {
    background: var(--hsp-brand);
    color: #fff;
    border-color: var(--hsp-brand);
}

.helpy-saved-pros-btn--primary:hover {
    background: var(--hsp-brand-dark);
    border-color: var(--hsp-brand-dark);
    color: #fff;
}

.helpy-saved-pros-btn--primary:disabled,
.helpy-saved-pros-btn--primary[disabled] {
    background: #c9c3d8;
    border-color: #c9c3d8;
    cursor: not-allowed;
}

.helpy-saved-pros-btn--secondary {
    background: #fff;
    color: var(--hsp-brand);
    border-color: var(--hsp-border);
}

.helpy-saved-pros-btn--secondary:hover {
    background: var(--hsp-brand-soft);
    border-color: var(--hsp-brand-soft-border);
    color: var(--hsp-brand-dark);
}

/* ─── Hint banner (replaces "Choose project above" inline pill) ─── */
/* This block is injected via JS or shown via PHP when no project is selected.
   See JS snippet in v1.1c notes or add a server-side echo in the template. */

.helpy-saved-pros-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    background: var(--hsp-brand-soft);
    border: 1px solid var(--hsp-brand-soft-border);
    border-radius: 10px;
    margin-bottom: 10px;
    font-size: 12px;
    color: #4a1a7a;
}

.helpy-saved-pros-hint__icon {
    font-size: 14px;
    flex-shrink: 0;
    line-height: 1;
}

/* ─── Bulk action bar ──────────────────────────────────── */

.helpy-saved-pros-bulkbar {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    padding: 10px 16px;
    background: var(--hsp-brand-soft);
    border: 1px solid var(--hsp-brand-soft-border);
    border-radius: 10px;
    margin-bottom: 10px;
}

.helpy-saved-pros-checkline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--hsp-text);
    cursor: pointer;
}

.helpy-saved-pros-checkline input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--hsp-brand);
    cursor: pointer;
    margin: 0;
}

.helpy-saved-pros-bulkbar__warning {
    font-size: 12px;
    color: #b54708;
    font-weight: 500;
    margin-left: auto;
}

/* ─── Notice banner ────────────────────────────────────── */

.helpy-saved-pros-page .helpy-project-invite-notice {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 12px;
    border: 1px solid;
}

.helpy-saved-pros-page .helpy-project-invite-notice--success {
    background: var(--hsp-success-bg);
    border-color: #abefc6;
    color: var(--hsp-success-fg);
}

.helpy-saved-pros-page .helpy-project-invite-notice--error {
    background: var(--hsp-danger-bg);
    border-color: var(--hsp-danger-border);
    color: var(--hsp-danger-fg);
}

/* ─── Pro card list ────────────────────────────────────── */

.helpy-saved-pros-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.helpy-saved-pro-card {
    display: grid;
    grid-template-columns: auto 64px 1fr auto;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    background: #fff;
    border: 1px solid var(--hsp-border);
    border-radius: 12px;
    transition: border-color 0.13s, box-shadow 0.13s;
    position: relative;
}

.helpy-saved-pro-card:hover {
    border-color: var(--hsp-brand-soft-border);
    box-shadow: 0 1px 3px rgba(26, 23, 48, 0.04);
}

.helpy-saved-pro-card--invited {
    background: var(--hsp-bg-soft);
    border-color: var(--hsp-border-soft);
}

/* When no checkbox column (no project selected) */
.helpy-saved-pro-card:not(:has(.helpy-saved-pro-card__select)) {
    grid-template-columns: 64px 1fr auto;
}

/* Checkbox */
.helpy-saved-pro-card__select {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin: 0;
}

.helpy-saved-pro-card__select input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--hsp-brand);
    cursor: pointer;
    margin: 0;
}

/* Thumb — 64×64 */
.helpy-saved-pro-card__thumb {
    display: block;
    width: 64px;
    height: 64px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--hsp-brand-soft);
    flex-shrink: 0;
    position: relative;
}

.helpy-saved-pro-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.helpy-saved-pro-card__thumb .dashicons {
    position: absolute;
    inset: 0;
    margin: auto;
    font-size: 24px;
    width: 24px;
    height: 24px;
    color: var(--hsp-brand);
}

/* Body */
.helpy-saved-pro-card__body {
    min-width: 0;
    overflow: hidden;
}

.helpy-saved-pro-card__title {
    font-size: 14px;
    font-weight: 600;
    color: var(--hsp-text);
    margin: 0 0 3px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.helpy-saved-pro-card__title a {
    color: inherit;
    text-decoration: none;
}

.helpy-saved-pro-card__title a:hover {
    color: var(--hsp-brand);
}

.helpy-saved-pro-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    font-size: 12px;
    color: var(--hsp-text-muted);
    line-height: 1.4;
}

.helpy-saved-pro-card__meta span {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

/* ─── Actions cluster ──────────────────────────────────── */

.helpy-saved-pro-card__actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* Send invite button — small, ghost style */
.helpy-saved-pro-card__actions .helpy-saved-pros-btn {
    height: 30px;
    padding: 0 12px;
    font-size: 12px;
    border-radius: 8px;
}

/* Status pills (Invited / Limit) */
.helpy-saved-pro-status {
    display: inline-flex;
    align-items: center;
    height: 28px;
    padding: 0 11px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

.helpy-saved-pro-status--invited {
    background: var(--hsp-success-bg);
    color: var(--hsp-success-fg);
}

.helpy-saved-pro-status--limit {
    background: var(--hsp-danger-bg);
    color: var(--hsp-danger-fg);
}

/* HIDE the "Choose project above" pill — replaced by hint banner above */
/* !important: project-invite.css from helpy-projects plugin defines its own
   .helpy-saved-pro-status--muted styles after this file in some load orders. */
.helpy-saved-pros-page .helpy-saved-pro-status--muted {
    display: none !important;
}

/* ─── Trash icon — hover-only ──────────────────────────── */

.helpy-saved-pro-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--hsp-text-light);
    text-decoration: none;
    transition: opacity 0.13s, background 0.13s, color 0.13s;
    opacity: 0;
}

.helpy-saved-pro-card:hover .helpy-saved-pro-remove,
.helpy-saved-pro-remove:focus,
.helpy-saved-pro-remove:focus-visible {
    opacity: 1;
}

.helpy-saved-pro-remove:hover {
    background: var(--hsp-danger-bg);
    color: var(--hsp-danger-fg);
}

.helpy-saved-pro-remove .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Touch devices: always show trash (no hover state) */
@media (hover: none) {
    .helpy-saved-pro-remove {
        opacity: 0.7;
    }
}

/* ─── Empty state ──────────────────────────────────────── */

.helpy-saved-pros-empty {
    padding: 48px 24px;
    text-align: center;
    background: #fff;
    border: 1px solid var(--hsp-border);
    border-radius: 14px;
}

.helpy-saved-pros-empty h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--hsp-text);
    margin: 0 0 6px;
}

.helpy-saved-pros-empty p {
    font-size: 13px;
    color: var(--hsp-text-muted);
    margin: 0;
}

/* ─── Mobile ───────────────────────────────────────────── */

@media (max-width: 767px) {
    .helpy-saved-pros-page .helpy-saved-pros-header {
        padding: 14px 14px;
    }

    .helpy-saved-pros-header__actions {
        width: 100%;
    }

    .helpy-saved-pros-project-picker {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .helpy-saved-pros-project-picker select {
        width: 100%;
        min-width: 0;
    }

    .helpy-saved-pros-project-picker .helpy-saved-pros-btn {
        width: 100%;
    }

    /* Card: stack on mobile */
    .helpy-saved-pro-card {
        grid-template-columns: auto 56px 1fr;
        grid-template-areas:
            "select thumb body"
            "actions actions actions";
        gap: 10px;
        padding: 10px;
    }

    .helpy-saved-pro-card:not(:has(.helpy-saved-pro-card__select)) {
        grid-template-columns: 56px 1fr;
        grid-template-areas:
            "thumb body"
            "actions actions";
    }

    .helpy-saved-pro-card__select  { grid-area: select; }
    .helpy-saved-pro-card__thumb   { grid-area: thumb; width: 56px; height: 56px; }
    .helpy-saved-pro-card__body    { grid-area: body; }
    .helpy-saved-pro-card__actions {
        grid-area: actions;
        padding-top: 8px;
        border-top: 1px solid var(--hsp-border-soft);
        justify-content: space-between;
    }

    .helpy-saved-pro-card__actions .helpy-saved-pros-btn {
        flex: 1;
    }

    /* Always show trash on mobile (no hover) */
    .helpy-saved-pro-remove {
        opacity: 1;
    }

    .helpy-saved-pros-bulkbar {
        flex-direction: column;
        align-items: stretch;
    }

    .helpy-saved-pros-bulkbar .helpy-saved-pros-btn {
        width: 100%;
    }
}
