/* ===================================
   4. MODAL CONTENT LAYOUTS
   =================================== */

/* Task Form: Effort & Probability Grid */
.task-form-effort-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 16px;
}

/* Row 1: Estimated Time */
.effort-time-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
}
.effort-time-row > .f-label {
  display: inline;
  width: auto;
  margin-bottom: 0;
  white-space: nowrap;
}
.effort-time-row > .f-input {
  width: 90px;
  min-width: 70px;
  margin-bottom: 0;
}
.effort-time-row > .f-select {
  width: auto;
  min-width: 75px;
  margin-bottom: 0;
}
.effort-time-row > .btn-ai-purple {
  flex-shrink: 0;
}

/* Row 2: Weight Slider */
.task-form-weight-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.task-form-weight-header {
  display: flex;
  align-items: center;
  gap: 12px;
}
.task-form-weight-header .f-label {
  margin-bottom: 0;
}
.task-form-weight-value {
  font-size: 14px;
  font-weight: 700;
  min-width: 30px;
}
.task-form-weight-track {
  height: 32px;
  display: flex;
  align-items: center;
}
/* Modal overlay - z-index managed by JavaScript, not CSS */
.modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    /* z-index removed - managed by JavaScript modal stack system */
    animation: modalFadeIn 0.2s ease-out;
}

/* Modal animations */
@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes modalSlideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes modalFadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* Apply slide-up animation to modal content */
.modal-content,
.task-form-modal,
.view-task-modal,
.sync-modal,
.people-manager-modal {
    animation: modalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
    .modal-overlay,
    .modal-content,
    .task-form-modal,
    .view-task-modal,
    .sync-modal,
    .people-manager-modal {
        animation: none !important;
        transition: none !important;
    }
}

/* ===================================
   Focus Mode (Deep Work Overlay)
   =================================== */
.focus-mode-overlay {
  /* Colors provided by inline CSS variables in FocusMode.jsx */
  background: var(--focus-bg, #0a0a0a);
  color: var(--focus-text, #ffffff);

  transition: background-color 0.3s ease, color 0.3s ease;

  /* Ensure full-screen overlay (modal-overlay only sets top/left) */
  right: 0;
  bottom: 0;
  position: fixed;
  isolation: isolate;

  display: grid;
  grid-template-rows: auto 1fr auto;
  align-items: stretch;

  /* Safe-area aware padding (keeps controls off notches/home-indicators) */
  padding:
    max(16px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));

  overflow: hidden;
}

/* Animated wavy gradient backgrounds (rendered behind content) */
.focus-mode-overlay::before,
.focus-mode-overlay::after {
  content: "";
  position: absolute;
  inset: -20%;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 350ms ease;
}

.focus-mode-overlay[data-backdrop]:not([data-backdrop="solid"])::before,
.focus-mode-overlay[data-backdrop]:not([data-backdrop="solid"])::after {
  opacity: 1;
}

/* Soft vignette to keep text readable over gradients */
.focus-mode-overlay[data-backdrop]:not([data-backdrop="solid"])::after {
  inset: -10%;
  background:
    radial-gradient(closest-side at 50% 50%, transparent 35%, color-mix(in srgb, var(--focus-bg, #000) 70%, transparent) 100%);
  mix-blend-mode: multiply;
  filter: blur(6px);
}

/* The actual animated “wavy” color field */
.focus-mode-overlay[data-backdrop]:not([data-backdrop="solid"])::before {
  background:
    radial-gradient(closest-side at 20% 30%, color-mix(in srgb, var(--focus-primary, #ff6b35) 55%, transparent), transparent 65%),
    radial-gradient(closest-side at 80% 25%, color-mix(in srgb, #38bdf8 50%, transparent), transparent 60%),
    radial-gradient(closest-side at 30% 85%, color-mix(in srgb, #4ade80 45%, transparent), transparent 60%),
    radial-gradient(closest-side at 85% 80%, color-mix(in srgb, #d946ef 50%, transparent), transparent 60%);
  filter: blur(22px) saturate(120%);
  transform: translate3d(0, 0, 0);
  animation: focusWaveDrift 18s ease-in-out infinite alternate;
  opacity: 0.9;
}

/* Presets tweak palette + motion */
.focus-mode-overlay[data-backdrop="aurora"]::before {
  background:
    radial-gradient(closest-side at 18% 35%, color-mix(in srgb, #4ade80 55%, transparent), transparent 62%),
    radial-gradient(closest-side at 70% 18%, color-mix(in srgb, #38bdf8 55%, transparent), transparent 62%),
    radial-gradient(closest-side at 85% 75%, color-mix(in srgb, #d946ef 45%, transparent), transparent 62%),
    radial-gradient(closest-side at 30% 85%, color-mix(in srgb, var(--focus-primary, #ff6b35) 40%, transparent), transparent 62%);
  animation-duration: 22s;
}

.focus-mode-overlay[data-backdrop="ocean"]::before {
  background:
    radial-gradient(closest-side at 15% 35%, color-mix(in srgb, #0ea5e9 60%, transparent), transparent 64%),
    radial-gradient(closest-side at 80% 25%, color-mix(in srgb, #38bdf8 55%, transparent), transparent 64%),
    radial-gradient(closest-side at 35% 85%, color-mix(in srgb, #14b8a6 50%, transparent), transparent 64%),
    radial-gradient(closest-side at 85% 80%, color-mix(in srgb, var(--focus-primary, #ff6b35) 18%, transparent), transparent 64%);
  animation-duration: 26s;
}

.focus-mode-overlay[data-backdrop="sunset"]::before {
  background:
    radial-gradient(closest-side at 20% 30%, color-mix(in srgb, #fb7185 60%, transparent), transparent 62%),
    radial-gradient(closest-side at 75% 20%, color-mix(in srgb, #f59e0b 55%, transparent), transparent 62%),
    radial-gradient(closest-side at 25% 85%, color-mix(in srgb, var(--focus-primary, #ff6b35) 45%, transparent), transparent 62%),
    radial-gradient(closest-side at 85% 80%, color-mix(in srgb, #8b5cf6 45%, transparent), transparent 62%);
  animation-duration: 20s;
}

.focus-mode-overlay[data-backdrop="neon"]::before {
  background:
    radial-gradient(closest-side at 20% 30%, color-mix(in srgb, #22d3ee 55%, transparent), transparent 62%),
    radial-gradient(closest-side at 80% 25%, color-mix(in srgb, #d946ef 55%, transparent), transparent 62%),
    radial-gradient(closest-side at 35% 85%, color-mix(in srgb, #a3e635 45%, transparent), transparent 62%),
    radial-gradient(closest-side at 85% 80%, color-mix(in srgb, var(--focus-primary, #ff6b35) 35%, transparent), transparent 62%);
  filter: blur(20px) saturate(150%);
  animation-duration: 16s;
}

.focus-mode-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;

  /* Keep actions clickable even if main is scrollable */
  z-index: 2;
}

.focus-mode-btn {
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;

  border: 1px solid transparent;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.focus-mode-btn-primary {
  background: var(--focus-primary, #ff6b35);
  color: var(--focus-bg, #0a0a0a);
}

.focus-mode-btn-outline {
  background: transparent;
  border-color: color-mix(in srgb, var(--focus-text, #fff) 22%, transparent);
  color: color-mix(in srgb, var(--focus-text, #fff) 82%, transparent);
}

.focus-mode-main {
  position: relative;
  z-index: 2;
  min-height: 0; /* allow scrolling inside grid row */
  overflow: auto;
  -webkit-overflow-scrolling: touch;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;

  gap: 22px;
  padding: 14px 0;
}

.focus-mode-titleBlock {
  opacity: 0.95;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(800px, 100%);
}

.focus-mode-kicker {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--focus-primary, #ff6b35);
}

.focus-mode-title {
  margin: 0;
  font-family: "Fredoka", sans-serif;
  font-size: clamp(22px, 5vw, 42px);
  line-height: 1.15;
  color: var(--focus-text, #fff);

  overflow-wrap: anywhere;
}

.focus-mode-meta {
  font-size: 14px;
  color: color-mix(in srgb, var(--focus-text, #fff) 65%, transparent);
}

.focus-mode-timer {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-weight: 400;
  font-size: clamp(64px, 14vw, 140px);
  line-height: 1;
  color: var(--focus-text, #fff);
  text-shadow: 0 0 40px color-mix(in srgb, var(--focus-primary, #ff6b35) 20%, transparent);
  transition: opacity 0.2s ease, text-shadow 0.2s ease;
}

.focus-mode-timer[data-paused="true"] {
  opacity: 0.35;
  text-shadow: none;
}

.focus-mode-toggle {
  width: clamp(64px, 12vw, 90px);
  height: clamp(64px, 12vw, 90px);
  border-radius: 999px;

  border: 2px solid color-mix(in srgb, var(--focus-text, #fff) 10%, transparent);
  background: color-mix(in srgb, var(--focus-text, #fff) 10%, transparent);
  color: var(--focus-text, #fff);
  font-size: clamp(22px, 5vw, 28px);

  display: flex;
  align-items: center;
  justify-content: center;
}

.focus-mode-toggle:hover {
  filter: brightness(1.05);
}

.focus-mode-themePicker {
  justify-self: end;
  align-self: end;

  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;

  z-index: 2;
}

.focus-mode-themePanel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--focus-text, #fff) 7%, transparent);
  border: 1px solid color-mix(in srgb, var(--focus-text, #fff) 12%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.focus-mode-themeRow {
  display: flex;
  gap: 6px;
  padding: 2px;
}

.focus-mode-themeDot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--focus-text, #fff) 30%, transparent);
  padding: 0;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.focus-mode-themeDot[data-active="true"] {
  border-width: 2px;
}

.focus-mode-themeTrigger {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: none;
  padding: 0;

  background: var(--focus-primary, #ff6b35);
  opacity: 0.35;
  cursor: pointer;
  transition: opacity 0.2s ease, box-shadow 0.2s ease;
}

.focus-mode-themeTrigger[aria-expanded="true"] {
  opacity: 0.85;
  box-shadow: 0 0 8px color-mix(in srgb, var(--focus-primary, #ff6b35) 45%, transparent);
}

.focus-mode-backdropRow {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.focus-mode-backdropChip {
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;

  background: color-mix(in srgb, var(--focus-text, #fff) 6%, transparent);
  border: 1px solid color-mix(in srgb, var(--focus-text, #fff) 16%, transparent);
  color: color-mix(in srgb, var(--focus-text, #fff) 80%, transparent);
  cursor: pointer;
}

.focus-mode-backdropChip[data-active="true"] {
  background: color-mix(in srgb, var(--focus-primary, #ff6b35) 24%, transparent);
  border-color: color-mix(in srgb, var(--focus-primary, #ff6b35) 42%, transparent);
  color: var(--focus-text, #fff);
}

@media (max-height: 620px) {
  .focus-mode-main {
    justify-content: flex-start;
    gap: 16px;
  }
}

@keyframes focusWaveDrift {
  0% {
    transform: translate3d(-2%, -2%, 0) scale(1.02) rotate(-2deg);
  }
  50% {
    transform: translate3d(3%, -1%, 0) scale(1.06) rotate(2deg);
  }
  100% {
    transform: translate3d(-1%, 3%, 0) scale(1.04) rotate(-1deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .focus-mode-overlay::before {
    animation: none !important;
  }
}
/* !!TT/css/04-modals.css */

.modal-close-x {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    transition: transform 0.2s ease;
}

.modal-close-x:hover {
    color: var(--primary);
    transform: scale(1.1);
}