/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* ====================================================
   Tigrid — Design System
   ==================================================== */

:root {
  --sticky-offset: 0px;
  --bg: #f5f5f4;
  --surface: #ffffff;
  --border: #e7e5e4;
  --text: #1c1917;
  --text-muted: #78716c;
  --accent: #4f46e5;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
}

/* ---- Nav ---- */

nav {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 24px;
  height: 48px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  position: sticky;
  top: 0;
  z-index: 100;
}

nav span {
  color: var(--text-muted);
  margin-right: auto;
}

nav button,
nav [type="submit"] {
  padding: 5px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.1s;
}

nav button:hover,
nav [type="submit"]:hover,
nav .today-btn:hover {
  background: var(--bg);
}

nav .today-btn {
  padding: 5px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.1s;
  text-decoration: none;
}

nav [data-controller="modal"] > button {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

nav [data-controller="modal"] > button:hover {
  background: #4338ca;
  border-color: #4338ca;
}

/* ---- Unaffected tasks ---- */

#unaffected_tasks {
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 48px;
  z-index: 50;
}

#unaffected_tasks h3 {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 0 0 10px 0;
}

/* ---- Calendar ---- */

.calendar_view {
  list-style: none;
  margin: 0;
  padding: 8px 24px;

  li {
    padding: 10px 12px 10px 88px;
    min-height: 44px;
    position: relative;
    border-radius: var(--radius);
    scroll-margin-top: var(--sticky-offset);

    &:nth-child(even) {
      background: #f0efed;
    }

    &.today {
      box-shadow: inset 3px 0 0 0 #6366f1;

      .day_tag {
        color: #6366f1;
      }
    }

    .day_tag {
      display: block;
      position: absolute;
      left: 4px;
      width: 76px;
      top: 12px;
      text-align: right;
      font-size: 11px;
      font-weight: 600;
      color: var(--text-muted);
      text-transform: uppercase;
      letter-spacing: 0.05em;
      white-space: nowrap;
    }

    .day_progress {
      position: absolute;
      left: 4px;
      width: 76px;
      top: 28px;
      text-align: right;
      font-size: 10px;
      font-weight: 600;
      color: var(--text-muted);
      white-space: nowrap;
      letter-spacing: 0.02em;

      .day_progress_done {
        color: #16a34a;
      }
    }
  }
}

/* ---- Task cards ---- */

.task {
  border-radius: var(--radius);
  padding: 8px 12px;
  margin-bottom: 6px;
  background: var(--surface);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  border-left-width: 3px;
  cursor: grab;
  transition: box-shadow 0.15s, opacity 0.15s;

  p.title {
    margin: 0 0 4px 0;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
  }

  button {
    display: inline-block;
    font-size: 11px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 99px;
    border: 1px solid currentColor;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    opacity: 0.65;
    transition: opacity 0.1s;
  }

  button:hover {
    opacity: 1;
  }
}

.task:last-child {
  margin-bottom: 0;
}

.task:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.09);
}

.task.dragging {
  opacity: 0.35;
  cursor: grabbing;
}

@keyframes task-drop-glow {
  0%   { box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.5); }
  40%  { box-shadow: 0 0 10px 4px rgba(124, 58, 237, 0.35); }
  100% { box-shadow: 0 0 0 0 rgba(124, 58, 237, 0); }
}

.task.dropped {
  animation: task-drop-glow 1.5s ease-out forwards;
}

/* Status variants */

.task.unplanned {
  border-left-color: #d1d5db;
  color: var(--text-muted);
}

.task.planned {
  border-left-color: #7c3aed;
  background: #faf5ff;
  color: #3b0764;
}

.task.still_due {
  border-left-color: #d97706;
  background: #fffbeb;
  color: #78350f;
}

.task.overdue {
  border-left-color: #dc2626;
  background: #fef2f2;
  color: #7f1d1d;
}

.task.completed {
  border-left-color: #86efac;
  background: #f0fdf4;
  color: #6b7280;
  cursor: default;

  p.title {
    text-decoration: line-through;
    text-decoration-color: #9ca3af;
  }
}

.task.reported {
  border-left-color: #eab308;
  background: #fefce8;
  color: #713f12;
  cursor: default;
}

.task.cancelled {
  border-left-color: #6b7280;
  background: #1f2937;
  color: #9ca3af;
  cursor: default;

  p.title {
    text-decoration: line-through;
    text-decoration-color: #6b7280;
  }
}

/* Drop zone highlight */

[data-drop-zone].drag-over {
  outline: 2px dashed #818cf8;
  outline-offset: 2px;
  border-radius: var(--radius);
  background-color: #eef2ff;
}

/* ---- Modals ---- */

dialog {
  border: none;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.1);
  padding: 24px;
  min-width: 320px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
}

dialog .close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 2px 8px;
  border: none;
  background: transparent;
  font-size: 18px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

dialog .close-btn:hover {
  color: var(--text);
  background: var(--bg);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(2px);
}

dialog p {
  margin: 0 0 16px 0;
  font-weight: 500;
}

dialog label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

dialog input[type="text"] {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

dialog input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

dialog menu {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin: 20px 0 0 0;
  padding: 0;
}

dialog [type="submit"],
dialog button[type="button"] {
  padding: 7px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.1s;
}

dialog [type="submit"] {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

dialog [type="submit"]:hover {
  background: #4338ca;
}

dialog button[type="button"]:hover {
  background: var(--bg);
}
