/* ===================================
   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,
.focus-mode-musicRow {
  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 */

/* ===================================
   Base Modal Styles
   =================================== */

/* Modal backdrop/overlay */
.modal-overlay,
.modal-backdrop {
    position: fixed !important;
    inset: 0 !important;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: modalFadeIn 0.2s ease-out;
}

/* Modal container/card */
.modal,
.modal-container {
    background: var(--card, #1a1a1a);
    border: 1px solid var(--border, #333);
    border-radius: var(--border-radius-xl, 16px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-width: 500px;
    width: 100%;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Modal header */
.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border, #333);
    background: var(--card-header, rgba(255, 255, 255, 0.02));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
}

.modal-header h2,
.modal-header .modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--text, #fff);
}

/* Modal content */
.modal-body,
.modal-content {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
}

/* Modal footer */
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border, #333);
    background: var(--card-header, rgba(255, 255, 255, 0.02));
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-shrink: 0;
}

/* Close button (X) */
.modal-close,
.modal-close-x {
    background: none;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: var(--border-radius-sm, 8px);
    color: var(--text-light, #999);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.modal-close:hover,
.modal-close-x:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text, #fff);
}

.modal-close:focus-visible,
.modal-close-x:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Modal button styles */
.modal-btn {
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--border-radius-md, 8px);
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.modal-btn-primary {
    background: var(--primary, #ff6b35);
    color: #fff;
    border: none;
}

.modal-btn-primary:hover {
    background: var(--primary-hover, #e55d2b);
    transform: translateY(-1px);
}

.modal-btn-secondary {
    background: transparent;
    color: var(--text, #fff);
    border: 1px solid var(--border, #333);
}

.modal-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
}

.modal-btn-danger {
    background: var(--error, #ef4444);
    color: #fff;
    border: none;
}

.modal-btn-danger:hover {
    background: #dc2626;
}

.modal-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Task Form Modal - Compact design */
.task-form-modal {
    max-width: 380px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.task-form-modal .modal-header {
    padding: 10px 14px;
    border-bottom: none;
    background: transparent;
}

.task-form-modal .modal-header .modal-title {
    font-family: "Fredoka", sans-serif;
    font-size: 16px;
    font-weight: 600;
}

.task-form-modal .modal-body {
    padding: 0 14px 8px;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

/* Custom scrollbar for webkit browsers */
.task-form-modal .modal-body::-webkit-scrollbar {
    width: 3px;
}

.task-form-modal .modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.task-form-modal .modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

/* Task Form Footer */
.task-form-footer {
    padding: 8px 14px;
    border-top: none;
    background: transparent;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
}

.task-form-footer .btn-ai {
    background: transparent;
    border: none;
    color: var(--primary, #ff6b35);
    padding: 4px;
    font-size: 14px;
    cursor: pointer;
    opacity: 0.5;
    transition: all 0.15s ease;
    margin-right: auto;
}

.task-form-footer .btn-ai:hover:not(:disabled) {
    opacity: 1;
}

.task-form-footer .btn-ai:disabled {
    opacity: 0.15;
    cursor: not-allowed;
}

.task-form-footer .btn-secondary {
    background: transparent;
    border: none;
    color: var(--text-light, #666);
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.15s ease;
}

.task-form-footer .btn-secondary:hover {
    color: var(--text, #fff);
}

.task-form-footer .btn-primary {
    background: var(--primary, #ff6b35);
    border: none;
    color: #fff;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
    border-radius: 4px;
}

.task-form-footer .btn-primary:hover {
    background: var(--primary-hover, #e55d2b);
}

/* Compact form fields inside task modal */
.task-form-modal .f-label {
    font-size: 10px;
    margin-bottom: 3px;
}

/* Unified height for ALL form elements in task modal */
.task-form-modal .f-input,
.task-form-modal .f-select,
.task-form-modal input[type="text"],
.task-form-modal input[type="date"],
.task-form-modal input[type="time"],
.task-form-modal input[type="number"],
.task-form-modal select {
    height: 36px !important;
    min-height: 36px !important;
    max-height: 36px !important;
    padding: 0 10px !important;
    font-size: 13px;
    margin-bottom: 8px;
    border-radius: 6px;
    box-sizing: border-box !important;
    line-height: 36px;
    vertical-align: middle;
}

/* Select elements - ensure consistent appearance */
.task-form-modal select,
.task-form-modal select.f-select {
    padding: 0 30px 0 10px !important;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='%23999' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-color: var(--input-bg);
    cursor: pointer;
}

/* Textarea keeps its auto height */
.task-form-modal .f-textarea,
.task-form-modal textarea {
    height: auto !important;
    min-height: 50px !important;
    max-height: none !important;
    line-height: 1.4;
    padding: 8px 10px !important;
}

/* Fix any overflow issues */
.task-form-modal * {
    box-sizing: border-box;
    max-width: 100%;
}

/* Mobile optimizations */
@media (max-width: 480px) {
    .modal-overlay,
    .modal-backdrop {
        padding: 12px;
    }

    .modal,
    .modal-container {
        max-height: 90vh;
        border-radius: var(--border-radius-lg, 12px);
    }

    .modal-header {
        padding: 14px 16px;
    }

    .modal-body,
    .modal-content {
        padding: 16px;
    }

    .modal-footer {
        padding: 14px 16px;
        flex-direction: column;
    }

    .modal-footer .modal-btn {
        width: 100%;
    }

    /* Task form modal footer on mobile - keep side by side */
    .task-form-modal .modal-footer {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
    }
}