/* ==========================================================================
   Materials — actions (long-press, sheet, rename modal, undo toast).
   GP-MATERIALS-ACTIONS. Все цвета — через токены design-tokens.css.
   ========================================================================== */

/* ----------- card press states ----------------------------------------- */
.mat-card {
  position: relative;
  transition: transform .15s ease, box-shadow .15s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.mat-card.is-pressed {
  transform: scale(0.98);
  box-shadow: var(--shadow-press);
}
.mat-card.is-long-pressed {
  transform: scale(0.96);
  box-shadow: var(--shadow-clay-lift);
}

/* ----------- long-press progress ring ---------------------------------- */
.mat-ring {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .12s ease;
}
.mat-ring.visible { opacity: 1; }
.mat-ring circle { fill: none; stroke-width: 4; }
.mat-ring .ring-bg { stroke: var(--surface-container-high); }
.mat-ring .ring-fg {
  stroke: var(--primary);
  stroke-linecap: round;
  stroke-dasharray: 100 100;
  stroke-dashoffset: 100;
  transform: rotate(-90deg);
  transform-origin: center;
  transition: stroke-dashoffset .2s linear;
}
.mat-ring.fill .ring-fg { stroke-dashoffset: 0; }

/* ----------- bottom sheet (action menu) -------------------------------- */
.mat-scrim {
  position: fixed;
  inset: 0;
  background: var(--scrim-sheet);
  backdrop-filter: blur(2px);
  z-index: 980;
  opacity: 0;
  transition: opacity .18s ease;
}
.mat-scrim.visible { opacity: 1; }

.mat-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--surface-container-lowest);
  border-radius: 28px 28px 0 0;
  padding: 8px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -20px 40px -10px color-mix(in srgb, var(--on-surface) 15%, transparent);
  z-index: 990;
  transform: translateY(100%);
  transition: transform .22s ease;
}
.mat-sheet.visible { transform: translateY(0); }

.mat-sheet-grabber {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--outline-variant);
  margin: 8px auto 12px;
}
.mat-sheet-context {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 4px 14px;
  border-bottom: 1px solid var(--surface-container-high);
}
.mat-sheet-context .mat-sheet-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.mat-sheet-action {
  display: flex;
  gap: 14px;
  align-items: center;
  width: 100%;
  padding: 16px 8px;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  color: var(--on-surface);
  text-align: left;
  min-height: 56px;
  border-radius: var(--radius-md);
  transition: background .15s ease;
}
.mat-sheet-action:hover,
.mat-sheet-action:active { background: var(--surface-container-low); }
.mat-sheet-action.is-danger { color: var(--error); }
.mat-sheet-action .mat-sheet-ico {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--surface-container-low);
  display: grid;
  place-items: center;
  font-size: 18px;
  flex-shrink: 0;
}
.mat-sheet-action.is-danger .mat-sheet-ico {
  background: color-mix(in srgb, var(--error) 12%, transparent);
  color: var(--error);
}
.mat-sheet-cancel {
  width: 100%;
  min-height: 56px;
  margin-top: 6px;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--surface-container-low);
  color: var(--on-surface);
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

/* ----------- rename modal ---------------------------------------------- */
.mat-modal-scrim {
  position: fixed;
  inset: 0;
  background: var(--scrim-modal);
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  opacity: 0;
  transition: opacity .18s ease;
}
.mat-modal-scrim.visible { opacity: 1; }

.mat-modal {
  width: 100%;
  max-width: 320px;
  background: var(--surface-container-lowest);
  border-radius: 24px;
  padding: 20px;
  box-shadow: var(--shadow-clay-lift);
}
.mat-modal h3 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 600;
  color: var(--on-surface);
}
.mat-modal-hint {
  font-size: 12px;
  color: var(--on-surface-variant);
  margin-bottom: 14px;
}
.mat-modal-preview {
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--surface-container-low);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  margin-bottom: 14px;
}
.mat-modal-preview .mat-thumb { width: 36px; height: 36px; font-size: 16px; }
.mat-modal-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--on-surface-variant);
}
.mat-modal-input {
  width: 100%;
  min-height: 56px;
  border: 2px solid var(--outline-variant);
  border-radius: 14px;
  padding: 0 14px;
  font-size: 16px;
  font-family: inherit;
  background: var(--surface-container-lowest);
  color: var(--on-surface);
  transition: border-color .15s ease;
  margin-top: 6px;
}
.mat-modal-input:focus { outline: none; border-color: var(--primary); }
.mat-modal.is-invalid .mat-modal-input { border-color: var(--error); }
.mat-modal-error {
  display: none;
  font-size: 12px;
  color: var(--error);
  margin-top: 6px;
  line-height: 1.3;
}
.mat-modal.is-invalid .mat-modal-error { display: block; }
.mat-modal-buttons {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.mat-btn {
  flex: 1;
  min-height: 56px;
  border: 0;
  border-radius: var(--radius-lg);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}
.mat-btn-secondary { background: var(--surface-container-low); color: var(--on-surface); }
.mat-btn-primary { background: var(--primary); color: var(--on-primary); }
.mat-btn-primary:disabled {
  background: var(--surface-container-high);
  color: var(--outline);
  cursor: not-allowed;
}

/* Toasts вынесены в materials-toast.css (правило ≤300 строк/файл). */

@media (prefers-reduced-motion: reduce) {
  .mat-card,
  .mat-ring,
  .mat-ring .ring-fg,
  .mat-scrim,
  .mat-sheet,
  .mat-modal-scrim {
    transition: none !important;
  }
  .mat-card.is-pressed,
  .mat-card.is-long-pressed { transform: none; }
}
