/* Review notes panel (inc/notes.php, assets/notes.js).
   Docked (the default on screens 900px and wider): the panel runs down the right wall, with the page
   beside it in a frame at the chosen screen's width (Desktop, Tablet, Phone).
   Floating: over the page, only as tall as what is in it; it can be dragged anywhere and made small
   (just the top strip). On a phone it is a sheet along the bottom.
   Its own look, not WordPress's: everything is scoped to .review-notes, .rn-* and the Notes button, so
   the site's theme never changes it and it never changes the site. */

.review-notes,.rn-fab,.rn-split{
  --rn-ink:#0f172a;--rn-muted:#64748b;--rn-soft:#94a3b8;--rn-line:#e2e8f0;--rn-surface:#f8fafc;--rn-white:#fff;
  --rn-accent:#e11d48;--rn-accent-dark:#be123c;--rn-accent-soft:#fff1f2;--rn-focus:#2563eb;
  --rn-radius:16px;--rn-r-sm:10px;
  --rn-font:ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Inter,Roboto,"Helvetica Neue",Arial,sans-serif;
}

/* ---------- the panel ---------- */
.review-notes{--rn-top:var(--wp-admin--admin-bar--height,32px);position:fixed;z-index:100000;top:calc(var(--rn-top) + 12px);right:12px;width:360px;max-width:calc(100vw - 24px);max-height:calc(100vh - var(--rn-top) - 24px);overflow:auto;
  box-sizing:border-box;background:var(--rn-white);border:1px solid var(--rn-line);border-radius:var(--rn-radius);
  box-shadow:0 1px 2px rgba(15,23,42,.06),0 24px 60px -12px rgba(15,23,42,.28);
  font:400 14px/1.5 var(--rn-font);color:var(--rn-ink);text-align:left;-webkit-font-smoothing:antialiased;scrollbar-width:thin}
.rn-guest .review-notes{--rn-top:0px}
.review-notes[hidden]{display:none}
.review-notes *{box-sizing:border-box;font-family:inherit;letter-spacing:0}
.review-notes p{margin:0}

/* Top strip: title, then dock or float, small, close. */
.review-notes .rn-head{position:sticky;top:0;z-index:1;display:flex;align-items:center;gap:4px;padding:12px 10px 12px 16px;background:rgba(255,255,255,.92);-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);border-bottom:1px solid var(--rn-line);cursor:move;touch-action:none;user-select:none;-webkit-user-select:none}
.review-notes .rn-head h2{flex:1;display:flex;align-items:center;gap:8px;margin:0;padding:0;border:0;background:none;font-size:15px;font-weight:650;line-height:1.3;color:var(--rn-ink);text-transform:none}
.review-notes .rn-head h2::before{content:"";width:8px;height:8px;border-radius:50%;background:var(--rn-accent);box-shadow:0 0 0 3px var(--rn-accent-soft)}
.review-notes .rn-grip{display:none}
.review-notes .rn-btn{display:flex;align-items:center;justify-content:center;width:32px;height:32px;margin:0;padding:0;border:0;border-radius:var(--rn-r-sm);background:transparent;color:var(--rn-muted);cursor:pointer;box-shadow:none;transition:background .15s,color .15s}
.review-notes .rn-btn:hover{background:var(--rn-surface);color:var(--rn-ink)}
.review-notes .rn-btn svg{display:block;pointer-events:none}
.review-notes .rn-btn .rn-i-max,.review-notes.is-min .rn-btn .rn-i-min{display:none}
.review-notes.is-min .rn-btn .rn-i-max{display:block}
.review-notes .rn-btn .rn-i-float,.review-notes.is-docked .rn-btn .rn-i-dock{display:none}
.review-notes.is-docked .rn-btn .rn-i-float{display:block}
.review-notes button:focus-visible,.review-notes a:focus-visible{outline:2px solid var(--rn-focus);outline-offset:2px}
.review-notes .rn-body{padding:16px 16px 20px}

/* Small: just the strip. */
.review-notes.is-min{overflow:hidden}
.review-notes.is-min .rn-body{display:none}
.review-notes.is-min .rn-head{border-bottom:0}
/* Moved: a floating card wherever it was dropped. */
.review-notes.is-moved{right:auto;width:min(360px,calc(100vw - 16px));max-height:min(80vh,680px)}

/* Desktop / Tablet / Phone: a segmented switch. */
.review-notes .rn-views{display:flex;gap:4px;margin:0 0 14px;padding:4px;background:var(--rn-surface);border:1px solid var(--rn-line);border-radius:12px}
.review-notes .rn-views button{flex:1;display:flex;align-items:center;justify-content:center;gap:6px;margin:0;padding:7px 6px;border:0;border-radius:8px;background:transparent;color:var(--rn-muted);font-size:13px;font-weight:600;line-height:1;cursor:pointer;box-shadow:none;transition:background .15s,color .15s,box-shadow .15s}
.review-notes .rn-views button:hover{color:var(--rn-ink)}
.review-notes .rn-views button[aria-pressed=true]{background:var(--rn-white);color:var(--rn-ink);box-shadow:0 1px 3px rgba(15,23,42,.12),0 0 0 1px var(--rn-line)}
.review-notes .rn-views svg{width:16px;height:16px;flex:none}

/* Where the note will be saved. */
.review-notes .rn-where{display:grid;gap:2px;margin:0 0 16px;padding:10px 12px;background:var(--rn-surface);border:1px solid var(--rn-line);border-radius:12px;font-size:12.5px;color:var(--rn-muted)}
.review-notes .rn-where span{display:block}
.review-notes .rn-where-page{font-weight:650;color:var(--rn-ink);word-break:break-all}

.review-notes .rn-label{display:block;margin:0 0 6px;font-size:12px;font-weight:600;color:var(--rn-muted);text-transform:uppercase;letter-spacing:.04em}
.review-notes input[type=text],.review-notes textarea{display:block;width:100%;margin:0;padding:10px 12px;border:1px solid var(--rn-line);border-radius:var(--rn-r-sm);background:var(--rn-white);font-size:14px;line-height:1.5;color:var(--rn-ink);box-shadow:inset 0 1px 2px rgba(15,23,42,.04);transition:border-color .15s,box-shadow .15s}
.review-notes input[type=text]{height:auto;min-height:0;margin-bottom:14px}
.review-notes textarea{min-height:110px;resize:vertical}
.review-notes input[type=text]:focus,.review-notes textarea:focus{outline:0;border-color:var(--rn-focus);box-shadow:0 0 0 3px rgba(37,99,235,.15)}
.review-notes .rn-acts{display:flex;align-items:center;gap:12px;margin-top:12px}
.review-notes .rn-save{margin:0;padding:10px 18px;border:0;border-radius:var(--rn-r-sm);background:var(--rn-ink);color:#fff;font-size:14px;font-weight:600;line-height:1.2;cursor:pointer;box-shadow:0 1px 2px rgba(15,23,42,.2);transition:background .15s,transform .1s}
.review-notes .rn-save:hover{background:#1e293b}
.review-notes .rn-save:active{transform:translateY(1px)}
.review-notes .rn-save:disabled{opacity:.55;cursor:default}
.review-notes .rn-status{font-size:13px;color:var(--rn-muted)}
.review-notes .rn-hint{margin:12px 0 16px;font-size:12px;line-height:1.5;color:var(--rn-soft)}

/* Notes already on this page: an accordion, closed until opened. */
.review-notes .rn-listbtn{display:flex;align-items:center;justify-content:space-between;width:100%;margin:0;padding:12px 2px;border:0;border-top:1px solid var(--rn-line);border-radius:0;background:none;font-size:14px;font-weight:600;color:var(--rn-ink);cursor:pointer;text-align:left;box-shadow:none}
.review-notes .rn-listbtn::after{content:"";width:7px;height:7px;margin-right:6px;border:solid var(--rn-muted);border-width:0 2px 2px 0;transform:rotate(-135deg) translate(-2px,-2px);transition:transform .2s}
.review-notes.is-listless .rn-listbtn::after{transform:rotate(45deg) translate(-2px,-2px)}
.review-notes.is-listless .rn-list,.review-notes.is-listless .rn-all{display:none}
.review-notes .rn-list{display:grid;gap:8px;list-style:none;margin:0;padding:0}
.review-notes .rn-list li{margin:0;padding:12px;background:var(--rn-surface);border:1px solid var(--rn-line);border-radius:12px}
.review-notes .rn-list li.is-done{opacity:.5}
.review-notes .rn-meta{font-size:12px;color:var(--rn-muted)}
.review-notes .rn-sec{display:inline-block;margin:6px 0!important;padding:2px 8px;border-radius:999px;background:var(--rn-accent-soft);color:var(--rn-accent-dark);font-size:12px;font-weight:600}
.review-notes .rn-note{white-space:pre-wrap;color:var(--rn-ink)}
.review-notes .rn-list li.rn-none{background:none;border:1px dashed var(--rn-line);color:var(--rn-muted);text-align:center}
.review-notes .rn-all{display:inline-flex;align-items:center;gap:4px;margin-top:14px;font-size:13px;font-weight:600;color:var(--rn-ink);text-decoration:none;border-bottom:1px solid var(--rn-line)}
.review-notes .rn-all:hover{border-color:var(--rn-ink)}

/* ---------- docked ---------- */
/* Docking (and the screen switch) needs a screen at least 900px wide. */
@media (max-width:899px){
.review-notes:not(.is-docked) .rn-dockbtn,.review-notes:not(.is-docked) .rn-views{display:none}
}
/* Let go here to dock. */
.rn-edge{position:fixed;z-index:99999;top:0;right:0;bottom:0;width:380px;background:rgba(225,29,72,.08);border-left:2px dashed #e11d48;pointer-events:none}
.rn-edge[hidden]{display:none}
/* The page in a frame on the left, the panel against the right wall, over everything (top bar too). */
html.rn-docked,html.rn-docked body{overflow:hidden}
.rn-split{position:fixed;z-index:100001;inset:0;display:flex;background:#e2e8f0}
.rn-stage{position:relative;flex:1;min-width:0;height:100%;overflow:hidden;display:flex;justify-content:center;background:#e2e8f0 radial-gradient(circle,#cbd5e1 1px,transparent 1.2px) 0 0/16px 16px}
/* The frame's size is set exactly (notes.js sizeFrame). Many themes cap frames at 100% wide or give
   them a height or margin, which would squeeze a desktop page to tablet width; never here. */
.rn-split .rn-stage iframe{flex:none!important;max-width:none!important;max-height:none!important;min-width:0!important;margin:0!important;padding:0!important;border:0!important;aspect-ratio:auto!important;background:#fff;transform-origin:top left;display:block!important}
.rn-stage.is-scaled{justify-content:flex-start}
.rn-stage.is-tablet,.rn-stage.is-phone{padding:20px 0}
.rn-stage.is-tablet iframe,.rn-stage.is-phone iframe{height:100%!important;border-radius:18px;box-shadow:0 0 0 1px rgba(15,23,42,.08),0 30px 60px -20px rgba(15,23,42,.35)}
.rn-split .review-notes.is-docked{position:static;flex:none;width:380px;height:100%;max-width:none;max-height:none;border:0;border-left:1px solid var(--rn-line);border-radius:0;box-shadow:-12px 0 40px -20px rgba(15,23,42,.3)}
.review-notes.is-docked .rn-head{cursor:default}
.review-notes.is-docked .rn-min{display:none}
.review-notes.is-docked.is-min .rn-body{display:block}

/* ---------- phone: a sheet along the bottom ---------- */
@media (max-width:720px){
.review-notes:not(.is-moved){top:auto;bottom:0;right:0;width:100%;max-width:100%;max-height:70vh;border-width:1px 0 0;border-radius:20px 20px 0 0;box-shadow:0 -20px 50px -10px rgba(15,23,42,.3)}
}

/* ---------- the Notes button: bright, and it wiggles every 30 seconds so nobody misses it ---------- */
html body button.rn-fab{display:flex;align-items:center;gap:8px;position:fixed;z-index:99999;right:20px;bottom:20px;margin:0;padding:12px 18px 12px 14px;border:2px solid #fff;border-radius:999px;background:var(--rn-accent);color:#fff;font:700 15px/1 var(--rn-font);letter-spacing:0;cursor:pointer;
  box-shadow:0 0 0 1px rgba(225,29,72,.35),0 10px 28px -6px rgba(225,29,72,.6),0 4px 10px rgba(15,23,42,.2);animation:rn-wiggle 30s ease-in-out 3s infinite;transition:background .15s,transform .15s}
html body button.rn-fab::before{content:"";width:18px;height:18px;flex:none;background:currentColor;
  -webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12a8 8 0 0 1-11.6 7.1L4 20l1-4.6A8 8 0 1 1 21 12z'/%3E%3Cpath d='M8.5 10.5h7M8.5 14h4'/%3E%3C/svg%3E") center/contain no-repeat;
  mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12a8 8 0 0 1-11.6 7.1L4 20l1-4.6A8 8 0 1 1 21 12z'/%3E%3Cpath d='M8.5 10.5h7M8.5 14h4'/%3E%3C/svg%3E") center/contain no-repeat}
html body button.rn-fab:hover{background:var(--rn-accent-dark);transform:translateY(-1px)}
html body button.rn-fab:focus-visible{outline:3px solid var(--rn-focus);outline-offset:3px}
@media (max-width:600px){
html body button.rn-fab{right:12px;bottom:calc(84px + env(safe-area-inset-bottom));padding:10px 16px 10px 12px;font-size:14px}
}
html.rn-open body button.rn-fab,html.rn-in-frame body button.rn-fab{display:none}
/* A short shake at the start of every 30 seconds, still the rest of the time. */
@keyframes rn-wiggle{
  0%,4%,100%{transform:rotate(0) scale(1)}
  .5%{transform:rotate(-8deg) scale(1.08)}
  1%{transform:rotate(7deg) scale(1.08)}
  1.5%{transform:rotate(-6deg) scale(1.08)}
  2%{transform:rotate(5deg) scale(1.05)}
  2.5%{transform:rotate(-3deg) scale(1.03)}
  3%{transform:rotate(0) scale(1)}
}
@media (prefers-reduced-motion:reduce){
html body button.rn-fab,#wpadminbar #wp-admin-bar-review-notes>.ab-item{animation:none}
}

/* ---------- WordPress's top bar is hidden while the panel is open, and inside the docked page ---------- */
html.rn-open,html.rn-in-frame{margin-top:0!important;--wp-admin--admin-bar--height:0px}
html.rn-open #wpadminbar,html.rn-in-frame #wpadminbar{display:none!important}
html.rn-open .review-notes{--rn-top:0px}

/* ---------- Notes in WordPress's top bar: red, so it stands out ---------- */
#wpadminbar #wp-admin-bar-review-notes>.ab-item{display:flex;align-items:center;height:32px;padding:0 12px;background:#e11d48;color:#fff;font-weight:600;animation:rn-wiggle 30s ease-in-out 3s infinite}
#wpadminbar #wp-admin-bar-review-notes>.ab-item:hover,#wpadminbar #wp-admin-bar-review-notes>.ab-item:focus{background:#be123c;color:#fff}
#wpadminbar #wp-admin-bar-review-notes .ab-icon{margin-right:6px;padding:0}
#wpadminbar #wp-admin-bar-review-notes .ab-icon::before{content:"\f125";top:2px;color:#fff}
/* WordPress hides most top-bar items on a phone; keep Notes, with its word. */
@media screen and (max-width:782px){
#wpadminbar li#wp-admin-bar-review-notes{display:block}
#wpadminbar #wp-admin-bar-review-notes>.ab-item{height:46px;width:auto;padding:0 12px;font-size:15px}
#wpadminbar #wp-admin-bar-review-notes .ab-icon{margin:0 6px 0 0;padding:0;width:auto}
#wpadminbar #wp-admin-bar-review-notes .ab-icon::before{font-size:24px;top:0}
}
