/* === Global resets & base styles === */
html, body {
  margin: 0;
  padding: 0;
  overflow-x: hidden; /* prevent accidental horizontal scroll */
}

/* existing global styles... */
body {
  font-family: "Roboto", sans-serif;
  width: 95%;
  max-width: 1000px;
  margin: 0 auto;
  padding: 15px;
  background-color: #f3f4f6; /* Light neutral gray */
}
.milestone {
  margin-bottom: 30px;
  padding: 15px;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  border: 1px solid #e5e7eb;
}
.task {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  margin-bottom: 8px;
  border-radius: 8px;
  background: #fafafa;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-right: 5px; /* kept for desktop spacing */
}
.progress-bar {
  height: 10px;
  background: #cccccc;
  border-radius: 5px;
  width: 100%;
  overflow: hidden;
}
.progress-fill {
  height: 10px;
  background: #3b82f6;
  border-radius: 5px;
  width: 0%;
  transition: width 0.3s ease-in-out;
}

.task-btn {
  font-size: 14px;
  padding: 5px;
  cursor: pointer;
  border: none;
  background: #f0f0f0;
  color: #3b82f6;
  border-radius: 4px;
}
.task-btn:hover {
  background: #e0e0e0;
}
.action-btn {
  font-size: 14px;
  padding: 8px 14px;
  cursor: pointer;
  border: none;
  background-color: #3b82f6; /* happy blue */
  color: #fff;
  border-radius: 8px;
  transition: background-color 0.2s ease;
}

.action-btn:hover {
  background-color: #2563eb;
}

.file-input {
  font-size: 14px;
  padding: 9px 15px;
  cursor: pointer;
  border: none;
  background: #3b82f6;
  color: white;
  border-radius: 5px;
}
.arrow {
  display: inline-block;
  transition: transform 0.2s ease;
  transform: rotate(0deg);
  margin-right: 5px;
}

.arrow.expanded {
  transform: rotate(90deg); /* ▶ becomes ▼ */
}

/* ADD THIS RULE */
.task-text {
  flex-grow: 1;
  min-width: 120px;
  /* MODIFIED: Allow text to wrap instead of using an ellipsis */
  white-space: normal;
}

/* ─── Unified date/text input sizing ─── */
.task input[type="date"],
.task input[type="text"] {
  width: 110px; /* fixed width for both states */
  min-width: 110px; /* prevent shrinking in flex layouts */
  box-sizing: border-box; /* include padding and border in width */
  flex-shrink: 0; /* preserve size under flex */
}

.task .task-btn {
  flex-shrink: 0;
}
.task-wrapper {
  margin-top: 12px;
  margin-bottom: 16px; /* Optional: keeps spacing below too */
}
.signature-section {
  display: flex;
  justify-content: space-between;
  margin: 40px 0 20px;
  gap: 20px;
  width: 100%;
}

.signature-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  padding: 0 10px;
}

.signature-label-line {
  display: flex;
  align-items: center;
  width: 100%;
}

.signature-x {
  margin-right: 5px;
  font-weight: bold;
}

.signature-input {
  font-family: "Caveat", cursive;
  font-size: 22px;
  border: none;
  border-bottom: 2px solid #000;
  width: 100%;
  background: #fff;
  padding: 4px 6px;
  box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.1);
  outline: none;
}

.signature-input:focus {
  border-color: #3b82f6; /* blue accent */
  box-shadow: 0 1px 0 #3b82f6;
}

.signature-label {
  margin-top: 6px;
  text-align: center;
  font-weight: normal;
}

.task-controls {
  display: flex;
  gap: 6px;
  align-items: center;
}

@media (max-width: 600px) {
  .task {
    flex-wrap: wrap;
  }

  /* Fill the viewport on mobile and tighten side padding */
  html, body {
    width: 100%;
    max-width: none;   /* override desktop 1000px cap */
    margin: 0;
    padding: 8px;      /* reduce the visual “gutter” */
    overflow-x: hidden;
  }

.task-controls {
  flex: 1 1 100%;
  margin-top: 4px;
  justify-content: space-between;
  align-items: center;
  column-gap: 6px;
  margin-left: 0;
  margin-left: -3px;
}

}

.task-edit-input {
  width: 300px !important;
  min-width: 250px !important;
  padding: 4px 8px !important;
  border: 1px solid #ccc !important;
  border-radius: 4px !important;
  font-size: 14px !important;
  box-sizing: border-box !important;
}

/* Also target any text input inside a task that's being edited */
.task input[type="text"].task-edit-input {
  width: 300px !important;
  min-width: 250px !important;
}

.milestone.stage-1 {
  background-color: #f0f9ff; /* soft blue */
}

.milestone.stage-2 {
  background-color: #f0fdf4; /* soft green */
}

.milestone.stage-3 {
  background-color: #fefce8; /* soft yellow */
}

.milestone.stage-4 {
  background-color: #fff1f2; /* soft pink */
}

.milestone.stage-5 {
  background-color: #f5f3ff; /* soft lavender */
}

.tooltip-popup a {
  color: #3b82f6;
  text-decoration: none;
}

.tooltip-popup a:hover {
  text-decoration: underline;
}

.share-instructions {
  background: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  margin: 20px 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  font-size: 14px;
  line-height: 1.5;
}

/* ADD THIS RULE */
.tooltip-container {
  position: relative;
  cursor: pointer;
  display: inline-block;
  margin-left: 6px;
  margin-right: 5px; /* Add breathing room from the edge */
  font-size: 14px;
}

/* 1. Default style for DESKTOP */
.tooltip-text {
  visibility: hidden;
  opacity: 0;
  width: 280px;
  max-width: 80vw;
  background-color: #535353;
  color: #fff;
  text-align: left;
  padding: 10px;
  border-radius: 6px;
  position: absolute;
  z-index: 10;
  bottom: 150%;
  transition: opacity 0.2s ease-in-out;
  right: 0;
}

/* 2. Override for MOBILE screens */
@media (max-width: 600px) {
  .tooltip-text {
    left: 0;
  }
}

.tooltip-container.open .tooltip-text,
.tooltip-container:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* ─── Deleted Tasks UI ─── */
.deleted-list {
  margin-top: 8px;
  padding: 10px;
  border-radius: 8px;
  background: #fff7ed; /* soft amber */
  border: 1px dashed #f59e0b;
}

.deleted-list h4 {
  margin: 0 0 8px 0;
  font-size: 14px;
  color: #92400e;
}

.deleted-task {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  margin-bottom: 6px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid #fde68a;
}

.restore-btn {
  font-size: 13px;
  padding: 4px 8px;
  cursor: pointer;
  border: none;
  background: #10b981; /* teal */
  color: #fff;
  border-radius: 6px;
}

.restore-btn:hover {
  background: #059669;
}

.main-controls-container {
  display: flex;
  flex-wrap: wrap;        /* allow wrapping */
  gap: 0.5rem;
  align-items: center;
  justify-content: center;/* keep centered */
  max-width: 100%;
  box-sizing: border-box;
}

/* ✅ critical: let flex children shrink, so the row never pushes past the right edge */
.main-controls-container > * {
  min-width: 0;
}

/* ✅ allow button text to wrap instead of forcing overflow */
.action-btn {
  white-space: normal;
}

/* ─── Print styles: hide buttons & inputs when printing ─── */
@media print {
  /* hide interactive controls */
  .action-btn,
  .file-input,
  .task-btn {
    display: none !important;
  }

  /* keep signatures visible */
  .signature-section {
    display: flex !important;
  }

  /* tighten up margins for print */
  body {
    margin: 0;
    background: none;
  }
}

/* ─── Save Success Modal Styles ─── */
.modal {
  display: none; /* hidden by default */
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4); /* semi-transparent overlay */
  justify-content: center; /* center horizontally */
  align-items: center; /* center vertically */
  z-index: 1000; /* on top of everything */
}

.modal.show {
  display: flex; /* reveal when .show is added */
}

.modal-content {
  background: #fff;
  padding: 20px 30px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  text-align: center;
}

.close-button {
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 1.2rem;
  cursor: pointer;
}
