/* ========================
   Global & Root Variables
======================== */
* {
  box-sizing: border-box; /* Ensures padding and border are included in total element size */
}

:root {
  --primary-color: #ffffff;
  --secondary-color: #f4f7fd;
  --primary-font-color: #000000;
  --secondary-font-color: #828fa3;
  --primary-btn-color: #635fc7;
  --primary-box-shadow: 0px 4px 6px rgba(54, 78, 126, 0.1015); /* Subtle shadow for card depth */
  --sidebar-width: 300px; /* Sidebar fixed width */
}
.darkmode {
  --primary-color: #3e3f4e;
  --secondary-color: #000000;
  --primary-font-color: #ffffff;
  --secondary-font-color: #828fa3; 
  --primary-btn-color: #635fc7;
  --primary-box-shadow: 0px 4px 6px rgba(54, 78, 126, 0.1015); /* Subtle shadow for card depth */
  --sidebar-width: 300px; /* Sidebar fixed width */
}

/* Hide default checkbox */
.theme-switch {
  display: none;
}

.theme-switch-label {
  display: inline-block;
  width: 60px;
  height: 30px;
  background-color: #ebebeb;
  border-radius: 30px;
  position: absolute;
  cursor: pointer;
  transition: background-color 0.3s ease;
  bottom: 160px;
  left: 75px;


}

/* Slider knob */
.slider {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  background: linear-gradient(180deg, #ffcc89, #d8860b);
  border-radius: 50%;
  box-shadow: 0px 3px 6px rgba(0,0,0,0.2);
  transition: transform 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sun-icon, .moon-icon {
  position: absolute;
  transition: opacity 0.3s ease;
}

.moon-icon {
  opacity: 0;
}

.theme-switch:checked + .theme-switch-label .slider {
  transform: translateX(30px);
  background: linear-gradient(180deg, #555, #111);
}

.theme-switch:checked + .theme-switch-label .moon-icon {
  opacity: 1;
}

.theme-switch:checked + .theme-switch-label .sun-icon {
  opacity: 0;
}

/* Dark Mode */
body.darkmode {
  background-color: #121212;
  color: #f5f5f5;
}

body.darkmode .theme-switch-label {
  background-color: #444;
}


/* ================
   Base Elements
================ */
body {
  font-family: "Plus Jakarta Sans", sans-serif;
  display: flex; /* Allow layout to span horizontally */
  flex-direction: row;
  width: 100%;
  min-height: 100vh;
  margin: 0;
  background-color: var(--secondary-color);
  font-size: 1rem; /* Base font size for rem scaling */
}

/* ================
   Sidebar Layout
================ */
.side-bar {
  display: flex;
  flex-direction: column;
  background-color: var(--primary-color);
  border-right: 1px solid #e4ebfa; /* Light divider */
  width: var(--sidebar-width);
  height: 100vh;
}

/* Utility */
.hidden { display: none !important; }

/* Shared pill style (matches Figma) */
.sidebar-toggle {
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: #f4f7fd;
  color: #726aff;
  border: none;
  border-radius: 0 100px 100px 0; /* right-side pill */
  height: 48px;
  width: 276px;
  padding: 28px 12px 28px 50px;
  font-size: 0.9375rem;
  font-weight: bold;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  bottom: -270px;
}

/* Mirror the pill for the "Show" button to match Figma */
.sidebar-toggle.show {
  border-radius: 100px 0 0 100px; /* left-side pill */
  padding: 28px 50px 28px 12px;   /* reverse padding for icon placement */
}

/* Sidebar hidden state */
.side-bar.hidden { 
  display: none; 
}

/* Dark Mode Styling */
.darkmode #theme-switch-toggle {
    color: #726aff;
}

/* Floating Show Sidebar Button */
.show-sidebar-btn {
    position: fixed;
    bottom: 20px;
    left: 0;
    background: var(--primary-color);
    padding: 10px;
    border-radius: 0 6px 6px 0;
    cursor: pointer;
    display: none;
    color: var(--text-color);
    padding: 10px 15px;
    border-radius: 6px;
    align-items: center;
    gap: 10px;
}

.sidebar-toggle-hidden {
  display: none !important;
}


/* Dark Mode Floating Button */
body.dark-mode .show-sidebar-btn {
    background: #444;
}

#side-logo-div {
  margin: 33px 113px 54px 34px; /* Spacing around logo */
  display: flex;
  justify-content: flex-start;
}

#logo {
  width: 100%; /* Make logo responsive within container */
}

#side-logo-div-darkmode {
  margin: 33px 113px 54px 34px; /* Spacing around logo */
  display: none;
  justify-content: flex-start;
}

#logo-darkmode {
  width: 100%; /* Make logo responsive within container */
}

.boards-nav-links-div {
  display: flex;
  flex-direction: column;
  color: var(--primary-font-color);
}

#headline-sidepanel {
  padding: 0 12px 0 50px; /* Aligns section content from left and right */
}

h4 {
  color: var(--secondary-font-color);
  font-size: 0.75rem;
  letter-spacing: 0.125rem; /* Makes heading more spaced */
}

.board-btn {
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 10px; /* Space between icon and text */
  background-color: var(--primary-btn-color);
  color: #fff;
  border: none;
  border-radius: 0 100px 100px 0; /* Pill shape only on right side */
  height: 48px;
  width: 276px;
  padding: 28px 12px 28px 50px;
  font-size: 0.9375rem;
  font-weight: bold;
  cursor: pointer;
  overflow: hidden; /* Prevents overflowed text/icons from showing */
}

/* ===============
   Main Layout
================ */
#layout {
  flex: 1; /* Fills remaining space beside sidebar */
  overflow-x: hidden; /* Prevent horizontal scroll */
  width: 100%;
}

/* ===============
   Header Section
================ */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--primary-color);
  color: var(--primary-font-color);
  height: 96px;
  padding: 0 35px 0 30px;
  border-bottom: 1px solid #e4ebfa;
  width: 100%;
  font-size: 1.875rem;
  font-weight: 600;
}

.header-name-div {
  display: flex;
  align-items: center;
}

.logo-mobile {
  display: none; /* Hidden on desktop; shown on smaller screens */
}


/* ===============
   Board Columns
================ */
.container {
  display: flex;
  flex-direction: column;
  padding-left: 35px;
  box-sizing: border-box;
}

.card-column-main {
  display: grid;
  grid-template-columns: repeat(
    3,
    minmax(0, 304px)
  ); /* 3 columns with min size */
  gap: 8px; /* Space between columns */
}

.column-div {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 12px;
}

.column-head-div {
  display: flex;
  align-items: center;
  gap: 10px; /* Space between dot and column title */
}

.columnHeader {
  font-size: 0.75rem;
  letter-spacing: 0.125rem;
  color: var(--secondary-font-color);
  margin: 0;
}

/* Status Dots */
.dot {
  height: 15px;
  width: 15px;
  border-radius: 50%; /* Make it circular */
  display: inline-block;
}

#todo-dot {
  background-color: #49c4e5;
}

#doing-dot {
  background-color: #8471f2;
}

#done-dot {
  background-color: #219c90;
}

/* ===============
   Task Cards
================ */
.tasks-container {
  display: flex;
  flex-direction: column;
}

.task-div {
  display: flex;
  align-items: center;
  padding-left: 15px;
  width: 100%;
  height: 60px;
  background-color: var(--primary-color);
  color: var(--primary-font-color);
  border-radius: 12px;
  box-shadow: var(--primary-box-shadow);
  cursor: pointer; /* Indicate it's clickable */
  margin-bottom: 20px;
  font-size: 0.9375rem;
  font-weight: bold;
}

.task-id {
  font-size: 0.75rem;
  font-weight: bold;
  color: var(--color-accent, #666);
  margin-right: 4px;
}

.task-actions {
  margin-top: 8px;
  display: flex;
  gap: 6px;
}
.task-actions button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
}
.task-actions button:hover {
  opacity: 0.7;
}
/* ===============
   Headings
================ */
h2 {
  font-size: 1.5rem;
  margin: 0;
}

/* ===============
   Modal Styles
================ */
/* Remove default dialog styles */
dialog {
  position: fixed;
  border: none;
  padding: 0;
  margin: 0;
  background: none;
}

/* Style the modal box */
#task-modal::backdrop {
  background: rgba(0, 0, 0, 0.3);
}

#task-modal {
  top: 40%;
  left: 50%;
  transform: translate(-50%, -40%);
  border-radius: 8px;
  width: 90%;
  max-width: 600px;
  padding: 24px;
  background-color: #fff;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  /*font-family: "Plus Jakarta Sans", sans-serif;*/
}
.darkmode #task-modal{
  background-color: #2b2c37;
  color: #fff;
}

.darkmode .modal {
  background-color: #2b2c37;
  color: #fff;
}

.darkmode .modal input,
.darkmode .modal textarea,
.darkmode #task-status {
  background-color: #ffffff;
  color: #000000;
  border: 1px solid #555;
}

.darkmode .modal-header {
  color: #ffffff
}

.darkmode #select-status {
  background-color: #ffffff;
  color: #000000;
  border: 1px solid #555;
}

/* Priority Colors */
.task-priority {
  margin-top: 5px;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: bold;
  color: white;
  display: inline-block;
}
.task-priority.low { background-color: green; }
.task-priority.medium { background-color: orange; }
.task-priority.high { background-color: red; }

/* Header */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.125rem;
}

.close-btn {
  background: none;
  border: none;
  font-size: 2.5rem;
  line-height: 1;
  cursor: pointer;
  color: #ea5555;
  transition: transform 0.2s ease-in-out, font-weight 0.2s ease-in-out;
  transition-delay: 0.1s; /* Delay before scaling */
}

.close-btn:hover {
  transform: scale(1.15);
  font-weight: 600;
}

.close-btn:focus {
  outline: none;
}

/* Form elements */
form label {
  display: block;
  font-weight: 600;
  font-size: 0.75rem;
  margin-top: 12px;
  margin-bottom: 4px;
  color: #828fa3;
}

form input,
form textarea,
form select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #828fa3;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.8125em;
  resize: vertical;
}

form select {
  appearance: none; /* Remove native arrow */
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="none" stroke="%23828FA3" stroke-width="3" viewBox="0 0 24 24"><path d="M6 9l6 6 6-6"/></svg>')
    no-repeat right 0.75rem center;

  background-size: 1.4rem;
  padding-right: 1rem;
}

#add-new-task-btn {
  background-color: var(--primary-btn-color);
  color: white;
  border-radius: 30px;
  border: 0;
  font-size: 16px;
  padding: 18px;
  padding-left: 35px;
  padding-right: 35px;
  font-weight: 600;
  cursor: pointer;
  margin-right: 20px;
}

/* New Task Modal Window */

.modal-window {
  /* border: 5px solid red; */
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  padding: 24px;
  gap: 20px;
  background-color: var(--primary-color);
  font-weight: 500;
  font-size: 14px;
  border-radius: 10px;

  z-index: 3;
  transition: all 0.3s ease-in;
}

.submit-btn {
  background-color: var(--primary-btn-color);
  color: rgb(255, 255, 255);
  border-radius: 30px;
  border: 0;
  font-size: 16px;
  padding: 14px;
  padding-left: 35px;
  padding-right: 35px;
  font-weight: 600;
  cursor: pointer;
  flex-grow: 1; /* Allows the button to grow and fill the space */
  margin: 5px 0; /* Optional: adds a margin between buttons */
}

textarea {
  font-size: 16px;
  color: black;
  height: 90px;
  padding: 10px;
  border-radius: 4px;
  resize: vertical;
}

/* Adjust main content when sidebar hidden */
.main-content {
  transition: margin-left 0.3s ease;
}

.sidebar.hidden + .main-content {
  margin-left: 0;
}

/* =======================
   Theme Toggle
=======================*/
/* ===== Dark Mode Toggle ===== */
.toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.toggle input {
  width: 40px;
  height: 20px;
  appearance: none;
  background-color: #ccc;
  border-radius: 20px;
  position: relative;
  transition: transform 0.3s;
}

.toggle input:checked {
  background-color: var(--color-accent);
}

.toggle input::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
  top: 2px;
  left: 2px;
  transition: transform 0.3s;
}

.toggle input:checked::before {
  transform: translateX(20px);
}


/* ========================
   Responsive Styles
======================== */

/******** Tablets ********/
@media screen and (max-width: 1023px) {
  .side-bar {
    display: none; /* Hide sidebar on tablets and smaller */
  }

  .side-bar.show-sidebar {
    display: flex !important;
    position: fixed; /* Overlay on top of page */
    height: auto;
  }

  #side-logo-div {
    display: none;
  }

  .logo-mobile {
    display: block;
    width: 30px;
    height: 30px;
    margin-right: 10px;
  }

  body {
    font-size: 0.8rem;
  }

  .board-btn {
    font-size: 0.8rem;
    padding-left: 15px;
    margin-right: 15px;
    font-weight: 700;
  }

  .container {
    padding: 0;
    width: 100%;
    align-items: center; /* Center columns on smaller screens */
  }

  .card-column-main {
    grid-template-columns: repeat(2, minmax(0, 360px));
    gap: 8px;
  }

  header {
    height: 64px;
    padding: 0 10px 0 18px;
    border: none;
  }

  #header-board-name {
    font-size: 1rem;
  }

  .task-div {
    width: 100%;
  }

  .columnHeader {
    font-size: 0.75rem;
  }

  .dot {
    height: 8px;
    width: 8px;
  }

  .column-head-div {
    gap: 8px;
  }

  .column-div {
    width: 100%;
  }
}

/******** Mobile ********/
@media screen and (max-width: 576px) {
  .card-column-main {
    grid-template-columns: minmax(
      0,
      380px
    ); /* Stack columns in single column */
  }

  .column-div {
    padding: 24px;
  }

  #add-new-task-btn {
    font-size: 0;
    padding: 12px;
  }

  #add-new-task-btn::before {
    content: "+";
    font-size: 18px;
    font-weight: 800;
    padding-left: 14px;
    padding-right: 14px;
    padding-top: 0;
    padding-bottom: 0;
  }
}

  #board-btn {
    display: none
  }

  #header-board-name {
    display: none;
  }