/* Goals Tracker D3 — My Goals list + goal detail (legacy Bootstrap pages).
   Scoped under .goals-page; overrides the global h2 center rule from
   style.css (known gotcha) inside that scope. Brand: MCP yellow #FFD900. */

.goals-page {
    max-width: 1080px;
    margin: 0 auto;
    padding: 32px 16px 64px;
    font-family: 'Poppins', sans-serif;
    color: #1a1a1a;
}

.goals-page h2 {
    text-align: left;
    font-size: 28px;
    font-weight: 600;
    margin: 0 0 4px;
}

.goals-page h3 {
    text-align: left;
}

.goals-sub {
    color: #646464;
    margin: 0;
    font-size: 14px;
}

/* ---- Header row ---- */
.goals-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

/* ---- Buttons ---- */
.goals-btn {
    border: none;
    border-radius: 10px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease;
    white-space: nowrap;
}

.goals-btn-sm { padding: 6px 12px; font-size: 13px; }

.goals-btn-primary { background: #FFD900; color: #1a1a1a; }
.goals-btn-primary:hover { background: #E6C400; }
.goals-btn-primary:disabled { opacity: .6; cursor: default; }

.goals-btn-ghost {
    background: #f1f1f1;
    color: #1a1a1a;
}
.goals-btn-ghost:hover { background: #e4e4e4; }

.goals-btn-danger { background: #d23b3b; color: #fff; }
.goals-btn-danger:hover { background: #b92f2f; }
.goals-btn-danger-ghost { background: transparent; color: #d23b3b; }
.goals-btn-danger-ghost:hover { text-decoration: underline; }

/* ---- Filter pills ---- */
.goals-filters { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }

.goals-filter-pill {
    border: 1px solid #dbdbdb;
    background: #fff;
    border-radius: 999px;
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 500;
    color: #646464;
    cursor: pointer;
}

.goals-filter-pill.is-active {
    background: #1a1a1a;
    border-color: #1a1a1a;
    color: #FFD900;
}

/* ---- Goal cards grid ---- */
.goals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.goal-card {
    background: #fff;
    border: 1px solid #dbdbdb;
    border-radius: 14px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: box-shadow .15s ease;
}

.goal-card:hover { box-shadow: 0 4px 16px rgba(0, 0, 0, .08); }
.goal-card.is-completed { border-color: #28a745; }

.goal-card-link { text-decoration: none; color: inherit; display: block; }
.goal-card-link:hover { color: inherit; }

.goal-card-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.goal-type-chip {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-radius: 6px;
    padding: 3px 8px;
    background: #f1f1f1;
    color: #646464;
}

.goal-type-grade_run { background: #fff5cc; color: #8a6d00; }
.goal-type-set_completion { background: #e3edff; color: #2b5cb8; }
.goal-type-freeform { background: #eee9ff; color: #6b46c1; }

.goal-status-badge {
    font-size: 11px;
    font-weight: 600;
    border-radius: 6px;
    padding: 3px 8px;
}

.goal-status-completed { background: #e3f6e8; color: #1d7a34; }
.goal-status-archived { background: #f1f1f1; color: #888; }

.goal-private-chip {
    font-size: 11px;
    border-radius: 6px;
    padding: 3px 8px;
    background: #f7f7f7;
    color: #888;
    border: 1px dashed #cfcfcf;
}

.goal-card-title {
    font-size: 17px;
    font-weight: 600;
    margin: 6px 0 10px;
    line-height: 1.3;
}

/* ---- Progress bar (the signature visual) ---- */
.goal-progress { display: flex; flex-direction: column; gap: 6px; }

.goal-progress-track {
    height: 10px;
    border-radius: 999px;
    background: #efefef;
    overflow: hidden;
}

.goal-progress-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #FFD900, #ffc400);
    transition: width .4s ease;
}

.goal-card.is-completed .goal-progress-fill { background: #28a745; }

.goal-progress-label { font-size: 13px; color: #646464; }

.goal-progress-lg { margin: 18px 0 26px; }
.goal-progress-lg .goal-progress-track { height: 16px; }
.goal-progress-lg .goal-progress-label { font-size: 16px; color: #1a1a1a; }

.goal-card-actions { display: flex; justify-content: flex-end; }

.goals-pagination { margin-top: 24px; display: flex; justify-content: center; }

/* ---- Empty states ---- */
.goals-empty { text-align: center; padding: 48px 16px; }
.goals-empty h3 { font-size: 22px; font-weight: 600; text-align: center; }
.goals-empty p { color: #646464; }

.goals-template-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    max-width: 860px;
    margin: 24px auto 0;
}

.goals-template-tile {
    background: #fff;
    border: 1px solid #dbdbdb;
    border-radius: 14px;
    padding: 26px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    text-align: center;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease;
    font-family: inherit;
}

.goals-template-tile:hover {
    border-color: #FFD900;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .08);
}

.goals-template-icon { font-size: 30px; }
.goals-template-tile strong { font-size: 16px; }
.goals-template-tile span:not(.goals-template-icon) { font-size: 13px; color: #646464; }

.goals-empty-filter {
    text-align: center;
    color: #646464;
    padding: 40px 0;
}

/* ---- Create modal ---- */
.goals-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .5);
    z-index: 1060;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 16px;
    overflow-y: auto;
}

.goals-modal {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 560px;
    padding: 24px;
}

.goals-modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.goals-modal-head h3 { margin: 0; font-size: 20px; font-weight: 600; }

.goals-modal-close {
    border: none;
    background: none;
    font-size: 26px;
    line-height: 1;
    color: #888;
    cursor: pointer;
}

.goals-type-tabs { display: flex; gap: 8px; margin-bottom: 18px; }

.goals-type-tab {
    flex: 1;
    border: 1px solid #dbdbdb;
    background: #fff;
    border-radius: 10px;
    padding: 9px 8px;
    font-size: 13px;
    font-weight: 600;
    color: #646464;
    cursor: pointer;
}

.goals-type-tab.is-active {
    border-color: #1a1a1a;
    background: #1a1a1a;
    color: #FFD900;
}

.goals-form { display: flex; flex-direction: column; gap: 4px; }

.goals-label {
    font-size: 13px;
    font-weight: 600;
    margin: 10px 0 4px;
}

.goals-input {
    width: 100%;
    border: 1px solid #dbdbdb;
    border-radius: 10px;
    padding: 9px 12px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
}

.goals-input:focus { outline: none; border-color: #1a1a1a; }
.goals-textarea { resize: vertical; }
.goals-input-sm { max-width: 110px; }

.goals-form-row { display: flex; gap: 10px; }
.goals-form-row > div { flex: 1; }

.goals-hint { font-size: 12px; color: #888; margin: 6px 0 0; }


.goals-error {
    background: #fdecec;
    color: #b92f2f;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    margin-top: 10px;
}

.goals-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}

/* ---- Detail page ---- */
.goal-detail-breadcrumb { margin-bottom: 14px; font-size: 14px; }
.goal-detail-breadcrumb a { color: #646464; text-decoration: none; }
.goal-detail-breadcrumb a:hover { color: #1a1a1a; }

.goal-detail-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
}

.goal-detail-tools { display: flex; gap: 8px; }

.goal-celebration {
    background: #e3f6e8;
    border: 1px solid #b7e4c3;
    color: #1d7a34;
    border-radius: 12px;
    padding: 14px 18px;
    margin-top: 16px;
    font-size: 15px;
}

.goal-settings-panel {
    background: #f7f7f7;
    border: 1px solid #dbdbdb;
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 24px;
}

.goal-settings-panel h4 { margin: 0 0 6px; font-size: 16px; font-weight: 600; }

.goal-danger-zone {
    border-top: 1px solid #dbdbdb;
    margin-top: 18px;
    padding-top: 14px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

/* ---- Item rows ---- */
.goal-items { display: flex; flex-direction: column; gap: 8px; }

.goal-item-row {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #fff;
    border: 1px solid #dbdbdb;
    border-radius: 12px;
    padding: 12px 16px;
}

.goal-item-row.is-acquired { background: #fbfff9; border-color: #cbe8d2; }

.goal-item-check {
    width: 30px;
    height: 30px;
    min-width: 30px;
    border-radius: 999px;
    border: 2px solid #cfcfcf;
    background: #fff;
    color: #fff;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    transition: all .15s ease;
}

.goal-item-check:hover { border-color: #28a745; }
.goal-item-check.is-on { background: #28a745; border-color: #28a745; }

.goal-item-body { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.goal-item-label { font-size: 15px; font-weight: 500; }
.goal-item-row.is-acquired .goal-item-label { color: #1d7a34; }

.goal-item-meta { font-size: 12px; color: #888; }

.goal-item-actions { display: flex; gap: 8px; align-items: center; }

.goal-item-remove {
    border: none;
    background: none;
    color: #bbb;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.goal-item-remove:hover { color: #d23b3b; }

/* ---- Add item ---- */
.goal-add-item {
    margin-top: 22px;
    background: #f7f7f7;
    border-radius: 14px;
    padding: 18px 20px;
}

.goal-add-item h4 { margin: 0 0 12px; font-size: 16px; font-weight: 600; }

.goal-add-item-row { flex-wrap: wrap; }
.goal-add-item-row .goals-input { flex: 2 1 220px; width: auto; }
.goal-add-item-row .goals-input-sm { flex: 0 1 110px; }

@media (max-width: 640px) {
    .goals-form-row { flex-direction: column; }
    .goal-add-item-row { flex-direction: column; }
    .goal-add-item-row .goals-input,
    .goal-add-item-row .goals-input-sm { width: 100%; max-width: none; }
}

/* ---- D4: public goal page + profile tab ---- */
.goal-public-owner {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
}

.goal-public-owner-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #1a1a1a;
    font-weight: 600;
    font-size: 15px;
}

.goal-public-owner-link:hover { color: #1a1a1a; text-decoration: underline; }

.goal-public-avatar {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    object-fit: cover;
}

.goal-public-owner-sub { color: #888; font-size: 14px; }

.goal-public-cta {
    margin-top: 36px;
    background: #1a1a1a;
    border-radius: 16px;
    padding: 30px 24px;
    text-align: center;
    color: #fff;
}

.goal-public-cta h3 { color: #fff; text-align: center; font-size: 20px; margin: 0 0 6px; }
.goal-public-cta p { color: #bdbdbd; margin: 0 0 16px; font-size: 14px; }
.goal-public-cta .goals-btn { display: inline-block; text-decoration: none; }

.goals-profile-tab { padding: 8px 0 32px; }

/* ---- UX round 1: thumbnails, drag sort, structured add form ---- */
.goal-cover-thumb {
    float: right;
    width: 54px;
    height: 76px;
    object-fit: cover;
    border-radius: 8px;
    margin: 0 0 8px 10px;
    border: 1px solid #e4e4e4;
    background: #f7f7f7;
}

.goal-item-thumb,
.goal-item-thumb-link img {
    width: 38px;
    height: 53px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #e4e4e4;
    background: #f7f7f7;
    flex: 0 0 auto;
}

.goal-item-drag {
    cursor: grab;
    color: #c4c4c4;
    font-size: 15px;
    user-select: none;
    flex: 0 0 auto;
    padding: 2px 2px 2px 0;
}

.goal-item-drag:hover { color: #888; }
.sortable-ghost { opacity: .4; }

.goal-add-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.goal-add-head h4 { margin: 0; }

.goal-add-modes { display: flex; gap: 6px; }

.goal-add-mode {
    border: 1px solid #dbdbdb;
    background: #fff;
    border-radius: 999px;
    padding: 5px 14px;
    font-size: 12px;
    font-weight: 600;
    color: #646464;
    cursor: pointer;
}

.goal-add-mode.is-active {
    background: #1a1a1a;
    border-color: #1a1a1a;
    color: #FFD900;
}

.goal-add-label { margin-top: 10px; }

.goal-player-wrap { position: relative; flex: 2 1 220px; }
.goal-player-wrap .goals-input { width: 100%; }

.goal-player-suggest {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #dbdbdb;
    border-radius: 10px;
    box-shadow: 0 8px 22px rgba(0, 0, 0, .12);
    z-index: 30;
    overflow: hidden;
}

.goal-player-suggest button {
    display: block;
    width: 100%;
    text-align: left;
    border: none;
    background: none;
    padding: 9px 12px;
    font-size: 14px;
    cursor: pointer;
}

.goal-player-suggest button:hover { background: #fff8d6; }

.goal-card-results {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.goal-card-result {
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid #dbdbdb;
    border-radius: 10px;
    background: #fff;
    padding: 8px 12px;
    cursor: pointer;
    text-align: left;
    font-size: 14px;
    font-family: inherit;
}

.goal-card-result:hover { border-color: #FFD900; }

.goal-card-result img {
    width: 34px;
    height: 48px;
    object-fit: cover;
    border-radius: 5px;
    flex: 0 0 auto;
}

.goal-card-result span:first-of-type { flex: 1; min-width: 0; }

.goal-card-result-add {
    color: #1a1a1a;
    background: #FFD900;
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

/* ---- Multi-add from collection ---- */
.goal-card-results {
    max-height: 360px;
    overflow-y: auto;
    padding-right: 2px;
}

.goal-card-result.is-added {
    cursor: default;
    opacity: .65;
    border-color: #cbe8d2;
    background: #fbfff9;
}

.goal-card-result-added {
    color: #1d7a34;
    background: #e3f6e8;
    border-radius: 8px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

/* ---- Checklist set search (create modal) ---- */
.goals-set-results {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
    max-height: 240px;
    overflow-y: auto;
}

.goals-set-picked {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid #1a1a1a;
    background: #fffbe6;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 500;
}

.goal-card-result .atg-goal-meta {
    margin-left: auto;
    font-size: 12px;
    color: #888;
    white-space: nowrap;
}

/* ---- Intent-first create flow ---- */
.goals-intent { display: flex; flex-direction: column; gap: 10px; }

.goals-intent-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    border: 1px solid #dbdbdb;
    background: #fff;
    border-radius: 14px;
    padding: 16px;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.goals-intent-card:hover {
    border-color: #FFD900;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .08);
}

.goals-intent-body { display: flex; flex-direction: column; gap: 3px; }
.goals-intent-body strong { font-size: 15px; }
.goals-intent-body span { font-size: 13px; color: #646464; }

.goals-step-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}

.goals-step-link {
    border: none;
    background: none;
    color: #1a1a1a;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}

.goals-step-link:hover { text-decoration: underline; }
.goals-step-link-muted { color: #999; font-weight: 500; }

.goals-step-type {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #8a6d00;
    background: #fff5cc;
    border-radius: 6px;
    padding: 3px 10px;
}

/* ---- Set results that actually stand out ---- */
.goals-set-results-label {
    margin: 10px 0 6px;
    font-size: 13px;
    font-weight: 600;
    color: #8a6d00;
}

.goals-set-result {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    border: 2px solid #FFD900;
    background: #fffbe6;
    border-radius: 12px;
    padding: 12px 14px;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    font-size: 14px;
    transition: box-shadow .15s ease, transform .05s ease;
}

.goals-set-result:hover {
    box-shadow: 0 4px 14px rgba(230, 196, 0, .35);
    transform: translateY(-1px);
}

.goals-set-result-icon { flex: 0 0 auto; }
.goals-set-result-name { font-weight: 600; min-width: 0; }

.goals-set-result-meta {
    margin-left: auto;
    font-size: 12px;
    color: #8a6d00;
    white-space: nowrap;
}

.goals-manual-toggle { margin-top: 6px; align-self: flex-start; }

/* ---- Reviewable lists (ladder rungs + AI candidates) ---- */
.goals-ladder-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 8px 0 4px;
    max-height: 280px;
    overflow-y: auto;
}

.goals-ladder-row {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid #e4e4e4;
    border-radius: 10px;
    padding: 9px 12px;
    font-size: 14px;
    font-weight: 400;
    cursor: pointer;
    background: #fff;
}

.goals-ladder-row:hover { border-color: #FFD900; }
.goals-ladder-row input { margin: 0; flex: 0 0 auto; }

.goals-ladder-run {
    margin-left: auto;
    font-size: 12px;
    color: #8a6d00;
    background: #fff5cc;
    border-radius: 6px;
    padding: 2px 8px;
}

.goals-ai-row .goals-input { flex: 1; }

.goals-ai-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 8px;
}

/* Legacy style.css applies a global input width — pin review checkboxes
   back to checkbox size (they were blowing out to row width, shoving
   the label off-canvas). */
.goals-ladder-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

.goals-ladder-row span {
    flex: 1;
    min-width: 0;
}

.goals-ladder-row .goals-ladder-run {
    flex: 0 0 auto;
    margin-left: auto;
}

/* ---- Per-target link-a-card panel ---- */
.goal-link-panel {
    margin: -4px 0 8px 44px;
    background: #fffbe6;
    border: 1px solid #FFD900;
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.goal-link-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

/* Segmented visibility picker — buttons, not radios (legacy global input
   rules blow radio widths out on these pages). */
.goals-visibility-cards { display: flex; gap: 10px; }
.goals-visibility-card {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: #fff;
    border: 1.5px solid #DBDBDB;
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.goals-visibility-card:hover { border-color: #b5b5b5; }
.goals-visibility-card.is-active {
    border-color: #FFD900;
    box-shadow: 0 0 0 1.5px #FFD900;
    background: #FFFDF0;
}
.goals-visibility-icon { font-size: 18px; line-height: 1; }
.goals-visibility-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.goals-visibility-body strong { font-size: 14px; color: #1A1A1A; line-height: 1.3; }
.goals-visibility-body span { font-size: 12px; color: #646464; line-height: 1.3; }
.goals-visibility-check {
    margin-left: auto;
    font-size: 14px;
    font-weight: 700;
    color: #C7A600;
    width: 16px;
    flex: 0 0 auto;
}
@media (max-width: 520px) {
    .goals-visibility-cards { flex-direction: column; }
}

/* Save & close — anchor styled as a button (legacy stylesheet underlines
   and recolors bare links) + the always-there exit at the page bottom. */
.goals-page a.goals-btn { text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.goals-page a.goals-btn-primary { color: #1a1a1a; }
.goals-page a.goals-btn-primary:hover { color: #1a1a1a; background: #E6C400; }
.goal-detail-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid #ECECEC;
}
.goal-detail-footer-hint { font-size: 13px; color: #888; }
