/* ============================================================
   ItalianWines.co.uk - tasting-note editor + journal list.
   Self-contained (iwnote-* scoped, token fallbacks) so it works on the
   Tailwind bottle page and the account journal page alike.
   Markup: app/Views/account/_note_modal.php · behaviour: notes.js
   ============================================================ */

/* "Rate & note" trigger (bottle page) */
.iwnote-trigger { display: inline-flex; align-items: center; gap: 9px; font-family: var(--font-body, sans-serif); font-weight: 600; font-size: 14px; padding: 12px 22px; min-height: 44px; border-radius: var(--radius-md, 0.375rem); border: 0; cursor: pointer; background: transparent; color: var(--color-primary, #561371); box-shadow: inset 0 0 0 1px var(--color-outline-variant, #d1c2d1); transition: box-shadow 0.24s ease, background 0.24s ease; }
.iwnote-trigger:hover { box-shadow: inset 0 0 0 1px var(--color-primary, #561371); background: var(--color-primary-tint-5, rgba(86, 19, 113, 0.05)); }
.iwnote-trigger.has-note { background: var(--color-primary-tint-10, rgba(86, 19, 113, 0.10)); }
.iwnote-trigger svg { flex: none; }
.iwnote-trigger .iwnote-stars { display: inline-flex; gap: 2px; }
.iwnote-trigger .iwnote-stars i { width: 8px; height: 8px; border-radius: 999px; background: var(--color-outline-variant, #d1c2d1); }
.iwnote-trigger .iwnote-stars i.on { background: var(--color-primary, #561371); }

/* buttons (self-contained so the modal works off account.css too) */
.iwnote-btn { font-family: var(--font-body, sans-serif); font-weight: 600; font-size: 14px; padding: 11px 22px; border-radius: var(--radius-md, 0.375rem); border: 0; cursor: pointer; transition: all 0.2s ease; }
.iwnote-btn-primary { background: var(--gradient-cta, linear-gradient(135deg, #561371, #702f8a)); color: #fff; }
.iwnote-btn-ghost { background: transparent; color: var(--color-on-surface-variant, #49454f); }
.iwnote-btn-danger { background: transparent; color: var(--color-error, #ba1a1a); box-shadow: inset 0 0 0 1px rgba(186, 26, 26, 0.35); }
.iwnote-btn-danger:hover { background: var(--color-error-container, #ffdad6); }

/* editor modal */
.iwnote-scrim { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(28, 28, 25, 0.4); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); opacity: 0; transition: opacity 0.24s ease; }
.iwnote-scrim[hidden] { display: none; }
.iwnote-scrim.is-open { opacity: 1; }
.iwnote-dialog { width: 100%; max-width: 540px; max-height: calc(100vh - 48px); overflow-y: auto; background: var(--color-surface-container-lowest, #fff); border-radius: var(--radius-xl, 0.75rem); box-shadow: var(--shadow-ambient-lg, 0 32px 60px rgba(86, 19, 113, 0.18)); padding: 34px 36px 30px; transform: translateY(16px) scale(0.97); opacity: 0; transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.24s ease; }
.iwnote-scrim.is-open .iwnote-dialog { transform: none; opacity: 1; }
.iwnote-dialog h2 { font-family: var(--font-display, serif); font-size: 24px; font-weight: 600; color: var(--color-primary, #561371); margin: 0 0 4px; }
.iwnote-subj { font-family: var(--font-body, sans-serif); font-size: 13.5px; color: var(--color-on-surface-variant, #49454f); margin: 0 0 24px; }
.iwnote-flabel { display: block; font-family: var(--font-label, sans-serif); font-weight: 600; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--color-on-surface-variant, #49454f); margin-bottom: 9px; }
.iwnote-rate { display: flex; gap: 8px; margin-bottom: 22px; }
.iwnote-rate button { width: 40px; height: 40px; border-radius: 999px; border: 0; background: var(--color-surface-container-low, #f6f3ee); color: var(--color-on-surface-variant, #49454f); font-family: var(--font-display, serif); font-weight: 600; cursor: pointer; box-shadow: var(--shadow-ghost-border, 0 0 0 1px rgba(209, 194, 209, 0.4)); transition: all 0.16s ease; }
.iwnote-rate button.on, .iwnote-rate button:hover { background: var(--color-primary, #561371); color: #fff; box-shadow: none; }
.iwnote-dialog textarea { width: 100%; box-sizing: border-box; min-height: 130px; font-family: var(--font-display, serif); font-style: italic; font-size: 16px; line-height: 1.6; color: var(--color-on-surface, #1c1c19); background: var(--color-surface-variant, #ede8e3); border: 0; box-shadow: var(--shadow-ghost-border, 0 0 0 1px rgba(209, 194, 209, 0.4)); border-radius: var(--radius-md, 0.375rem); padding: 16px; resize: vertical; }
.iwnote-dialog textarea:focus { outline: none; box-shadow: 0 0 0 2px var(--color-primary-container, #702f8a); }
.iwnote-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 22px; gap: 12px; }
.iwnote-foot-right { display: flex; gap: 12px; }

/* journal list (account page) */
.iwnote-list { display: flex; flex-direction: column; gap: 18px; max-width: 820px; }
.iwnote-card { background: var(--color-surface-container-lowest, #fff); border-radius: var(--radius-lg, 0.5rem); box-shadow: var(--shadow-ambient-sm, 0 8px 20px rgba(86, 19, 113, 0.04)); padding: 24px 28px; cursor: pointer; transition: transform 0.24s ease, box-shadow 0.24s ease; text-align: left; border: 0; width: 100%; display: block; }
.iwnote-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-ambient, 0 20px 40px rgba(86, 19, 113, 0.05)); }
.iwnote-card h3 { font-family: var(--font-display, serif); font-size: 20px; font-weight: 600; color: var(--color-primary, #561371); margin: 0 0 6px; }
.iwnote-pips { display: inline-flex; gap: 3px; margin: 0 0 10px; }
.iwnote-pips .pip { width: 9px; height: 9px; border-radius: 999px; background: var(--color-outline-variant, #d1c2d1); }
.iwnote-pips .pip.on { background: var(--color-primary, #561371); }
.iwnote-card p { font-family: var(--font-display, serif); font-style: italic; font-size: 16px; line-height: 1.55; color: var(--color-on-surface, #1c1c19); margin: 0 0 8px; }
.iwnote-date { font-family: var(--font-label, sans-serif); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-on-surface-variant, #49454f); }
.iwnote-empty { font-family: var(--font-display, serif); font-style: italic; font-size: 17px; color: var(--color-on-surface-variant, #49454f); }


/* account tasting-note bottle grid */
.iwnote-bottle-grid { align-items: start; }
.iwnote-grid-cell { min-width: 0; }
.iwnote-card-note { padding: 10px 2px 0; }
.iwnote-card-note-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 7px; }
.iwnote-card-note p { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-family: var(--font-display, serif); font-style: italic; font-size: 15px; line-height: 1.45; color: var(--color-on-surface, #1c1c19); margin: 0 0 7px; }
.iwnote-card-note .iwnote-muted { color: var(--color-on-surface-variant, #49454f); }
.iwnote-edit { border: 0; background: transparent; color: var(--color-primary, #561371); cursor: pointer; font-family: var(--font-label, sans-serif); font-size: 10.5px; font-weight: 700; letter-spacing: 0.11em; text-transform: uppercase; padding: 0; white-space: nowrap; }
.iwnote-edit:hover { color: var(--color-primary-container, #702f8a); }

@media (max-width: 720px) {
  .acct-bottle-grid[data-grid-density="2"] .iwnote-card-note { padding-top: 7px; }
  .acct-bottle-grid[data-grid-density="2"] .iwnote-card-note p, .acct-bottle-grid[data-grid-density="2"] .iwnote-date { display: none; }
  .acct-bottle-grid[data-grid-density="2"] .iwnote-card-note-head { margin-bottom: 0; }
  .acct-bottle-grid[data-grid-density="2"] .iwnote-pips .pip { width: 7px; height: 7px; }
  .acct-bottle-grid[data-grid-density="2"] .iwnote-edit { font-size: 9px; letter-spacing: 0.08em; }
}
