/*
 * hook-concept-explorer.css
 * Styles for the public Hook Concept Explorer:
 *   - /hook-concepts/{concept_key}/ preset pages
 *   - [hook_concept_builder] shortcode on /hook-concepts/
 *
 * Uses CSS custom properties that fall back to hard values so the styles
 * work independent of whatever variables the parent theme provides.
 */

/* ─── Shared chip system ──────────────────────────────────────────────────── */

.hce-chip {
    display: inline-block;
    font-size: 0.75rem;
    font-family: system-ui, -apple-system, sans-serif;
    padding: 2px 8px;
    border-radius: 4px;
    margin: 2px 2px 2px 0;
    background: #f5f6f7;
    border: 1px solid #dde1e4;
    color: #444;
    text-decoration: none;
    white-space: nowrap;
    transition: opacity 0.15s;
}
.hce-chip--catalog {
    background: #f0fff4;
    border-color: #7ec894;
    color: #1a5c35;
}
.hce-chip--catalog:hover {
    background: #daf5e4;
    text-decoration: none;
    color: #1a5c35;
}
.hce-chip--mini {
    background: #fff8eb;
    border-color: #e0b35c;
    color: #8a5a12;
}
.hce-chip--mini:hover {
    background: #fff0cc;
    text-decoration: none;
    color: #8a5a12;
}
.hce-chip--close { border-style: dashed; }
.hce-chip--functional { border-style: dotted; }


/* ─── Legend ─────────────────────────────────────────────────────────────── */

.hce-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 12px;
    font-size: 0.7rem;
    color: #888;
    font-family: system-ui, -apple-system, sans-serif;
}
.hce-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}
.hce-legend-swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    background: #f5f6f7;
    border: 1px solid #dde1e4;
    flex-shrink: 0;
}
.hce-legend-swatch--catalog { background: #f0fff4; border-color: #7ec894; }
.hce-legend-swatch--mini    { background: #fff8eb; border-color: #e0b35c; }
.hce-legend-swatch--close   { border-style: dashed; }


/* ═══════════════════════════════════════════════════════════════════════════
   PRESET CONCEPT PAGE  (/hook-concepts/{slug}/)
   ═══════════════════════════════════════════════════════════════════════════ */

.hce-preset-page {
    font-family: system-ui, -apple-system, sans-serif;
}

/* Header */
.hce-preset-header {
    background: #111111;
    color: #fff;
    padding: 24px 28px 20px;
    border-bottom: 3px solid #E57373;
}
.hce-preset-header-inner {
    max-width: 1100px;
    margin: 0 auto;
}
.hce-back-link {
    display: inline-block;
    font-size: 0.8rem;
    color: rgba(255,255,255,.55) !important;
    text-decoration: none !important;
    margin-bottom: 10px;
    transition: color 0.15s;
}
.hce-back-link:hover { color: rgba(255,255,255,.85) !important; }

.hce-preset-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: rgba(255,255,255,.12);
    color: rgba(255,255,255,.8);
    border: 1px solid rgba(255,255,255,.22);
    border-radius: 3px;
    padding: 2px 8px;
    margin-bottom: 8px;
}
.hce-preset-title {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.6rem;
    font-weight: normal;
    color: #fff;
    margin: 0 0 10px;
    line-height: 1.25;
}
.hce-preset-key-feature {
    font-size: 0.9rem;
    color: rgba(255,255,255,.65);
    margin: 0;
    line-height: 1.5;
}

/* Stat strip */
.hce-preset-stat-strip {
    display: flex;
    background: #1a1a1a;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.hce-preset-stat {
    flex: 1;
    padding: 10px 18px;
    border-right: 0.5px solid rgba(255,255,255,.07);
}
.hce-preset-stat:last-child { border-right: none; }
.hce-preset-stat-value {
    font-size: 1.125rem;
    font-weight: 600;
    color: #fff;
    line-height: 1;
    margin-bottom: 3px;
}
.hce-preset-stat-label {
    font-size: 0.65rem;
    color: rgba(255,255,255,.35);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.hce-stat-green { color: #6fcf97; }
.hce-stat-amber { color: #e0b35c; }

/* Body */
.hce-preset-body {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 28px 48px;
}

/* Slot table */
.hce-preset-table-wrap {
    overflow-x: auto;
    margin-bottom: 14px;
}
.hce-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    background: #fff;
    border: 1px solid #dde1e4;
    border-radius: 6px;
    overflow: hidden;
}
.hce-table thead tr { background: #f5f6f7; }
.hce-table th {
    text-align: left;
    padding: 9px 14px;
    border-bottom: 2px solid #dde1e4;
    font-size: 0.72rem;
    font-weight: 700;
    color: #444;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}
.hce-th-label  { min-width: 140px; width: 180px; }
.hce-th-models { min-width: 300px; }
.hce-table tbody tr:nth-child(even) { background: #fafbfc; }
.hce-table tbody tr:hover { background: #f0f4f8; }
.hce-td-label {
    padding: 10px 14px;
    border-bottom: 1px solid #eef0f2;
    font-weight: 600;
    color: #1a1a1a;
    vertical-align: middle;
    white-space: nowrap;
}
.hce-td-models {
    padding: 8px 14px;
    border-bottom: 1px solid #eef0f2;
    vertical-align: middle;
}

/* Fly patterns */
.hce-fly-patterns {
    margin-top: 14px;
    font-size: 0.8rem;
    color: #666;
    font-style: italic;
    line-height: 1.5;
}
.hce-fly-patterns-label {
    font-style: normal;
    font-weight: 600;
    color: #444;
    margin-right: 4px;
}

/* Empty state */
.hce-empty-state {
    padding: 40px 20px;
    text-align: center;
    background: #fafbfc;
    border: 1px dashed #dde1e4;
    border-radius: 6px;
}
.hce-empty-title {
    font-size: 1rem;
    font-weight: 600;
    color: #444;
    margin: 0 0 8px;
}
.hce-empty-sub {
    font-size: 0.875rem;
    color: #888;
    margin: 0;
}

/* Footer */
.hce-preset-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid #eef0f2;
}
.hce-preset-footer-credit {
    font-size: 0.7rem;
    color: #bbb;
}

/* Shared button styles */
.hce-btn-outline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-family: system-ui, -apple-system, sans-serif;
    font-weight: 500;
    padding: 7px 14px;
    border: 1px solid #c8cdd2;
    border-radius: 5px;
    background: #fff;
    color: #444 !important;
    text-decoration: none !important;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.hce-btn-outline:hover { border-color: #999; background: #f8f9fa; color: #222 !important; }


/* ═══════════════════════════════════════════════════════════════════════════
   BUILDER  ([hook_concept_builder] shortcode)
   ═══════════════════════════════════════════════════════════════════════════ */

.hce-builder {
    font-family: system-ui, -apple-system, sans-serif;
    color: #1a1a1a;
    padding: 0 0 48px;
}

/* Builder page header */
.hce-builder-header {
    background: #111111;
    color: #fff;
    padding: 24px 28px 22px;
    border-bottom: 3px solid #E57373;
    margin-bottom: 28px;
    margin-left: -28px;
    margin-right: -28px;
    margin-top: -28px;
}
.hce-builder-header-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: rgba(255,255,255,.12);
    color: rgba(255,255,255,.8);
    border: 1px solid rgba(255,255,255,.22);
    border-radius: 3px;
    padding: 2px 8px;
    margin-bottom: 10px;
    font-family: system-ui, -apple-system, sans-serif;
}
.hce-builder-header-title {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.55rem;
    font-weight: normal;
    color: #fff;
    margin: 0 0 10px;
    line-height: 1.25;
}
.hce-builder-header-sub {
    font-size: 0.875rem;
    color: rgba(255,255,255,.6);
    margin: 0;
    line-height: 1.5;
    font-family: system-ui, -apple-system, sans-serif;
    max-width: 640px;
}

/* Step headings */
.hce-step-heading {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 12px;
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}
.hce-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #1a1a1a;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 1px;
}
.hce-step-hint {
    font-size: 0.75rem;
    font-weight: 400;
    color: #888;
}

/* Section spacing */
.hce-section {
    margin-bottom: 28px;
}
.hce-section--app { margin-bottom: 22px; }
.hce-section--layout { margin-top: 24px; }

/* Application pills */
.hce-app-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.hce-app-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 6px 14px;
    border: 1px solid #c8cdd2;
    border-radius: 20px;
    background: #fff;
    color: #444;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    white-space: nowrap;
}
.hce-app-pill:hover { border-color: #888; background: #f5f6f7; }
.hce-app-pill.is-active {
    background: #1a1a1a;
    border-color: #1a1a1a;
    color: #fff;
}
.hce-app-pill-count {
    font-size: 0.7rem;
    opacity: 0.65;
}

/* Two-column layout */
.hce-builder-columns {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 32px;
    align-items: start;
}

/* Concept list */
.hce-concept-actions,
.hce-mfr-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}
.hce-btn-text {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.78rem;
    color: #0645ad;
    cursor: pointer;
    text-decoration: underline;
    font-family: inherit;
}
.hce-btn-text:hover { color: #0b0080; }

.hce-concept-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid #dde1e4;
    border-radius: 6px;
    overflow: hidden;
    max-height: 520px;
    overflow-y: auto;
}
.hce-concept-group-header {
    padding: 6px 12px;
    background: #f0f2f4;
    font-size: 0.68rem;
    font-weight: 700;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #dde1e4;
    position: sticky;
    top: 0;
    z-index: 1;
}
.hce-concept-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 9px 12px;
    border-bottom: 1px solid #eef0f2;
    cursor: pointer;
    transition: background 0.1s;
}
.hce-concept-item:last-child { border-bottom: none; }
.hce-concept-item:hover { background: #f8f9fa; }
.hce-concept-item.is-hidden { display: none; }
.hce-concept-item input[type="checkbox"] {
    margin-top: 2px;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: #1a1a1a;
}
.hce-concept-item-body { flex: 1; min-width: 0; }
.hce-concept-item-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: #1a1a1a;
    line-height: 1.3;
}
.hce-concept-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
}
.hce-concept-item-count {
    font-size: 0.7rem;
    color: #888;
}
.hce-concept-item-feature {
    font-size: 0.7rem;
    color: #aaa;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 260px;
}

/* Manufacturer list */
.hce-mfr-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid #dde1e4;
    border-radius: 6px;
    overflow: hidden;
    max-height: 280px;
    overflow-y: auto;
}
.hce-mfr-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-bottom: 1px solid #eef0f2;
    cursor: pointer;
    font-size: 0.8125rem;
    color: #333;
    transition: background 0.1s;
}
.hce-mfr-item:last-child { border-bottom: none; }
.hce-mfr-item:hover { background: #f8f9fa; }
.hce-mfr-item input[type="checkbox"] {
    flex-shrink: 0;
    cursor: pointer;
    accent-color: #1a1a1a;
}

/* Layout options */
.hce-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #444;
    margin: 14px 0 5px;
}
.hce-label--checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 400;
    cursor: pointer;
    margin-top: 14px;
}
.hce-select,
.hce-input {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    font-size: 0.8125rem;
    font-family: inherit;
    border: 1px solid #c8cdd2;
    border-radius: 5px;
    background: #fff;
    color: #1a1a1a;
    appearance: auto;
}
.hce-select:focus,
.hce-input:focus {
    outline: 2px solid #1a1a1a;
    outline-offset: 1px;
}

/* Mobile trigger */
.hce-mobile-trigger {
    display: none;
    margin-top: 20px;
}
.hce-btn-primary {
    width: 100%;
    padding: 12px 20px;
    background: #1a1a1a;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s;
}
.hce-btn-primary:hover { background: #333; }

/* Preview section */
.hce-preview-section {
    margin-top: 32px;
    border-top: 2px solid #dde1e4;
    padding-top: 24px;
}
.hce-preview-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}
.hce-preview-heading {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
}
.hce-preview-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.hce-copy-feedback {
    font-size: 0.78rem;
    color: #1a5c35;
    min-height: 18px;
    margin-bottom: 6px;
    font-family: inherit;
}
.hce-preview-output {
    min-height: 120px;
}
.hce-preview-empty {
    padding: 40px 20px;
    text-align: center;
    background: #fafbfc;
    border: 1px dashed #dde1e4;
    border-radius: 6px;
    font-size: 0.875rem;
    color: #888;
}
.hce-preview-empty p { margin: 0; }
.hce-preview-loading {
    padding: 32px 20px;
    text-align: center;
    font-size: 0.875rem;
    color: #888;
}
.hce-preview-watermark-note {
    margin-top: 10px;
    font-size: 0.68rem;
    color: #ccc;
    text-align: right;
}

/* PDF capture area — add watermark via ::after during capture */
.hce-pdf-capture-wrap {
    position: relative;
}
.hce-pdf-watermark {
    display: none;
}
.hce-pdf-capture-wrap .hce-pdf-watermark {
    display: block;
    text-align: center;
    font-size: 0.7rem;
    color: #bbb;
    padding: 10px 0 4px;
    font-family: system-ui, -apple-system, sans-serif;
    border-top: 1px solid #eee;
    margin-top: 10px;
}


/* ─── Responsive — mobile ───────────────────────────────────────────────────  */

@media ( max-width: 700px ) {

    /* Preset page */
    .hce-preset-header { padding: 18px 16px 16px; }
    .hce-preset-title  { font-size: 1.25rem; }
    .hce-preset-stat-strip { flex-wrap: wrap; }
    .hce-preset-stat {
        flex: 1 1 50%;
        border-right: none;
        border-bottom: 0.5px solid rgba(255,255,255,.07);
    }
    .hce-preset-body { padding: 16px 16px 36px; }
    .hce-preset-footer { flex-direction: column; align-items: flex-start; }

    /* Builder — stack columns */
    .hce-builder-columns {
        grid-template-columns: 1fr;
        gap: 0;
    }
    .hce-col-options .hce-section {
        border-top: 1px solid #eef0f2;
        padding-top: 20px;
    }

    /* Builder header mobile */
    .hce-builder-header {
        margin-left: -16px;
        margin-right: -16px;
        margin-top: -16px;
        padding: 18px 16px 16px;
    }
    .hce-builder-header-title { font-size: 1.25rem; }

    /* Show the manual "Show Results" button; hide debounced preview */
    .hce-mobile-trigger { display: block; }
    .hce-preview-section { display: none; }
    .hce-preview-section.is-visible { display: block; }

    /* Concept list shorter on mobile */
    .hce-concept-list { max-height: 340px; }
    .hce-mfr-list     { max-height: 220px; }

    .hce-table th,
    .hce-table td { font-size: 0.78rem; padding: 8px 10px; }

    /* Stack preview toolbar on mobile */
    .hce-preview-toolbar { flex-direction: column; align-items: flex-start; }
    .hce-preview-actions { width: 100%; }
    .hce-btn-outline { font-size: 0.75rem; }
}

@media print {
    .hce-builder-columns,
    .hce-preview-toolbar,
    .hce-section--app,
    .hce-preview-watermark-note { display: none !important; }
    .hce-preview-section {
        border-top: none;
        padding-top: 0;
        margin-top: 0;
    }
    .hce-pdf-watermark { display: block !important; }
}

/* ── View toggle buttons ────────────────────────────────────────────────────── */

.hce-view-toggle {
    display: flex;
    gap: 0;
    margin-bottom: 14px;
    border: 1px solid #dde1e4;
    border-radius: 5px;
    overflow: hidden;
    width: fit-content;
}
.hce-view-btn {
    padding: 6px 16px;
    font-size: 0.8rem;
    font-family: system-ui, -apple-system, sans-serif;
    font-weight: 500;
    background: #fff;
    color: #555;
    border: none;
    border-right: 1px solid #dde1e4;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    white-space: nowrap;
}
.hce-view-btn:last-child { border-right: none; }
.hce-view-btn:hover { background: #f5f6f7; color: #1a1a1a; }
.hce-view-btn--active {
    background: #1a1a1a;
    color: #fff;
}
.hce-view-btn--active:hover { background: #333; color: #fff; }

/* ── Vertical view ──────────────────────────────────────────────────────────── */

.hce-vertical-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
}
.hce-vertical-card {
    background: #fff;
    border: 1px solid #dde1e4;
    border-radius: 6px;
    padding: 10px 12px 12px;
}
.hce-vertical-mfr {
    font-size: 0.72rem;
    font-weight: 700;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #eef0f2;
}
.hce-vertical-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
}

/* ── Compact view ───────────────────────────────────────────────────────────── */

.hce-compact-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.hce-compact-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 3px;
    padding: 4px 0;
    border-bottom: 1px solid #f2f3f4;
    font-size: 0.8125rem;
}
.hce-compact-row:last-child { border-bottom: none; }
.hce-compact-mfr {
    font-size: 0.7rem;
    font-weight: 700;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    min-width: 90px;
    flex-shrink: 0;
    padding-right: 6px;
}

@media ( max-width: 700px ) {
    .hce-vertical-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
    .hce-compact-mfr {
        min-width: 72px;
    }
}
