@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap");

:root {
  /* --- COLOR PALETTE (Google Material Style) --- */
  --primary-blue: #0b57d0;
  --primary-hover: #1d4ed8;
  --bg-app: #f3f4f6;
  --text-main: #1f2937;
  --text-secondary: #6b7280;
  --danger: #dc2626;
  --border-light: #e5e7eb;

  /* Priority Colors */
  --prio-low-bg: #d1fae5;
  --prio-low-text: #065f46;
  --prio-med-bg: #fef3c7;
  --prio-med-text: #92400e;
  --prio-high-bg: #fee2e2;
  --prio-high-text: #b91c1c;

  /* --- SPACING & SIZES --- */
  --radius-card: 16px;
  --radius-btn: 8px;
  --radius-pill: 50px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* =========================================
   2. RESET & GLOBAL STYLES
   ========================================= */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: var(--bg-app);
  color: var(--text-main);
  font-family: "Roboto", sans-serif;
}

/* =========================================
   3. TYPOGRAPHY SYSTEM
   ========================================= */

h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

h2 {
  font-size: 1.3rem;
  font-weight: 700;
}

h3,
h4 {
  font-size: 1.25rem;
  font-weight: 500;
}

p,
time {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* =========================================
   4. MAIN LAYOUT STRUCTURE
   ========================================= */

.app-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

aside {
  display: flex;
  flex-direction: column;
}

main {
  padding: 1rem;
}

footer {
  padding: 1rem;
  width: 100%;
}

/* =========================================
   5. COMPONENT: BRAND & HEADER
   ========================================= */

.brand {
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  background-color: white;
}

.brand span {
  color: var(--primary-blue);
  font-size: 32px;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: white;
  padding: 1rem;
  box-shadow: var(--shadow-sm);
}

.profile {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.profile span {
  font-size: 40px;
}

.username {
  color: var(--text-main);
  text-transform: capitalize;
}

.user-position {
  text-transform: capitalize;
}

.date-time-container {
  display: flex;
  flex-direction: column;
  align-items: end;
  color: var(--text-secondary);
}

/* =========================================
   6. COMPONENT: INPUT FORM CARD
   ========================================= */

.input-card {
  padding: 1rem;
}

.task-input-card {
  background-color: white;
  padding: 1rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.input-group {
  width: 100%;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-btn);
  cursor: pointer;
}

.input-group input {
  width: 100%;
  border: transparent;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  background-color: transparent;
}

.input-group input:focus {
  outline: none;
}

.priority-group {
  display: flex;
  gap: 0.5rem;
  width: 100%;
}

.chip-btn {
  background-color: white;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-pill);
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  flex: 1;
  font-size: 1rem;
}

.chip-btn.active,
.chip-btn.active:focus,
.chip-btn.active:hover {
  background-color: var(--primary-blue);
  color: white;
  border-color: var(--primary-blue);
}

input[type="date"] {
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-pill);
  padding: 0.3rem 1rem;
  background-color: white;
  font-family: "Roboto", sans-serif;
  cursor: pointer;
  width: 100%;
  font-size: 1rem;
}

.submit-btn {
  background-color: var(--primary-blue);
  color: white;
  font-weight: 700;
  padding: 0.5rem 0;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--border-light);
  width: 100%;
  cursor: pointer;
  font-size: 1rem;
}

/* =========================================
   7. COMPONENT: TASK LISTS
   ========================================= */

.tasks-list,
.completed-tasks {
  background-color: white;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-md);
}

.tasks-list h2 {
  border-bottom: 1.5px solid var(--border-light);
  padding: 1rem;
}

.tasks-by-date {
  padding: 0.5rem 0;
}

.tasks {
  display: flex;
  align-items: start;
  justify-content: space-between;
  padding: 0.5rem 1rem;
}

.check-detail {
  display: flex;
  align-items: start;
  gap: 0.5rem;
}

.detail-task {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.detail-task h4 {
  transition: color 0.3s ease, text-decoration 0.3s ease;
  color: var(--text-main);
  text-decoration: none;
}

/* Custom Checkbox */
input[type="checkbox"] {
  appearance: none;
  width: 1.25rem;
  height: 1.25rem;
  cursor: pointer;
  accent-color: var(--text-main);
  margin-top: 0.2rem;
  border: 1.5px solid var(--text-secondary);
  border-radius: 50%;
  position: relative;
}

input[type="checkbox"]:checked {
  border-color: var(--primary-blue);
}

input[type="checkbox"]:checked::after {
  content: "✓";
  color: var(--primary-blue);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.7rem;
  font-weight: 700;
}

/* Overdue Styling */
.tasks.overdue .detail-task h4 {
  color: var(--danger);
}

/* Task Meta Info (Priority & Date) */
.additional-info {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.priority,
.deadline {
  border-radius: var(--radius-pill);
  padding: 0.3rem 0.6rem;
  font-weight: 500;
  font-size: 0.9rem;
  text-transform: capitalize;
}

.priority.low {
  background-color: var(--prio-low-bg);
  color: var(--prio-low-text);
  border: 1px solid var(--prio-low-text);
}

.priority.medium,
.deadline.today {
  background-color: var(--prio-med-bg);
  color: var(--prio-med-text);
  border: 1px solid var(--prio-med-text);
}

.priority.high,
.deadline.overdue {
  background-color: var(--prio-high-bg);
  color: var(--prio-high-text);
  border: 1px solid var(--prio-high-text);
}

.deadline {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.deadline.future {
  background-color: transparent;
  color: var(--text-main);
  border: 1px solid var(--text-main);
}

.deadline .material-symbols-outlined {
  font-size: 16px;
}

/* Delete Button */
.delete-btn {
  background-color: transparent;
  border: none;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.tasks .delete-btn:hover {
  background-color: #e5e7eb;
  color: var(--text-main);
  transform: rotate(90deg);
}

/* =========================================
   8. COMPONENT: COMPLETED TASKS
   ========================================= */

.completed-tasks {
  margin-top: 1.2rem;
}

.completed-tasks h2 {
  padding: 1rem;
  border-bottom: 1.5px solid var(--border-light);
}

.tasks.completed {
  opacity: 0.6;
  filter: grayscale(100%);
  transition: all 0.3s ease;
  border-color: transparent;
}

.tasks.completed .detail-task h4 {
  color: var(--text-secondary);
  text-decoration: line-through;
}

/* =========================================
   9. GLOBAL BUTTONS (Delete All)
   ========================================= */

.delete-all-btn,
.delete-all-btn.desktop {
  width: 100%;
  padding: 0.5rem;
  border-radius: var(--radius-pill);
  color: var(--danger);
  background-color: white;
  border: 1.5px solid var(--prio-high-text);
  font-size: 1.2rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.delete-all-btn:hover,
.delete-all-btn.desktop:hover {
  background-color: #fee2e2;
  color: #b91c1c;
  border-color: #b91c1c;
}

.delete-all-btn.desktop {
  display: none;
}

/* --- Common Transitions --- */
button,
input,
.chip-btn,
.input-group,
.task-input-card {
  transition: all 0.2s ease;
}

/* --- Input Focus States --- */
.input-group:focus-within {
  border-color: var(--primary-blue);
  background-color: white;
}

input[type="date"]:focus {
  outline: none;
  border-color: var(--primary-blue) !important;
  background-color: white;
}

/* --- Hover States --- */
.input-group:hover,
input[type="date"]:hover,
.chip-btn:hover {
  background-color: #f8f9fa;
  border-color: #d1d5db;
}

/* --- Active state (Press) --- */
button:active,
.chip-btn:active {
  transform: scale(0.98);
}

/* --- Media Queries --- */

@media (width > 768px) {
  h1 {
    font-size: 1.75rem;
  }
  p,
  time {
    font-size: 1.3rem;
  }
  h2 {
    font-size: 1.6rem;
  }
  h3,
  h4 {
    font-size: 1.5rem;
  }

  .input-group input,
  .chip-btn,
  input[type="date"],
  .submit-btn {
    font-size: 1.3rem;
  }

  .priority,
  .deadline {
    font-size: 1.15rem;
  }

  header,
  .input-card,
  main,
  footer {
    padding: 1rem 1.6rem;
  }

  .tasks-list h2,
  .tasks-by-date,
  .task-input-card {
    padding: 1.25rem;
  }

  .submit-btn,
  .delete-all-btn {
    padding: 0.8rem 0;
  }
}

@media (width > 1025px) {
  .app-layout {
    display: grid;
    grid-template-columns: 400px 1fr;
    height: 100vh;
    overflow: hidden;
  }

  aside {
    background-color: white;
    padding-bottom: 1rem;
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
  }

  .brand {
    border-bottom: 1px solid var(--border-light);
  }

  header {
    flex-direction: column;
    align-items: start;
    justify-content: center;
    gap: 2rem;
    padding: 1.15rem;
  }

  .profile {
    gap: 0.2rem;
  }

  .profile span {
    font-size: 60px;
  }

  .date-time-container {
    flex-direction: row;
    width: 100%;
    justify-content: space-between;
  }

  .input-card {
    padding: 0;
  }

  .task-input-card {
    background-color: transparent;
    padding: 1rem;
    border: none;
  }

  main {
    padding: 2.5rem;
    overflow-y: auto;
  }

  .tasks-list h2,
  .completed-tasks h2 {
    padding: 1rem 1.5rem;
  }

  .tasks-by-date {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 0.5rem;
  }

  footer {
    display: none;
  }

  .delete-all-btn {
    display: none;
  }

  .delete-all-btn.desktop {
    display: block;
    width: 90%;
    margin: 0 auto;
    margin-top: auto;
    padding: 0.8rem 0;
  }
}
