/* ==================== */
/* ROOT VARIABLES       */
/* ==================== */
:root {
  /* Color Variables */
  --bg-primary: #faf8f6;
  --bg-card-dark: #1e1e1e;
  --bg-card-light: #ffffff;
  --bg-task: #f8f5ee;
  --bg-date: #eee8de;
  --bg-checkbox: #d7dadd;
  --bg-checkbox-checked: #4caf50;
  --text-dark: #1e1e1e;
  --text-light: #ffffff;
  --text-muted: #888;
  --text-completed: #bbb;
  --text-task: #7a746e;
  --text-date: #a78b6f;
  --header-bg: color-mix(in srgb, rgb(75, 150, 75) 38%, rgb(0, 195, 255) 62%);
  --header-text: #faf8f6;
  --header-text-light: #1e1e1e;
  --date-box: #eee8de;
  --date-box-text: #a78b6f;

  /* Shadow Variables */
  --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.15);
  --shadow-todo: 0 6px 16px rgba(0, 0, 0, 0.08);

  /* Radius Variables */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Spacing Variables */
  --gap-sm: 0.3rem;
  --gap-md: 1rem;
  --padding-card: 24px;
  --padding-input: 0.7rem;
  --padding-button: 0.5rem 1rem;

  /* Font Variables */
  --font-family: "Segoe UI", sans-serif;
  --font-mono: monospace;
}

/* ==================== */
/* DARK THEME           */
/* ==================== */
.dark-theme {
  /* Color Overrides */
  --bg-primary: #2a2438;
  --bg-card-dark: #1e1e1e;
  --bg-task: #2d2d2d;
  --bg-date: #3a3a3a;
  --bg-checkbox: #4a4a4a;
  --text-dark: #e0e0e0;
  --text-light: #f0f0f0;
  --text-muted: #a0a0a0;
  --text-completed: #777;
  --text-task: #c7c7c7;
  --text-date: #b5a882;
  --header-bg: color-mix(in srgb, #3a5a40 38%, #263035 62%);
  --header-text: #f8f9fa;

  /* Component-specific overrides */
  .todo-card {
    background-color: var(--bg-card-dark);
    border-color: #3a3a3a;
  }
  .date-box {
    background-color: var(--bg-date);
    color: var(--text-date);
  }
  .task-text {
    color: var(--text-dark);
  }
  .task-text.completed {
    color: var(--text-completed);
  }
  .checkbox input[type="checkbox"] {
    background-color: var(--bg-checkbox);
  }
  .checkbox input[type="checkbox"]:checked {
    background-color: var(--bg-checkbox-checked);
  }
  .delete-btn:hover {
    background-color: #5a1a1a;
  }
  .edit-btn:hover {
    background-color: #2a3a5a;
  }
  .taskpulse-input input.input-dark {
    background-color: var(--bg-card-dark);
    color: var(--text-light);
    border-color: #444;
  }
  .card-content {
    background-color: var(--header-bg);
    color: var(--header-text);
  }
  .card-header {
    background-color: var(--bg-card-dark);
    color: var(--text-light);
    box-shadow: var(--shadow-card);
    border-radius: var(--radius-lg);
    padding: var(--padding-card);
    transition: width 0.3s ease-in-out;
  }
}

/* ==================== */
/* BASE STYLES          */
/* ==================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  margin: 0;
  font-family: "Segoe UI", sans-serif;
  display: flex;
  height: 100vh;
}

.container {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: var(--gap-md);
  width: 100vw;
  background-color: var(--bg-primary);
  position: relative;
}

/* ==================== */
/* CARD COMPONENTS      */
/* ==================== */
.card {
  width: 45rem;
  overflow-y: auto;
  border-radius: 16px;
  padding: var(--padding-card);
  box-shadow: var(--shadow-card);
  transition: all 0.3s ease-in-out;
}

.card-header {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  margin-bottom: var(--gap-md);
  padding: var(--padding-card);
  border-radius: var(--radius-lg);
}

.card-header h1 {
  margin: 0 0 8px;
  font-size: 24px;
}

.card-content {
  background-color: var(--header-bg);
  position: sticky;
  top: 0px;
  width: 100%;
  display: flex;
  margin-bottom: var(--gap-md);
  gap: var(--gap-md);
  padding: var(--padding-card);
  box-shadow: var(--shadow-card);
  transition: width 0.3s ease-in-out;
  border-radius: var(--radius-lg);
}

/* ==================== */
/* THEME SWITCH         */
/* ==================== */
.switch-container {
  width: 2rem;
  height: 2rem;
  border: 1px solid #ccc;
  display: grid;
  border-radius: var(--radius-lg);
  grid-template-columns: repeat(1, 1fr);
  grid-template-rows: repeat(1, 1fr);
  background-color: transparent;
  overflow: hidden;
}

.switch-container .switch-1 {
  grid-column: 1;
  grid-row: 1;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-card-light);
}

.switch-container .switch-2 {
  grid-column: 1;
  grid-row: 1;
  width: 100%;
  height: 100%;
  background-color: var(--bg-card-dark);
  color: var(--bg-card-light);
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-switch {
  visibility: hidden;
  display: none;
  opacity: 0;
  transition: visibility 0s, opacity 0.5s linear;
  z-index: -1;
}

.show-switch {
  visibility: visible;
  opacity: 1;
  transition: visibility 0s, opacity 0.5s linear;
}

.more-option-icon,
.search-icon {
  width: 2rem;
  height: 2rem;
  border: 1px solid transparent;
  align-items: center;
  color: var(--date-box-text);
  border-radius: var(--radius-lg);
  align-items: flex-start;
  transition: all 0.3s ease-in-out;
  /* background-color: var(--header-bg); */
}
.more-option-icon {
  color: var(--bg-checkbox-checked);
  position: relative;
  z-index: 2;
}

.rotate i {
  color: red;
  transform: rotate(45deg);
  transition: all 0.3s ease-in-out;
}

.found-card {
  background-color: var(--header-bg);
  color: var(--text-light);
  padding: var(--gap-sm);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  margin-bottom: var(--gap-sm);
  transition: all 0.3s ease-in-out;
}

/* ==================== */
/* FORM ELEMENTS        */
/* ==================== */
.taskpulse-input {
  width: 90%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--gap-md);
  margin: auto;
  margin-bottom: var(--gap-md);
}

.taskpulse-input input,
.taskpulse-input textarea {
  width: 100%;
  padding: 0.9rem 0.5rem;
  border-radius: 0.5rem;
  font-size: 1.2rem;
  border: 1px solid silver;
}

.input-dark {
  background-color: var(--bg-card-dark);
  color: var(--text-light);
}

.taskpulse-input input:focus,
.taskpulse-input textarea:focus {
  border: 1px solid transparent;
  outline: none;
  outline-offset: -1px;
  box-shadow: 0 0 0 2px #4caf50;
  transition: all 0.3s ease-in-out;
}

.taskpulse-input input::placeholder,
.taskpulse-input textarea::placeholder {
  font-family: monospace;
  color: grey;
}

.add_btn {
  padding: 0.5rem 1rem;
  width: 100%;
  border-radius: 5px;
  border: 1px solid silver;
  background-color: #4caf50;
  color: #faf8f6;
  text-transform: capitalize;
}

.add_btn:hover {
  cursor: pointer;
  background-color: #faf8f6;
  color: #4caf50;
  transition: background 0.3s ease-in-out;
}

/* ==================== */
/* SEARCH COMPONENTS      */
/* ==================== */

.search-container {
  background-color: var(--bg-card-dark);
  color: #f0f0f0;
  width: 100%;
  height: 16rem;
  top: 0;
  left: 0;
  position: absolute;
  padding: 0.5rem;
  border-radius: var(--gap-sm);
  z-index: 3;
}

.findHeader {
  background-color: var(--bg-card-dark);
  color: #f0f0f0;
  position: sticky;
  top: 0;
  padding: 1rem;
  border-radius: var(--gap-sm);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  border: 1px solid var(--header-bg);
}

.search-bar {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
}

.search-container input {
  padding: var(--gap-sm);
  border-radius: var(--radius-md);
  outline: none;
  border: none;
}

.fa-close {
  color: red;
  border-radius: var(--radius-sm);
  padding: 0 var(--gap-sm);
}

.result-container {
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(126, 77, 77, 0.2) #080000;
  scroll-behavior: smooth;
  scroll-padding-top: var(--gap-sm);
  scroll-padding-bottom: var(--gap-sm);
  padding: var(--gap-sm);
  height: 75%;
}
/* ==================== */
/* TASK COMPONENTS      */
/* ==================== */
.task-container {
  gap: 1rem;
  display: flex;
  flex-direction: column;
  max-height: 20rem;
  overflow-y: auto;
  padding: var(--gap-sm);
  border-radius: var(--radius-lg);
  scrollbar-width: none;
}

.task-container::-webkit-scrollbar {
  background-color: #1e1e1e;
  border-radius: var(--radius-lg);
}

.task-container::-webkit-scrollbar-thumb {
  background-color: rgba(126, 77, 77, 0.2);
  border-radius: 3px;
  width: 2px;
}

.task-item.dragging {
  opacity: 0.6;
  background-color: var(--header-bg);
  width: inherit;
  border-radius: inherit;
}

.todo-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap-sm);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  width: 100%;
  padding: 0.5rem;
  color: var(--text-dark);
}

.task-content {
  flex-direction: column;
  align-items: center;
  gap: var(--gap-sm);
  background: var(--bg-task);
  padding: var(--gap-sm);
  width: 80%;
  min-height: 4rem;
  border-radius: var(--gap-sm);
}

.task-text {
  flex: 1;
  font-size: 1rem;
  height: 100%;
  font-weight: 400;
  text-align: left;
  overflow: hidden;
  overflow-wrap: break-word;
  /* white-space: pre-line; */
}

.title {
  text-transform: capitalize;
  font-size: 1.2rem;
  font-weight: 700;
}

.title:focus {
  background-color: none;
}

/* ==================== */
/* DATE & PRIORITY      */
/* ==================== */
.date-box {
  background-color: var(--date-box);
  width: 60px;
  text-align: center;
  padding: var(--gap-sm) 0;
  color: #a78b6f;
  border-radius: 0.3rem;
}

.date-box .day {
  font-weight: bold;
  font-size: 1rem;
}

.date-box .month {
  font-weight: bold;
  font-size: 0.9rem;
}

.date-box .time {
  font-size: 10px;
}

.duecheck {
  color: var(--date-box-text);
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: baseline;
  height: 100%;
  gap: var(--gap-sm);
  font-size: 0.7rem;
}

input[type="date"],
input[type="time"] {
  height: 42px;
  text-align: center;
}

.duedate {
  display: flex;
  margin: auto;
  font-size: xx-small;
}

.duetime {
  display: inline;
  font-size: 9px;
  border-radius: var(--radius-md);
}
.priority {
  display: inline;
  background-color: #4caf50;
  color: whitesmoke;
  padding: var(--gap-sm);
  font-size: 9px;
  border-radius: var(--radius-md);
}

.high-priority {
  background-color: #f44336;
  color: whitesmoke;
  padding: var(--gap-sm);
  font-size: 9px;
  border-radius: var(--radius-md);
}

.medium-priority {
  background-color: #ff9800;
  color: whitesmoke;
  padding: var(--gap-sm);
  font-size: 9px;
  border-radius: var(--radius-md);
}

.low-priority {
  background-color: #2196f3;
  color: whitesmoke;
  padding: var(--gap-sm);
  font-size: var(--radius-md);
  border-radius: var(--radius-md);
}

.priority-container {
  position: absolute;
  display: none;
  top: 0;
  right: 0;
  background-color: #263035;
  flex-direction: column;
  align-items: center;
  border-radius: var(--radius-sm);
  gap: var(--gap-sm);
  padding: var(--gap-sm);
  transition: background 0.3s ease-in-out;
}

.show-priority-container {
  display: flex;
}

.ten-percent {
  color: rgb(206, 19, 19);
  animation: pulse 1s infinite;
}

.twenty-percent {
  color: rgb(236, 223, 33);
  animation: pulse 1ms infinite;
}
@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
  75% {
    transform: scale(1.1);
  }
  80% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

.priority-label-text,
.date-label-text {
  flex-grow: 1;
  font-size: 0.8rem;
  color: var(--text-task);
  text-transform: capitalize;
  padding: var(--gap-sm);
  font-weight: bold;
}
.priority-label {
  margin-right: auto;
  background-color: var(--bg-date);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text-task);
  text-transform: capitalize;
  padding: var(--gap-sm);
}

.priority-label:focus {
  background-color: none;
}

.task-priority {
  background-color: var(--date-box-text);
  color: var(--text-light);
  padding: var(--gap-sm);
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
  text-transform: capitalize;
  font-weight: bold;
  border: none;
  outline: none;
}

.task-priority:focus {
  background-color: none;
}
.task-priority:hover {
  background-color: var(--bg-date);
  color: var(--text-task);
}

.date-label {
  display: flex;
  align-items: baseline;
  font-size: 0.8rem;
  color: var(--text-task);
  text-transform: capitalize;
  padding: var(--gap-sm);
  text-align: center;
  background-color: var(--bg-date);
  border-radius: var(--radius-sm);
  margin-right: auto;
  vertical-align: middle;
}

/* ==================== */
/* CHECKBOX & ACTIONS   */
/* ==================== */
.checkbox-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(1, 1fr);
  align-items: center;
  justify-content: center;
  gap: var(--gap-sm);
  margin-left: auto;
}

.checkbox {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background-color: var(--bg-checkbox);
}

.checkbox input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 100%;
  cursor: pointer;
  background-color: #d7dadd;
  border-radius: 6px;
}

.checkbox input[type="checkbox"]:checked {
  background-color: var(--bg-checkbox-checked);
  border-radius: 6px;
}

.checkbox input[type="checkbox"]:checked::before {
  content: "✓";
  color: var(--bg-date);
  width: 24px;
  height: 24px;
  scale: 1.2;
  display: flex;
  justify-content: center;
  align-items: center;
}

.checkbox input[type="checkbox"]:checked:hover {
  background-color: var(--bg-checkbox-checked);
}

.completed {
  color: #bbb;
  text-decoration: line-through;
}

.checkbox input:checked ~ .checkmark {
  background-color: #4caf50;
  border-color: #4caf50;
}

.delete-btn {
  background-color: transparent;
  border: none;
  color: #f44336;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.3s ease-in-out;
  border-radius: var(--radius-sm);
  padding: var(--radius-sm);
}

.delete-btn:hover {
  color: #f8f4f4;
  background-color: #d32f2f;
}

.delete-btn:focus {
  transition: all 0.3s ease-in-out;
}

.delete-btn:active {
  transform: scale(0.9);
}

/* ==================== */
/* EDIT MODE            */
/* ==================== */
.edit-container {
  display: none;
  flex-direction: row;
  flex-wrap: wrap;
}

.edit-container {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.edit-input {
  flex-grow: 1;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.save-btn,
.cancel-btn {
  padding: var(--gap-sm);
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.save-btn {
  background-color: #4caf50;
  color: white;
}

.cancel-btn {
  background-color: #f44336;
  color: white;
}

.edit-btn {
  border: none;
  background-color: transparent;
  color: #2196f3;
  cursor: pointer;
  padding: var(--gap-sm);
  border-radius: var(--radius-sm);
}

.edit-btn:hover {
  color: var(--date-box-text);
  background-color: var(--bg-primary);
}

.highlighted {
  background-color: rgb(199, 191, 207);
  color: var(--text-dark);
  padding: var(--gap-sm);
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
  text-transform: capitalize;
  font-weight: bold;
  border: 1px solid var(--bg-date);
}

/* ==================== */
/* MEDIA QUERIES        */
/* ==================== */
@media screen and (max-width: 768px) {
  .card {
    width: 30rem;
    padding: var(--gap-md);
    transition: all 0.3s ease-in-out;
  }

  .taskpulse-input input {
    font-size: 1rem;
    padding: 0.7rem;
  }

  .taskpulse-input button {
    padding: 0.6rem;
    font-size: 1rem;
  }

  .switch-container {
    width: 1.8rem;
    height: 1.8rem;
  }

  .todo-card {
    align-items: center;
    padding: var(--gap-sm);
    overflow: hidden;
  }

  .task-text {
    font-size: 0.95rem;
    width: 100%;
    word-break: break-word;
  }
}

@media (max-width: 500px) {
  .card {
    width: 20rem;
    padding: var(--gap-sm);
    transition: all 0.3s ease-in-out;
  }

  .card-content {
    border-radius: var(--radius-md);
    flex-direction: column;
  }

  .card-header h2 {
    font-size: 20px;
  }
  .card-header {
    flex-direction: row;
    justify-content: space-between;
  }

  .todo-card {
    flex-direction: column;
    align-items: center;
    padding: var(--gap-sm);
    overflow: hidden;
  }

  .task-content {
    width: 100%;
  }

  .duecheck {
    width: 100%;
    flex-direction: row;
  }

  .priority {
    margin-right: 0;
  }

  .date-box {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--gap-sm);
    border-radius: var(--radius-sm);
  }

  .date-box .month {
    font-size: 1rem;
  }

  .taskpulse-input input,
  .taskpulse-input button {
    font-size: 0.95rem;
  }

  .taskpulse-input {
    width: 100%;
    padding: 0 var(--gap-sm);
  }
}
