/* ================= ROOT THEME TOKENS ================= */
:root {
  --app-bg: #f4f5f7;
  --surface-bg: #ffffff;

  --todo-bg: #e6ecf1;
  --doing-bg: #ffe1c6;
  --done-bg: #ddefe3;

  --text-main: #000000;
  --text-muted: rgba(0, 0, 0, 0.6);

  --border-light: #ddd;
  --border-medium: #e5e5e5;
  --border-dark: rgba(0, 0, 0, 0.1);
  --border-dashed: rgba(0, 0, 0, 0.15);

  --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 4px 8px rgba(0, 0, 0, 0.15);
  --shadow-heavy: 0 12px 35px rgba(0, 0, 0, 0.3);

  --input-bg: #f8f9fa;
}

/* ================= DARK MODE ================= */
body.dark {
  --app-bg: #1e1f23;
  --surface-bg: #2a2c31;

  --todo-bg: #2f3a44;
  --doing-bg: #4a3a2a;
  --done-bg: #2f4a3a;

  --text-main: #f2f2f2;
  --text-muted: rgba(255, 255, 255, 0.6);

  --border-light: #3a3c42;
  --border-medium: #444650;
  --border-dark: rgba(255, 255, 255, 0.12);
  --border-dashed: rgba(255, 255, 255, 0.2);

  --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.6);
  --shadow-hover: 0 6px 12px rgba(0, 0, 0, 0.8);
  --shadow-heavy: 0 16px 40px rgba(0, 0, 0, 0.9);

  --input-bg: #1a1b1f;
}

/* ================= RESET ================= */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, Arial, sans-serif;
  background: var(--app-bg);
  color: var(--text-main);
}

/* ================= TOPBAR ================= */
.topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 12px 16px;
  background: var(--surface-bg);
  border-bottom: 1px solid var(--border-light);
}

.topbar-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
}

.topbar-content {
  display: flex;
  align-items: center;
  justify-content: space-between;

  width: 100%;
  max-width: clamp(800px, 95%, 1824px);
  margin: 0 auto;
}

.topbar-content-left,
.topbar-content-right {
  display: flex;
  gap: 8px;
}

.topbar-content button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-main);
  font-size: 1.5rem;
}

#toggleTheme,
#toggleStorage {
  font-size: 0.85rem;
  padding: 6px 10px;
  border: 1px solid var(--border-medium);
  border-radius: 6px;
  transition: background 0.2s ease;
}

#toggleTheme:hover,
#toggleStorage:hover {
  background: rgba(0, 0, 0, 0.05);
}

body.dark #toggleTheme:hover,
body.dark #toggleStorage:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* ================= BOARD ================= */
.grid-wrapper {
  display: flex;
  justify-content: center;
  padding: 12px;
}

.grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: clamp(260px, 80vw, 600px);
  gap: 8px;

  overflow-x: auto;
  scroll-snap-type: x proximity;

  width: max-content;
  margin: 0 auto;
}

.column {
  display: flex;
  flex-direction: column;

  padding: 8px;
  text-align: center;

  background: var(--surface-bg);
  border: 1px solid var(--border-light);

  scroll-snap-align: start;
}

.column h2 {
  margin: 4px 0 8px;
  font-weight: 500;
}

/* ================= TASK LISTS ================= */
#todoList,
#doingList,
#doneList {
  flex: 1;
  min-height: 100px;

  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ================= TASK CARDS ================= */
.todo,
.doing,
.done {
  display: flex;
  flex-direction: column;

  padding: 10px 10px 6px;
  border-radius: 8px;

  border: 1px solid var(--border-dark);
  box-shadow:
    var(--shadow-soft),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);

  cursor: grab;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.todo {
  background: var(--todo-bg);
}
.doing {
  background: var(--doing-bg);
}
.done {
  background: var(--done-bg);
}

.todo:hover,
.doing:hover,
.done:hover {
  transform: translateY(-2px);
  box-shadow:
    var(--shadow-hover),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.dragging {
  opacity: 0.8;
  transform: rotate(1deg);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.25);
}

/* ================= CARD HEADER ROW ================= */
.card-header-row {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px 0;
}

.story-point-badge {
  position: absolute;
  left: 8px;
  font-size: 0.75rem;
  font-weight: 600;
}

.expandBtn {
  position: absolute;
  right: 8px;
  font-size: 1.2rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-main);
}

/* ================= CARD BUTTONS ================= */
.btn-Holder {
  position: relative;
  display: flex;
  align-items: center;

  height: 20px;
  margin-top: 6px;
  padding-top: 4px;

  border-top: 1px dashed var(--border-dashed);
}

.btn-Holder button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-main);
}

.backBtn {
  position: absolute;
  left: 6px;
  font-size: 1.4rem;
}
.nextBtn {
  position: absolute;
  right: 6px;
  font-size: 1.4rem;
}
/* ================= CARD DROP ZONE ================= */

.dropZone {
  outline: 2px solid red;
  height: 12px;
}

/* ================= FULL CARD OVERLAY ================= */
.full-Card {
  display: none;
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1000;
}

.full-Card-inner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: center;
}

/* ================= FULL CARD CONTENT ================= */
.full-Card-Content {
  width: 360px;
  height: 70vh;
  max-height: 600px;

  display: flex;
  flex-direction: column;
  overflow: hidden;

  border-radius: 20px;
  background: var(--surface-bg);
  box-shadow: var(--shadow-heavy);
}

.full-Card.todo .full-Card-Content {
  background: var(--todo-bg);
}
.full-Card.doing .full-Card-Content {
  background: var(--doing-bg);
}
.full-Card.done .full-Card-Content {
  background: var(--done-bg);
}

/* ================= VIEW / EDIT MODES ================= */
.view-only,
.edit-only {
  display: none;
}

.full-Card.view-mode .view-only {
  display: block;
}
.full-Card.edit-mode .edit-only {
  display: flex;
}

/* Keep card centered, push panel right */
.full-Card.edit-mode .story-points-panel {
  position: absolute;
  left: calc(100% + 16px);
  top: 0;
}

/* ================= CARD HEADER ================= */
.card-header {
  position: relative;
  padding: 48px 16px 16px;
  border-bottom: 1px solid var(--border-medium);
}

#fullCardTitle,
#taskTitleInput {
  font-size: 1.2rem;
  font-weight: 600;
  text-align: center;
  margin: 0 0 4px;
}

#taskTitleInput {
  width: 100%;
  border: none;
  background: transparent;
  outline: none;
  color: var(--text-main);
}

#fullCardStoryPoint {
  position: absolute;
  top: 6px;
  left: 16px;
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0.8;
}

#fullCardId {
  position: absolute;
  top: 6px;
  right: 16px;
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0.8;
}

/* ================= CARD BODY ================= */
.card-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  text-align: left;
}

#taskDescriptionInput {
  width: 100%;
  height: 100%;
  resize: none;
  border: none;
  background: transparent;
  outline: none;
  font: inherit;
  color: var(--text-main);
}

/* ================= STORY POINT PANEL ================= */
.story-points-panel {
  display: none; /* hidden by default */

  width: 360px;
  height: 70vh;
  max-height: 600px;

  padding: 12px;
  flex-direction: column;
  gap: 8px;

  border-radius: 20px;
  border: 1px solid var(--border-medium);
  background: var(--surface-bg);
}

/* show ONLY in edit mode */
.full-Card.edit-mode .story-points-panel {
  display: flex;
  position: absolute;
  left: calc(100% + 16px);
  top: 0;
}

.story-points-panel select {
  width: 100%;
  margin-bottom: 12px;
  padding: 6px 8px;

  border-radius: 4px;
  border: 1px solid var(--border-medium);

  background: var(--input-bg);
  color: var(--text-main);
}

/* ================= CARD FOOTER ================= */
.card-footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;

  padding: 12px 16px;
  border-top: 1px solid var(--border-medium);
}

.card-footer button {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid #333;

  background: none;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-main);
}

.card-footer button:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* ================= MOBILE RESPONSIVE ================= */
@media (max-width: 768px) {
  /* Topbar adjustments */
  .topbar {
    padding: 10px;
  }

  .topbar-content {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 8px;
    align-items: center;
  }

  .topbar-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
    justify-self: start;
  }

  .topbar-title {
    font-size: 1rem;
    position: static;
    transform: none;
    text-align: center;
    justify-self: center;
    grid-column: 2;
  }

  .topbar-right {
    justify-self: end;
    grid-column: 3;
  }

  #toggleTheme,
  #toggleStorage {
    font-size: 0.6rem;
    padding: 4px 7px;
    white-space: nowrap;
    display: block;
    width: 100%;
  }

  #newTaskBtn {
    font-size: 1.6rem;
    padding: 4px 8px;
  }

  /* Grid adjustments */
  .grid-wrapper {
    padding: 8px;
  }

  .grid {
    grid-auto-columns: clamp(280px, 90vw, 400px);
    gap: 12px;
    padding-bottom: 20px;
  }

  .column {
    min-height: calc(100vh - 120px);
  }

  .column h2 {
    font-size: 1.1rem;
    margin: 8px 0 12px;
  }

  /* Task cards - larger touch targets */
  .todo,
  .doing,
  .done {
    padding: 12px;
    min-height: 60px;
  }

  .card-header-row {
    padding: 10px 0;
  }

  .story-point-badge {
    font-size: 0.8rem;
  }

  .expandBtn {
    font-size: 1.4rem;
    padding: 4px;
  }

  .backBtn,
  .nextBtn {
    font-size: 1.6rem;
    padding: 4px;
  }

  /* Full card modal adjustments */
  .full-Card-inner {
    width: 100%;
    height: 100%;
    padding: 12px;
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .full-Card-Content {
    width: 100%;
    max-width: 100%;
    height: 85vh;
    flex-shrink: 0;
    border-radius: 12px;
  }

  /* Story points panel on mobile - full height, user scrolls down to see it */
  .full-Card.edit-mode .story-points-panel {
    position: static;
    width: 100%;
    height: 85vh;
    max-height: none;
    flex-shrink: 0;
    border-radius: 12px;
  }

  /* Ensure inputs are accessible */
  .card-header {
    position: relative;
    z-index: 1;
  }

  #taskTitleInput {
    touch-action: manipulation;
  }

  #taskDescriptionInput {
    touch-action: manipulation;
    min-height: 100px;
  }

  /* Card header mobile adjustments */
  .card-header {
    padding: 40px 12px 12px;
  }

  #fullCardTitle,
  #taskTitleInput {
    font-size: 1.1rem;
  }

  #fullCardStoryPoint,
  #fullCardId {
    font-size: 0.75rem;
  }

  /* Card body mobile adjustments */
  .card-body {
    padding: 12px;
    font-size: 0.95rem;
  }

  /* Card footer - stack buttons on very small screens */
  .card-footer {
    padding: 10px 12px;
    gap: 6px;
  }

  .card-footer button {
    padding: 10px 12px;
    font-size: 0.85rem;
    flex: 1;
  }

  /* Story points panel mobile */
  .story-points-panel {
    padding: 16px 12px;
  }

  .story-points-panel h3 {
    font-size: 1rem;
    margin-bottom: 12px;
  }

  .story-points-panel label {
    font-size: 0.85rem;
    margin-top: 8px;
  }

  .story-points-panel select {
    padding: 10px 8px;
    font-size: 0.95rem;
  }
}

/* Extra small phones */
@media (max-width: 380px) {
  .topbar-title {
    font-size: 1rem;
  }

  #toggleTheme,
  #toggleStorage {
    font-size: 0.65rem;
    padding: 4px 6px;
  }

  .grid {
    grid-auto-columns: 95vw;
  }

  .card-footer {
    flex-wrap: wrap;
  }

  .card-footer button {
    min-width: calc(50% - 3px);
  }
}
