/* ===== SLOTH — Modal Dialogs ===== */

@keyframes backdrop-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translate(-50%, calc(-50% + 1rem)) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* ── Modal Actions ──────────────────────────────────────── */
.confirmation-actions {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
}

.confirmation-actions button {
  text-align: center;
}

.action-button {
  min-height: var(--control-height-md);
  padding: 0 var(--control-padding-x-md);
  border-radius: var(--radius-control);
  cursor: pointer;
  border: 1.5px solid transparent;
  font-weight: 700;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  flex: 1;
  transition: filter var(--ease-fast), transform var(--ease-fast);
  line-height: 1;
}

/* Töltés közben a gomb tartalma egy spinner-div; csak ekkor kapcsol be (frontend.md). */
.action-button.is-loading {
  display: flex;
  align-items: center;
  justify-content: center;
}

.action-button:hover {
  filter: brightness(1.08);
}

.action-button:active {
  transform: translateY(1px);
}

.action-button.cancel {
  background-color: var(--bg-surface);
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
}

.action-button.cancel:hover {
  background-color: var(--bg-muted);
}

/* ── Shared sloth-modal (group actions, extend form, etc.) ── */
.sloth-modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 9998;
  animation: backdrop-in var(--ease-base) both;
}

.sloth-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(22rem, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  border-top: 3px solid var(--clr-green);
  z-index: 9999;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  animation: modal-in var(--ease-base) both;
  transition: background-color var(--ease-base);
}

.sloth-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5) var(--space-3);
  /* --border (not --border-light) so the header separator stays visible in
     dark mode, where --border-light blends into the modal surface. */
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sloth-modal-title {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text-primary);
}

.sloth-modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--control-icon-button-sm);
  height: var(--control-icon-button-sm);
  border-radius: var(--radius-control);
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--ease-fast), color var(--ease-fast);
  flex-shrink: 0;
  background: none;
  border: none;
}

.sloth-modal-close:hover {
  background: var(--bg-muted);
  color: var(--text-primary);
}

.sloth-modal-body {
  padding: var(--space-4) var(--space-5) var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ── Danger modifier ────────────────────────────────────── */
.sloth-modal--danger {
  border-top-color: var(--clr-red-dark);
}

/* ── Announcement popup ──────────────────────────────────── */
#announcement-popup .sloth-modal {
  width: min(26rem, calc(100vw - 2rem));
}
#announcement-popup .sloth-modal-body {
  padding: var(--space-3) var(--space-4) var(--space-4);
  gap: var(--space-3);
}
#announcement-popup .dcm-question {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  overflow-y: auto;
  max-height: 55vh;
}
.ann-item {
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-light);
}
.ann-title {
  display: block;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}
.ann-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.6;
}
.ann-p { margin: 0; }
.ann-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.ann-list li {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  color: inherit;
  padding-left: var(--space-2);
}
.ann-list li::before {
  content: '•';
  color: var(--clr-green);
  flex-shrink: 0;
  font-size: 0.85em;
  line-height: 1.6;
}

/* ── Repeating event radio options ──────────────────────── */
.repeating-event-save-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.repeating-event-save-option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--text-primary);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-light);
  transition: border-color var(--ease-fast), background var(--ease-fast);
}

.repeating-event-save-option:hover {
  border-color: var(--border-focus);
  background: var(--bg-surface);
}

.repeating-event-save-option input[type="radio"] {
  display: none;
}

.repeating-event-save-option:has(input:checked) {
  border-color: var(--clr-green);
  background: var(--bg-surface);
}

.repeating-radio-custom {
  position: relative;
  width: 1.125rem;
  height: 1.125rem;
  flex-shrink: 0;
  color: var(--text-muted);
}

.repeating-radio-unchecked,
.repeating-radio-checked {
  position: absolute;
  inset: 0;
  transition: opacity var(--ease-fast);
}

.repeating-radio-checked { display: none; color: var(--clr-green); }
.repeating-event-save-option:has(input:checked) .repeating-radio-checked { display: block; }
.repeating-event-save-option:has(input:checked) .repeating-radio-unchecked { display: none; }

/* ── Repeating event action buttons ─────────────────────── */
.repeating-event-save-actions {
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
}

.repeating-event-cancel-btn {
  min-height: var(--control-height-md);
  padding: 0 var(--control-padding-x-md);
  border-radius: var(--radius-control);
  border: 1.5px solid var(--border-input);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background var(--ease-fast), border-color var(--ease-fast);
  white-space: nowrap;
}

.repeating-event-cancel-btn:hover {
  background: var(--bg-muted);
  border-color: var(--border);
}

.repeating-event-confirm-btn {
  min-height: var(--control-height-md);
  padding: 0 var(--control-padding-x-md);
  border-radius: var(--radius-control);
  border: none;
  background: var(--clr-green);
  color: var(--text-inverse);
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: opacity var(--ease-fast);
  white-space: nowrap;
}

.repeating-event-confirm-btn:hover { opacity: 0.88; }

.repeating-event-confirm-btn--danger { background: var(--clr-red-dark); }

/* ── Repeating event modal question text ────────────────── */
.repeating-modal-question {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}

/* ── Group action bar (floating bottom) ─────────────────── */
.group-action-bar {
  position: fixed;
  bottom: calc(var(--footer-height) + var(--space-2) + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%) translateY(0.5rem);
  z-index: 25; /* below the mobile menu overlay (z-index 30) so the open menu sits on top */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-4);
  width: calc(100vw - 2rem);
  max-width: calc(100vw - 2rem);
  background: var(--clr-green);
  border: 2px solid var(--clr-green);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--ease-fast), visibility var(--ease-fast), transform var(--ease-fast);
  pointer-events: none;
  white-space: nowrap;
}

/* Desktop: not full width, but bigger than its content */
@media (min-width: 640px) {
  .group-action-bar {
    width: auto;
    min-width: 30rem;
    max-width: 42rem;
    padding: var(--space-4) var(--space-6);
  }
}

.group-action-bar--visible {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.group-action-label {
  font-size: var(--text-xs);
  color: var(--overlay-active-text);
  white-space: nowrap;
  text-align: center;
  order: 2; /* label below buttons */
}

/* Wraps rather than squeezing: on a narrow phone four options on one row end up
   thumb-width apart, so they get a real gap and a second row when needed. */
.group-action-buttons {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2);
  order: 1;
  width: 100%;
}

.ga-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border: 1.5px solid var(--overlay-white-40);
  border-radius: var(--radius-full);
  background: var(--overlay-white-15);
  color: var(--text-inverse);
  font-size: var(--text-xs);
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background var(--ease-fast), border-color var(--ease-fast);
  white-space: nowrap;
  min-width: 2rem;
}

.ga-btn:hover {
  background: var(--overlay-white-28);
  border-color: var(--overlay-white-70);
}

/* Csak ikonos művelet (a beléptető lap „Email küldése"-je): négyzet, hogy a sor magassága ne nőjön. */
.ga-btn--icon {
  padding: var(--space-1);
  width: 2rem;
  min-width: 2rem;
}

/* ── Group filter tags ─────────────────────────────────── */
.group-tag-filter {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.group-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-1) var(--space-3);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: 500;
  font-family: var(--font-sans);
  text-decoration: none;
  cursor: pointer;
  /* reset button defaults */
  appearance: none;
  -webkit-appearance: none;
  line-height: 1;
  transition: background var(--ease-fast), border-color var(--ease-fast), color var(--ease-fast);
}

.group-tag:hover {
  background: var(--bg-muted);
  color: var(--text-primary);
  border-color: var(--border);
}

.group-tag--active {
  background: var(--clr-green);
  border-color: var(--clr-green);
  color: var(--text-inverse);
  font-weight: 600;
}

.group-tag--active:hover {
  background: var(--clr-green-hover);
  border-color: var(--clr-green-hover);
  color: var(--text-inverse);
}
