/* StickHive — components.css: sidebar, note items, modal, toast, popover */


/* ---------- Sidebar sections ---------- */
.section-list {
  list-style: none;
}

.section-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 12px;
  cursor: pointer;
  user-select: none;
  border: 1px solid transparent;
}

.section-item:hover {
  background: var(--parchment);
}

.section-item.active {
  background: var(--amber-tint);
  border-color: var(--amber);
  box-shadow: var(--shadow-soft);
}

.section-item.active .section-name {
  color: var(--ink);
}

.section-dot {
  width: 26px;
  height: 30px;  background: var(--ash-deep);
  color: #fff;
  font-size: 0.78rem;
  font-family: var(--font-display);
  font-weight: 700;
  clip-path: polygon(50% 0%, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* <button> sejak audit R4-F15 — reset gaya tombol agar tampil seperti teks. */
.section-name {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.92rem;
  font-family: var(--font-display);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.section-count {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-soft);
}

.section-item.active .section-count {
  color: var(--amber-deep);
  font-weight: 500;
}

.section-item.inbox .section-name {
  font-style: normal;
  opacity: 0.85;
}

.section-item.inbox .section-dot {
  background: var(--ink);
}

.section-menu-btn {
  background: none;
  border: none;
  font-size: 1.05rem;
  color: var(--ink-soft);
  opacity: 0.55;
  padding: 2px 6px;
  border-radius: 6px;
}

.section-menu-btn:hover {
  opacity: 1;
  background: var(--parchment);
}

.section-reorder {
  display: flex;
  flex-direction: row; /* sejajar agar tiap panah 24×24 tanpa menambah tinggi baris */
  gap: 1px;
}

.section-reorder button {
  background: none;
  border: none;
  font-size: 0.6rem;
  color: var(--ink-soft);
  opacity: 0.6;
  line-height: 1;
  /* target sentuh ≥ 24×24 (WCAG 2.5.8 / audit R4-F22) */
  min-width: 24px;
  min-height: 24px;
  padding: 4px 6px;
}

.section-reorder button:hover {
  opacity: 1;
  color: var(--amber-deep);
}

.add-section {
  margin-top: 12px;
  width: 100%;
}

/* ---------- Menu konteks (popover) ---------- */
.popover {
  position: absolute;
  z-index: 60;
  background: var(--surface);
  border: 1px solid var(--ash);
  border-radius: 10px;
  box-shadow: var(--shadow-hard);
  min-width: 180px;
  padding: 6px;
}

.popover button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--ink);
}

.popover button:hover {
  background: var(--parchment);
}

.popover button.danger {
  color: var(--cranberry);
}

/* ---------- Note items ---------- */
.note-item {
  border: 1px solid var(--ash);
  border-radius: 12px;
  padding: 11px 13px;
  margin-bottom: 9px;
  background: var(--parchment-bright);
  box-shadow: var(--shadow-soft);
  transition: transform 0.1s;
}

.note-item:hover {
  transform: translateY(-1px);
  box-shadow: 1px 2px 0 rgba(42, 36, 23, 0.25);
}

.note-item.overdue {
  background: var(--cranberry-tint);
  border-color: #e4a6ad;
}

.note-head {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.note-kicker {
  width: 26px;
  height: 30px;  clip-path: polygon(50% 0%, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.72rem;
}

.note-kicker.reminder {
  background: var(--cranberry);
}

.note-kicker.material {
  background: var(--sage);
}

.note-title {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink);
  font-size: 0.95rem;
  word-break: break-word;
}

.note-body {
  margin-top: 4px;
  font-size: 0.87rem;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink-soft);
}

.note-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.note-meta .due {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
}

.due-soon {
  color: var(--sage);
}

.due-overdue {
  color: var(--cranberry);
  font-weight: 600;
}

.note-source {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  background: var(--parchment);
  border: 1px solid var(--ash);
  padding: 1px 7px;
  border-radius: 999px;
}

.note-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.12s;
}

.note-item:hover .note-actions,
.note-item:focus-within .note-actions {
  opacity: 1;
}

/* Perangkat sentuh tak punya hover — aksi note harus terlihat (audit R4-F14). */
@media (hover: none) {
  .note-actions {
    opacity: 1;
  }
}

.note-actions button {
  background: none;
  border: none;
  color: var(--ink-soft);
  font-size: 0.9rem;
  /* target sentuh ≥ 24px (audit R4-F22) */
  min-width: 28px;
  min-height: 28px;
  padding: 5px 6px;
  border-radius: 6px;
}

.note-actions button:hover {
  background: var(--parchment);
  color: var(--ink);
}

.note-actions .delete:hover {
  color: var(--cranberry);
}

/* ---------- FAB ---------- */
.fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--amber);
  color: var(--ink);
  font-size: 1.7rem;
  font-weight: 700;
  border: 1px solid var(--ink);
  box-shadow: var(--shadow-hard-lg);
  z-index: 30;
}

.fab:active {
  transform: translate(3px, 3px);
  box-shadow: none;
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(42, 36, 23, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 14px;
  z-index: 50;
  overflow-y: auto;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--ash);
  box-shadow: var(--shadow-hard-lg);
  width: 100%;
  max-width: 580px;
  padding: 20px;
  animation: modal-in 0.16s ease;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal h3 {
  margin-bottom: 14px;
  font-family: var(--font-display);
  font-size: 1.2rem;
}

.modal-close {
  float: right;
  background: none;
  border: none;
  font-size: 1.3rem;
  color: var(--ink-soft);
  line-height: 1;
  /* target sentuh layak (audit R4-F22) */
  min-width: 32px;
  min-height: 32px;
  padding: 6px;
}

/* ---------- Effort meter (konsep inverse-effort) ---------- */
.effort-meter {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 14px;
  padding: 10px 6px 0;
}

.effort-step {
  position: relative;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding-top: 14px;
}

.effort-step::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ash-deep);
  z-index: 1;
}

.effort-step::after {
  content: "";
  position: absolute;
  top: 4px;
  left: -50%;
  width: 100%;
  height: 2px;
  background: var(--ash);
  z-index: 0;
}

.effort-step:first-child::after {
  display: none;
}

.effort-step.active {
  color: var(--amber-deep);
  font-weight: 500;
}

.effort-step.active::before {
  background: var(--amber);
  border: 1px solid var(--amber-deep);
  clip-path: polygon(50% 0%, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%);
  width: 14px;
  height: 15px;
  top: -2px;
}

.effort-step.active::after {
  background: var(--amber);
}

/* ---------- Tab dalam modal catatan ---------- */
.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}

.tabs button {
  flex: 1;
  padding: 9px 6px;
  border: 1px solid var(--ash-deep);
  background: var(--parchment-bright);
  border-radius: 10px;
  font-weight: 600;
  font-family: var(--font-display);
  color: var(--ink-soft);
  font-size: 0.86rem;
}

.tabs button.active {
  background: var(--amber);
  color: var(--ink);
  border-color: var(--amber-deep);
  box-shadow: var(--shadow-hard);
}

/* Layar sangat sempit: 2×2 agar tombol tab tidak meluber (audit UI R4). */
@media (max-width: 360px) {
  .tabs {
    flex-wrap: wrap;
  }

  .tabs button {
    flex: 1 1 45%;
  }
}

/* ---------- Tombol rekam ---------- */
.record-btn {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 4px solid var(--cranberry);
  background: var(--surface);
  color: var(--cranberry);
  font-size: 1.7rem;
  display: block;
  margin: 10px auto;
  transition: background 0.15s, color 0.15s;
}

.record-btn.recording {
  background: var(--cranberry);
  color: #fff;
  animation: pulse 1.2s infinite;
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(178, 58, 72, 0.45);
  }
  50% {
    box-shadow: 0 0 0 14px rgba(178, 58, 72, 0);
  }
}

.record-timer {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--ink);
  margin: 8px 0;
}

.record-status {
  text-align: center;
  font-size: 0.88rem;
  min-height: 22px;
  color: var(--ink-soft);
}

.record-status .spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--ash);
  border-top-color: var(--amber-deep);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -2px;
  margin-right: 6px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Swatch warna ---------- */
.swatches {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.swatch {
  /* 36px: target sentuh layak (audit R4-F22) */
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 2px solid transparent;
}

.swatch.selected {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px var(--surface) inset;
}

/* ---------- Toast ---------- */
.toast-wrap {
  position: fixed;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(92vw, 420px);
}

.toast {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--ash);
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 0.9rem;
  box-shadow: var(--shadow-hard);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toast-in 0.18s ease;
  border-left-width: 4px;
}

.toast.error {
  border-left-color: var(--cranberry);
}

.toast.success {
  border-left-color: var(--sage);
}

.toast.warn {
  border-left-color: var(--amber);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.toast .toast-msg {
  flex: 1;
}

.toast .toast-action {
  background: var(--amber);
  border: 1px solid var(--ink);
  color: var(--ink);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 1px 1px 0 var(--ink);
}

/* ---------- Popover kuota ---------- */
.quota-popover {
  position: fixed;
  z-index: 70;
  background: var(--surface);
  border: 1px solid var(--ash);
  border-radius: 10px;
  box-shadow: var(--shadow-hard);
  padding: 12px 14px;
  min-width: 220px;
  font-size: 0.85rem;
}

.quota-popover .row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 4px 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.quota-popover .row b {
  color: var(--ink);
}

@media (max-width: 480px) {
  .quota-bar {
    gap: 3px;
    flex-shrink: 0;
  }

  .quota-bar .chip {
    font-size: 0.64rem;
    padding: 2px 5px;
  }

  .section-head h2 {
    word-break: break-word;
  }

  .effort-step {
    font-size: 0.56rem;
  }
}
