/* opgaver-mobile.css — #2636 mobile add-task form + task row refinement */
/* Loaded after opgaver-blod-bolge.css, scoped to /opgaver/ only */

@media (max-width: 640px) {
  #add-task-form.task-input-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0 0 16px;
    padding: 14px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 16px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.04);
    box-sizing: border-box;
  }

  #add-task-form .task-input-card {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 52px;
    height: auto;
    padding: 0;
    background: #ffffff;
    border: 1.5px solid #e6e1d8;
    border-radius: 14px;
    box-shadow: none;
    overflow: hidden;
    box-sizing: border-box;
    transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
  }
  #add-task-form .task-input-card:hover { border-color: #d8d1c4; }
  #add-task-form .task-input-card:focus-within {
    border-color: #4a7a68;
    box-shadow: 0 0 0 3px rgba(74, 122, 104, 0.18);
    background: #ffffff;
  }

  #add-task-form #task-input.task-input-field {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    height: auto;
    min-height: 48px;
    padding: 12px 8px 12px 16px;
    margin: 0;
    font-size: var(--font-size-base);
    line-height: 1.4;
    color: #1f2937;
    background: transparent;
    border: 0;
    border-radius: 0;
    outline: none;
    box-shadow: none;
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
  }
  #add-task-form #task-input.task-input-field::placeholder { color: #9a9387; opacity: 1; }
  #add-task-form #task-input.task-input-field:focus,
  #add-task-form #task-input.task-input-field:focus-visible { outline: none; box-shadow: none; }

  #add-task-form #task-input-mic.task-input-icon {
    position: static;
    transform: none;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    margin: 0 6px 0 4px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #4a7a68;
    background: transparent;
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 140ms ease, transform 140ms ease;
  }
  #add-task-form #task-input-mic.task-input-icon svg,
  #add-task-form #task-input-mic.task-input-icon img,
  #add-task-form #task-input-mic.task-input-icon i { width: 22px; height: 22px; font-size: var(--font-size-xl); display: block; }
  #add-task-form #task-input-mic.task-input-icon:hover { background: rgba(74, 122, 104, 0.10); }
  #add-task-form #task-input-mic.task-input-icon:active { background: rgba(74, 122, 104, 0.18); transform: scale(0.96); }
  #add-task-form #task-input-mic.task-input-icon:focus-visible { outline: 2px solid #4a7a68; outline-offset: 2px; }

  #add-task-form #add-task-btn.task-add-btn {
    width: 100%;
    min-height: 52px;
    padding: 14px 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    letter-spacing: 0.01em;
    color: #ffffff;
    background: #4a7a68;
    border: 0;
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(74, 122, 104, 0.25);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 140ms ease, transform 80ms ease, box-shadow 140ms ease;
  }
  #add-task-form #add-task-btn.task-add-btn:hover { background: #3f6a5a; }
  #add-task-form #add-task-btn.task-add-btn:active { background: #355c4e; transform: translateY(1px); box-shadow: 0 1px 3px rgba(74, 122, 104, 0.25); }
  #add-task-form #add-task-btn.task-add-btn:focus-visible { outline: 2px solid #4a7a68; outline-offset: 3px; }
  #add-task-form #add-task-btn.task-add-btn[disabled],
  #add-task-form #add-task-btn.task-add-btn:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; }

  /* #3050 — dark mode: the mobile add-task form/card are #ffffff in light mode
     (this file has no dark rules), so give them the opgaver dark surface. The
     mic + submit stay sage. Light mode above is unchanged. */
  [data-theme="dark"] #add-task-form.task-input-form {
    background: #201B18;
    border-color: rgba(232, 224, 216, 0.08);
    box-shadow: 0 1px 2px rgba(20, 18, 15, 0.18), 0 4px 12px rgba(20, 18, 15, 0.28);
  }
  [data-theme="dark"] #add-task-form .task-input-card {
    background: #241F1B;
    border-color: rgba(232, 224, 216, 0.10);
  }
  [data-theme="dark"] #add-task-form .task-input-card:hover { border-color: rgba(232, 224, 216, 0.18); }
  [data-theme="dark"] #add-task-form .task-input-card:focus-within {
    border-color: #6E8A7E;
    box-shadow: 0 0 0 3px rgba(110, 138, 126, 0.25);
    background: #241F1B;
  }
  [data-theme="dark"] #add-task-form #task-input.task-input-field { color: var(--warm-text, #E8DDD4); }
  [data-theme="dark"] #add-task-form #task-input.task-input-field::placeholder { color: var(--muted, rgba(232, 224, 216, 0.55)); }
  [data-theme="dark"] #add-task-form #task-input-mic.task-input-icon { color: #A9C7BB; }
  [data-theme="dark"] #add-task-form #task-input-mic.task-input-icon:hover { background: rgba(168, 197, 184, 0.12); }

  .task-item {
    display: grid;
    grid-template-columns: 44px 1fr auto;
    grid-template-areas: "check content actions";
    align-items: center;
    column-gap: 10px;
    row-gap: 4px;
    padding: 12px 14px;
    margin: 0 !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    position: relative;
    -webkit-tap-highlight-color: transparent;
    touch-action: pan-y;
    transition: background-color 140ms ease, border-color 140ms ease, transform 80ms ease;
  }
  .task-item + .task-item { border-top: 1px solid rgba(92, 77, 67, 0.08) !important; }
  .task-item:active { background: rgba(92, 77, 67, 0.04) !important; transform: none; }

  .task-item .task-checkbox-wrapper {
    grid-area: check;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .task-item .task-checkbox {
    width: 22px;
    height: 22px;
    border: 2px solid #d4a89a;
    border-radius: 50%;
    background: transparent;
    transition: background-color 140ms ease, border-color 140ms ease, transform 120ms ease;
  }
  .task-item .task-checkbox-wrapper:hover .task-checkbox { border-color: #b88574; }
  .task-item .task-checkbox-wrapper:active .task-checkbox { transform: scale(0.9); }

  .task-item .task-content { grid-area: content; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
  .task-item .task-text {
    font-size: var(--font-size-base);
    line-height: 1.35;
    font-weight: var(--font-weight-medium);
    color: #5c4d43;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .task-item .task-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; font-size: var(--font-size-xs); line-height: 1.2; color: #8a7c70; margin: 0; }
  .task-item .task-tag { display: inline-flex; align-items: center; padding: 2px 8px; font-size: var(--font-size-xs); font-weight: var(--font-weight-semibold); line-height: 1.4; border-radius: 999px; background: rgba(92, 77, 67, 0.08); color: #5c4d43; white-space: nowrap; }
  .task-item .task-estimate { display: inline-flex; align-items: center; gap: 4px; font-size: var(--font-size-xs); color: #8a7c70; }

  .task-item .task-actions { grid-area: actions; display: inline-flex; align-items: center; gap: 2px; height: auto; width: auto; margin: 0; background: transparent; }
  .task-item.done,
  .task-item.is-completed,
  .task-item.completed,
  .task-item[aria-checked="true"],
  .task-item[data-completed="true"] {
    display: grid;
    grid-template-columns: 44px 1fr auto;
    grid-template-areas: "check content actions";
    align-items: center;
    column-gap: 10px;
    row-gap: 4px;
  }
  .task-item.done .task-checkbox-wrapper,
  .task-item.is-completed .task-checkbox-wrapper,
  .task-item.completed .task-checkbox-wrapper,
  .task-item[aria-checked="true"] .task-checkbox-wrapper,
  .task-item[data-completed="true"] .task-checkbox-wrapper {
    grid-area: check;
    grid-column: auto;
  }
  .task-item.done .task-content,
  .task-item.is-completed .task-content,
  .task-item.completed .task-content,
  .task-item[aria-checked="true"] .task-content,
  .task-item[data-completed="true"] .task-content {
    grid-area: content;
    grid-column: auto;
    min-width: 0;
  }
  .task-item.done .task-actions,
  .task-item.is-completed .task-actions,
  .task-item.completed .task-actions,
  .task-item[aria-checked="true"] .task-actions,
  .task-item[data-completed="true"] .task-actions {
    grid-area: actions;
    grid-column: auto;
    align-self: center;
  }
  .task-item .task-action-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    border-radius: 10px;
    color: #7a6b60;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 140ms ease, color 140ms ease, transform 120ms ease;
  }
  .task-item .task-action-btn svg,
  .task-item .task-action-btn img,
  .task-item .task-action-btn i { width: 18px; height: 18px; font-size: var(--font-size-base); display: block; }
  .task-item .task-action-btn:hover { background: rgba(92, 77, 67, 0.07); color: #5c4d43; }
  .task-item .task-action-btn:active { background: rgba(92, 77, 67, 0.14); transform: scale(0.94); }
  .task-item .task-action-btn:focus-visible { outline: 2px solid #4a7a68; outline-offset: 2px; }
  .task-item .task-delete-btn:hover { color: #b4533b; background: rgba(180, 83, 59, 0.09); }

  .task-item.is-completed .task-text,
  .task-item.completed .task-text,
  .task-item[aria-checked="true"] .task-text,
  .task-item[data-completed="true"] .task-text,
  .task-item.done .task-text { text-decoration: line-through; color: #b0a59a; }
  .task-item.is-completed .task-checkbox,
  .task-item.completed .task-checkbox,
  .task-item[aria-checked="true"] .task-checkbox,
  .task-item[data-completed="true"] .task-checkbox,
  .task-item.done .task-checkbox { background: #4a7a68; border-color: #4a7a68; }

  .task-item .task-snooze-menu { position: absolute; z-index: 10; }

  /* Deferred row calm alignment (#3594) */
  .task-section--deferred .task-item {
    align-items: start;
  }
  .task-section--deferred .task-item .task-checkbox-wrapper {
    align-self: start;
    margin-top: -1px;
  }
  .task-section--deferred .task-item .task-content {
    gap: 5px;
    padding-top: 0;
  }
  .task-section--deferred .task-item .task-time:not(.task-time--overdue) {
    color: rgb(122, 110, 98);
    font-weight: 500;
  }
}

@media (max-width: 360px) {
  #add-task-form.task-input-form { padding: 12px; gap: 10px; }
  #add-task-form .task-input-card { min-height: 48px; }
  #add-task-form #add-task-btn.task-add-btn { min-height: 48px; }
  .task-item { padding: 10px 12px; column-gap: 8px; }
  .task-item.done,
  .task-item.is-completed,
  .task-item.completed,
  .task-item[aria-checked="true"],
  .task-item[data-completed="true"] { column-gap: 8px; }
  .task-item .task-action-btn { width: 44px; height: 44px; min-width: 44px; min-height: 44px; border-radius: 9px; }
  .task-item .task-actions { gap: 0; }
}

@media (prefers-reduced-motion: reduce) {
  #add-task-form .task-input-card,
  #add-task-form #task-input-mic.task-input-icon,
  #add-task-form #add-task-btn.task-add-btn,
  .task-item,
  .task-item .task-checkbox,
  .task-item .task-action-btn { transition: none !important; }
  #add-task-form #task-input-mic.task-input-icon:active,
  #add-task-form #add-task-btn.task-add-btn:active,
  .task-item .task-checkbox-wrapper:active .task-checkbox,
  .task-item .task-action-btn:active { transform: none !important; }
}
