/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* Slim Trix editor — reduced toolbar, compact styling */
.trix-slim trix-toolbar .trix-button-group--history-tools,
.trix-slim trix-toolbar .trix-button--icon-strike,
.trix-slim trix-toolbar .trix-button--icon-heading-1,
.trix-slim trix-toolbar .trix-button--icon-quote,
.trix-slim trix-toolbar .trix-button--icon-code,
.trix-slim trix-toolbar .trix-button--icon-decrease-nesting-level,
.trix-slim trix-toolbar .trix-button--icon-increase-nesting-level,
.trix-slim trix-toolbar .trix-button--icon-attach,
.trix-slim trix-toolbar .trix-button-group--file-tools {
  display: none;
}

/* Ensure list buttons are visible in slim toolbar */
.trix-slim trix-toolbar .trix-button--icon-bullet-list,
.trix-slim trix-toolbar .trix-button--icon-number-list {
  display: inline-flex;
}

.trix-slim trix-toolbar .trix-button-group {
  border: none;
  margin-bottom: 4px;
}

.trix-slim trix-toolbar .trix-button {
  border: none;
  border-radius: 6px;
  padding: 0 0.4em;
  color: rgba(0, 0, 0, 0.5);
}

.trix-slim trix-toolbar .trix-button:not(:first-child) {
  border-left: none;
}

.trix-slim trix-toolbar .trix-button.trix-active {
  background: #e0e7ff;
  color: #4338ca;
}

.trix-slim trix-toolbar .trix-button:hover:not(:disabled) {
  background: #f3f4f6;
}

.trix-slim trix-toolbar .trix-button--icon {
  width: 2.2em;
  height: 2em;
}

@media (max-width: 768px) {
  .trix-slim trix-toolbar .trix-button--icon {
    width: 2.8em;
    height: 2.4em;
  }
}

.trix-slim trix-editor {
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  min-height: 5em;
  font-size: 0.875rem;
  line-height: 1.5;
  background: rgba(255, 255, 255, 0.5);
  outline: none;
  transition: border-color 0.15s;
}

.trix-slim trix-editor:focus {
  border-color: #818cf8;
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.1);
}

/* Compact variant for comments */
.trix-compact trix-editor {
  min-height: 3em;
  padding: 0.5rem 0.75rem;
}


.trix-slim trix-editor {
  overflow-wrap: break-word;
  word-break: break-word;
}

/* List formatting inside Trix editor */
.trix-slim trix-editor ul {
  list-style: disc;
  margin-left: 1.5em;
}

.trix-slim trix-editor ol {
  list-style: decimal;
  margin-left: 1.5em;
}

/* Dark mode Trix overrides */
:root.dark .trix-slim trix-editor:empty::before {
  color: #a5b4fc; /* indigo-300 — match placeholder style */
}

:root.dark .trix-slim trix-editor {
  background: var(--bg-input);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

:root.dark .trix-slim trix-editor:focus {
  border-color: var(--accent-indigo);
}

:root.dark .trix-slim trix-toolbar .trix-button {
  color: #c7d2fe; /* indigo-200 */
}

:root.dark .trix-slim trix-toolbar .trix-button--icon::before {
  filter: invert(1);
  opacity: 0.7;
}

:root.dark .trix-slim trix-toolbar .trix-button:hover:not(:disabled) {
  background: rgba(129, 140, 248, 0.15); /* indigo-400/15 */
}

:root.dark .trix-slim trix-toolbar .trix-button:hover:not(:disabled)::before {
  opacity: 1;
}

:root.dark .trix-slim trix-toolbar .trix-button.trix-active {
  background: rgba(99, 102, 241, 0.3);
  color: #a5b4fc; /* indigo-300 */
}

:root.dark .trix-slim trix-toolbar .trix-button.trix-active::before {
  filter: invert(1);
  opacity: 1;
}

/* Post body rendering */
.post-body {
  word-break: break-word;
  overflow-wrap: break-word;
}

.post-body div {
  margin-bottom: 0.25em;
}

.post-body div:last-child {
  margin-bottom: 0;
}

.post-body strong {
  font-weight: 600;
}

.post-body a:not([class]) {
  color: #4f46e5;
  text-decoration: underline;
}

.post-body a:not([class]):hover {
  color: #3730a3;
}

.post-body ul, .post-body ol {
  margin-left: 1.5em;
  margin-bottom: 0.5em;
}

.post-body ul {
  list-style: disc;
}

.post-body ol {
  list-style: decimal;
}

/* Hide action buttons until hover — only on devices with a mouse/trackpad.
   Touch-only devices (iPad, phones) always see the buttons. */
@media (hover: hover) {
  .hover-show {
    opacity: 0;
  }
  .group:hover .hover-show {
    opacity: 1;
  }
}

/* Emoji picker panel */
.emoji-picker-panel {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  width: 320px;
  max-height: 360px;
  overflow-y: auto;
  padding: 0.5rem;
}

.emoji-picker-recent {
  margin-bottom: 0.25rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid #f3f4f6;
}

.emoji-picker-category-label {
  font-size: 0.675rem;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.25rem 0.125rem;
}

.emoji-picker-tabs {
  display: flex;
  gap: 2px;
  padding: 0.25rem 0;
  border-bottom: 1px solid #f3f4f6;
  margin-bottom: 0.375rem;
}

.emoji-picker-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
  border-radius: 0.375rem;
  font-size: 1rem;
  cursor: pointer;
  border: none;
  background: transparent;
  transition: background-color 0.15s;
}

.emoji-picker-tab:hover {
  background: #f3f4f6;
}

.emoji-picker-tab-active {
  background: #e0e7ff;
}

.emoji-picker-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
}

.emoji-picker-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1;
  font-size: 1.25rem;
  border-radius: 0.375rem;
  cursor: pointer;
  border: none;
  background: transparent;
  padding: 0;
  transition: background-color 0.15s;
}

.emoji-picker-item:hover {
  background: #f3f4f6;
}

@media (max-width: 768px) {
  .emoji-picker-panel {
    width: calc(100vw - 2rem);
    max-width: 320px;
    right: 0;
  }

  .emoji-picker-item {
    font-size: 1.375rem;
  }
}

/* Measure edit and delete controls.
   Touch devices cannot hover, so a hover-only reveal would hide the only way
   into the measure editor. Show them there, and keep the chart clean on
   pointer devices by revealing on hover. */
.bt-measure-actions {
  opacity: 0.55;
}

@media (hover: hover) and (pointer: fine) {
  .bt-measure-actions {
    opacity: 0;
  }

  .bt-measure:hover .bt-measure-actions,
  .bt-measure-actions:focus-within {
    opacity: 1;
  }
}

/* The BPM field has its own minus and plus buttons, so the native number
   spinner is a second, smaller set of the same control. */
.bt-no-spinner::-webkit-outer-spin-button,
.bt-no-spinner::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.bt-no-spinner {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* A note field that reads like plain writing: no toolbar or frame. The
   keyboard shortcuts for bold, italic and lists still work. */
.trix-bare trix-toolbar {
  display: none;
}

.trix-bare trix-editor {
  border: 0;
  padding: 0;
  min-height: 4.5rem;
  background: transparent;
}

.trix-bare trix-editor:focus {
  outline: none;
}

/* Number fields where the spinner arrows only crowd a short value. */
.no-spin::-webkit-inner-spin-button,
.no-spin::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.no-spin {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* The practice log journal's own toolbar: a few quiet buttons beside the
   send controls instead of Trix's full bar above the text. */
/* The post composer reads as one line until it opens. */
.trix-compact trix-editor {
  min-height: 1.5rem;
}

.composer-expanded .trix-compact trix-editor {
  min-height: 4.5rem;
}

trix-toolbar.journal-toolbar {
  display: block;
}

.journal-tool {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: #9ca3af;
  transition: background-color 0.15s, color 0.15s;
}

.journal-tool:hover {
  background-color: rgba(107, 114, 128, 0.1);
  color: #4b5563;
}

.journal-tool.trix-active {
  background-color: rgba(99, 102, 241, 0.12);
  color: #4f46e5;
}

.trix-bare trix-editor:empty:not(:focus)::before {
  color: #9ca3af;
}

/* Opens and closes with a short fade and slide. Browsers that can animate
   to height: auto also grow it, so what's below glides rather than jumps. */
.reveal {
  interpolate-size: allow-keywords;
  overflow: hidden;
  transition:
    opacity 0.22s ease,
    transform 0.22s ease,
    height 0.26s ease,
    display 0.26s allow-discrete;
}

.reveal.hidden {
  opacity: 0;
  transform: translateY(-6px);
  height: 0;
}

@starting-style {
  .reveal:not(.hidden) {
    opacity: 0;
    transform: translateY(-6px);
    height: 0;
  }
}

/* The dock: a page's main controls floating at the foot of the screen. It
   slides up as it appears, whether on page load or turned on. */
.dock {
  position: fixed;
  left: 50%;
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 40;
  max-width: calc(100vw - 1.5rem);
  transform: translate(-50%, 0);
  transition:
    transform 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.15),
    opacity 0.2s ease,
    display 0.32s allow-discrete;
}

.dock[hidden] {
  display: none;
  transform: translate(-50%, calc(100% + 2rem));
  opacity: 0;
}

@starting-style {
  .dock:not([hidden]) {
    transform: translate(-50%, calc(100% + 2rem));
    opacity: 0;
  }
}

.dock.is-tucked {
  transform: translate(-50%, calc(100% + 2rem));
  opacity: 0;
  pointer-events: none;
}

/* Room at the foot of the page so the last of it can scroll clear of the dock. */
body:has(.dock:not([hidden])) {
  padding-bottom: 5rem;
}

/* Liquid glass: see-through, blurred and saturated, with a bright rim on top
   and a deeper shadow than the in-page action bars, since it floats over content. */
/* Nothing in the dock shrinks: on a phone it scrolls sideways instead,
   so round buttons stay round. */
.dock-bar > * {
  flex-shrink: 0;
}

/* Icons sit dead centre in their buttons, whatever margins the mirrored
   source gave them. */
.dock-bar .action-bar-icon {
  justify-content: center;
}

.dock-bar .action-bar-icon > svg {
  margin: 0;
}

.dock-bar {
  display: flex;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  gap: 0.375rem;
  padding: 0.375rem;
  background: color-mix(in srgb, var(--bg-card) 55%, transparent);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow:
    0 12px 32px var(--shadow-color),
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    inset 0 -1px 0 rgba(255, 255, 255, 0.2);
}

:root.dark .dock-bar {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow:
    0 12px 32px var(--shadow-color),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.dock-select {
  flex: none;
  max-width: 11rem;
  height: 2.25rem;
  padding: 0 1.75rem 0 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 9999px;
  background-color: rgba(255, 255, 255, 0.45);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
  font-size: 0.8125rem;
  font-weight: 500;
  color: #1f2937;
  text-overflow: ellipsis;
  cursor: pointer;
}

.dock-select[type="number"] {
  width: 4rem;
  padding: 0 0.5rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}

.dock-select[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
}

/* A readout in the dock, like the tempo, rather than something to press. */
.dock-readout {
  flex: none;
  display: inline-flex;
  align-items: baseline;
  gap: 0.25rem;
  padding: 0 0.5rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.dock-select:hover {
  background-color: rgba(255, 255, 255, 0.7);
}

.dock-select:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.4);
}

:root.dark .dock-select {
  background-color: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: none;
  color: #f3f4f6;
}

/* The dock's choices on desktop, opening above the bar in the same glass. */
.dock-menu {
  position: fixed;
  inset: auto;
  margin: 0;
  max-height: min(60vh, 26rem);
  overflow-y: auto;
  padding: 0.375rem;
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.6);
  background: color-mix(in srgb, var(--bg-card) 72%, transparent);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  box-shadow:
    0 16px 40px var(--shadow-color),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  color: var(--text-primary);
  opacity: 0;
  transform: translateY(6px) scale(0.98);
  transform-origin: bottom left;
  transition:
    opacity 0.16s ease,
    transform 0.18s ease,
    overlay 0.18s allow-discrete,
    display 0.18s allow-discrete;
}

.dock-menu:popover-open {
  opacity: 1;
  transform: none;
}

@starting-style {
  .dock-menu:popover-open {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
}

.dock-menu-heading {
  padding: 0.5rem 0.75rem 0.25rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #9ca3af;
}

.dock-menu-item {
  display: block;
  width: 100%;
  padding: 0.4rem 0.75rem;
  border-radius: 0.625rem;
  text-align: left;
  font-size: 0.875rem;
  white-space: nowrap;
}

.dock-menu-item:hover {
  background-color: rgba(99, 102, 241, 0.1);
}

.dock-menu-item[aria-selected="true"] {
  background-color: rgba(99, 102, 241, 0.14);
  color: #4f46e5;
  font-weight: 600;
}

:root.dark .dock-menu {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow:
    0 16px 40px var(--shadow-color),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* On phones the dock spans the screen and scrolls sideways if it must. Text
   at 16px stops iOS zooming in when a select is tapped. */
@media (max-width: 640px) {
  .dock {
    left: 0.75rem;
    right: 0.75rem;
    max-width: none;
    transform: none;
  }

  .dock[hidden],
  .dock.is-tucked {
    transform: translateY(calc(100% + 2rem));
  }

  @starting-style {
    .dock:not([hidden]) {
      transform: translateY(calc(100% + 2rem));
    }
  }

  .dock-bar {
    width: 100%;
  }

  .dock-select {
    max-width: 9rem;
    font-size: 1rem;
  }

  /* Bigger targets for thumbs: every control in the dock is 44px tall. */
  .dock-bar {
    gap: 0.25rem;
    padding: 0.3rem;
  }

  .dock-bar .action-bar-icon {
    width: 2.75rem;
    height: 2.75rem;
  }

  /* A dock select shows its compact face, with the real select laid
     invisibly over it so a tap still opens the phone's picker. */
  .dock-field {
    position: relative;
    display: inline-flex;
  }

  .dock-face {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    height: 2.75rem;
    min-width: 2.75rem;
    padding: 0 0.6rem 0 0.85rem;
    border-radius: 9999px;
    background-color: rgba(255, 255, 255, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
    font-size: 0.9375rem;
    font-weight: 600;
    white-space: nowrap;
    color: var(--text-primary);
  }

  .dock-face-chevron {
    width: 0.875rem;
    height: 0.875rem;
    opacity: 0.45;
  }

  .dock-field .dock-select {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    opacity: 0;
  }
}

/* Faces are only for phones; wider screens show the select itself. */
@media (min-width: 641px) {
  .dock-face {
    display: none;
  }
}

/* iOS Safari skips :active styles, so its own tap flash shows a row was tapped. */
.account-menu a,
.account-menu button {
  -webkit-tap-highlight-color: rgba(99, 102, 241, 0.15);
}

/* The account menu's popover, under the corner button. */
.account-menu {
  position: fixed;
  inset: auto;
  top: 3.75rem;
  right: 0.75rem;
  margin: 0;
  padding: 0;
}

:root.dark .dock-face {
  background-color: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
}

/* Flash messages and other toasts: under the account button in the top-right
   corner rather than beneath it, and above it so nothing covers them. */
.toast-stack {
  position: fixed;
  top: 4.25rem;
  right: 0.75rem;
  z-index: 60;
  width: calc(100% - 1.5rem);
  max-width: 20rem;
}

