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

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

.dark-mode {
  --primary-color: #2b2c37;
  --secondary-color: #20212c;
  --sidebar-btn-color: #635fc7;
  --sidebar-text-color: #fff;
  --primary-font-color: #ffffff;
  --secondary-font-color: #828fa3;
  --primary-box-shadow: 0px 4px 6px rgba(54, 78, 126, 0.1015);
}

/* ================
   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 */

  position: relative;
}

/* ================
   Modal Styling
================ */
.task-modal-container {
  display: none;
  position: fixed;

  z-index: 1;
  left: 0;
  top: 0;

  width: 100%;
  height: 100%;

  background-color: rgba(0, 0, 0, 0.5);
  border: none;
}

.task-modal-content {
  background-color: var(--primary-color);

  margin: 15% auto;
  padding: 1.5rem;
  border-radius: 0.375rem;

  max-width: 31.25rem;
  width: 90%;

  position: relative;
}

.task-modal-content h2 {
  font-size: 1.125rem;
  font-weight: 700;

  margin-bottom: 1.5rem;
}

.modal-close-btn {
  color: #ea5555;
  font-size: 1.875rem;
  font-weight: bold;

  position: absolute;
  top: 0.25rem;
  right: 1.1875rem;
}

.modal-close-btn:hover {
  cursor: pointer;
  color: #cf3a3a;
}

label {
  color: var(--secondary-font-color);

  font-size: 0.75rem;
  font-weight: 700;

  margin-bottom: 0.5rem;
}

.task-modal-form {
  display: flex;
  flex-direction: column;
}

.task-title-input {
  resize: none;

  align-content: center;

  font-size: 0.8125rem;
  font-weight: 500;
  font-family: inherit;

  padding: 0.5rem;
  margin-bottom: 1.5rem;

  min-height: 2.5rem;

  border: 1px solid #828fa340;
  border-radius: 0.25rem;
}

.task-description-input {
  resize: none;

  font-size: 0.8125rem;
  font-weight: 500;
  font-family: inherit;

  padding: 0.5rem;
  margin-bottom: 1.5rem;

  min-height: 7rem;

  border: 1px solid #828fa340;
  border-radius: 0.25rem;
}

.task-title-input:focus,
.task-description-input:focus {
  outline-color: var(--secondary-font-color);
}

.task-title-input::placeholder,
.task-description-input::placeholder {
  color: #00000050;
}

select,
::picker(select) {
  appearance: base-select;
}

select {
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: inherit;

  padding: 0.625rem;

  min-height: 2.5rem;

  border: 1px solid #828fa340;
  border-radius: 4px;
  background-color: #fff;
}

select.task-status-input {
  margin-bottom: 1.5rem;
}

#add-task-form select {
  margin-bottom: 1.5rem;
}

select::picker-icon {
  color: var(--secondary-font-color);
}

::picker(select) {
  border: none;
  border-radius: 0.5rem;

  box-shadow: var(--primary-box-shadow);

  top: calc(anchor(top) + 40px);
}

option {
  margin: 0.5rem 0 0.5rem 0.5rem;
}

option:not(option:checked) {
  color: var(--secondary-font-color);
}

option::checkmark {
  display: none;
}

select:hover,
option:hover {
  background: #f4f7fd;
}

.create-task-btn {
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1.4375rem;
  color: #fff;

  background: #635fc7;

  border: none;
  border-radius: 1.25rem;

  padding: 0.5625rem;
}

.create-task-btn:hover {
  cursor: pointer;
  background: #4a48c2;
}

.task-btn-container {
  margin-top: 1.5rem;

  display: flex;
  justify-content: space-between;
}

.save-changes-btn,
.delete-task-btn {
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1.4375rem;

  color: #fff;

  border: none;
  border-radius: 1.25rem;
}

.save-changes-btn {
  background: #635fc7;

  padding: 0.625rem 3.5rem;
}

.delete-task-btn {
  background: #ea5555;

  padding: 0.625rem 4.0313rem;
}

.save-changes-btn:hover {
  cursor: pointer;

  background-color: #4a48c2;
}

.delete-task-btn:hover {
  cursor: pointer;

  background-color: #e64141;
}

.title-error,
.description-error {
  display: none;
  position: absolute;

  background: var(--primary-color);
  color: var(--secondary-font-color);

  font-size: 0.8125rem;
  font-family: inherit;
  font-weight: 500;

  padding: 1rem 1.125rem;
  border-radius: 0.5rem;

  box-shadow: 0 10px 20px #364e7e40;
}

.title-error {
  top: 8.25rem;
  left: 6.25rem;
}

.description-error {
  top: 18.125rem;
  left: 6.25rem;
}

.delete-confirm-container {
  display: none;
  position: absolute;

  z-index: 1;
  left: 0;
  top: 0;

  width: 100%;
  height: 100%;

  background-color: rgba(0, 0, 0, 0.5);
  border-radius: 0.375rem;
}

.delete-confirm-content {
  margin: 25% 9%;
  color: var(--primary-font-color);

  background: var(--primary-color);
  box-shadow: 0 10px 20px #2c416d75;

  padding: 2rem 3rem;
  border-radius: 24px;
}

.confirm-btn-container {
  display: flex;
  justify-content: space-between;
}

.confirm-btn,
.cancel-btn {
  font-family: inherit;
  font-weight: 700;
  font-size: 0.8125rem;

  color: #fff;

  border: none;
  border-radius: 1.5rem;

  padding: 0.5rem 1.5rem;
}

.confirm-btn {
  background: #635fc7;
}

.cancel-btn {
  background: #ea5555;
}

.confirm-btn:hover {
  cursor: pointer;

  background-color: #4a48c2;
}

.cancel-btn:hover {
  cursor: pointer;

  background-color: #e64141;
}

.boards-nav-links-div .modal-close-btn {
  display: none;
}

/* ================
   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;
}

#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 */
  height: 1.97rem;
}

.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: #635fc7;
  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 */
}

.sidebar-container {
  display: flex;
  justify-content: flex-end;
  flex-direction: column;

  padding-bottom: 1rem;

  height: 100%;
}

.board-hide-btn {
  position: relative;
  font-family: inherit;
  display: flex;
  align-items: center;
  background-color: var(--sidebar-btn-color);
  color: var(--sidebar-text-color);
  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 */
}

.board-hide-btn img {
  position: absolute;
  left: 1.5rem;
}

.board-hide-btn span {
  transform: translateX(2.5rem);
}

.board-show-btn {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  margin-bottom: 1rem;
  font-size: 1.5rem;
  background-color: #a8a4ff;
  border: none;
  border-radius: 0 6.25rem 6.25rem 0;
  padding: 0.75rem 0.75rem 0.75rem 0.5rem;
  cursor: pointer;
}

/* Light/Dark mode Toggle button */

.mode-switch-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.375rem;

  background: var(--sidebar-btn-color);
  padding: 0.625rem 1.25rem;

  border-radius: 0.375rem;

  width: 15.6875rem;
  height: 3rem;

  margin-left: 1rem;
  margin-top: 1rem;

  margin-bottom: 0.875rem;
}

.mode-toggle-label {
  position: absolute;
  opacity: 0;
  top: -10000px;
  left: -10000px;
}

.mode-toggle {
  appearance: none;

  position: relative;

  width: 2.5rem;
  height: 1.25rem;

  background-color: #635fc7;

  border-radius: 0.75rem;
  cursor: pointer;
}

.mode-toggle::before {
  content: "";
  position: absolute;
  top: 0.1875rem;
  left: 0.3125rem;

  width: 0.875rem;
  height: 0.875rem;

  border-radius: 50%;
  background-color: #fff;
  transition: 0.2s ease;
}

.mode-toggle:checked::before {
  transform: translateX(125%);
  transition: 0.2s ease;
}

.mode-toggle:checked {
  background-color: #20212c;
}

/* ===============
   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 */
}

.add-task-btn {
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 700;
  color: #fff;
  background: #635fc7;

  padding: 0.9375rem 1.5625rem;
  margin-right: 0.625rem;

  border: none;
  border-radius: 1.5rem;
}

.add-task-btn:hover {
  cursor: pointer;
  background: #4a48c2;
}

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

  position: relative;
}

.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;
}

/* Loading and Error Messages */

.loading-container {
  display: none;
  position: fixed;

  z-index: 1;

  text-align: center;

  margin: 15% 20%;

  background: var(--primary-color);
  color: var(--primary-font-color);
  padding: 0.5rem 2rem;
  border-radius: 1.5rem;

  font-weight: 700;
}

.loading-spin {
  display: inline-block;

  transform-origin: 50% 54%;

  animation: loading-cycle 1.5s infinite linear;
}

@keyframes loading-cycle {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.visible {
  display: block;
}

.hidden {
  display: none;
}

/* ===============
   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;
}

.priority-icon {
  margin: 0 1rem 0 auto;
  padding-left: .25rem;
}

/* ===============
   Headings
================ */
h2 {
  color: var(--primary-font-color);
  font-size: 1.5rem;
  margin: 0;
}

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

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

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

    z-index: 1;
    margin-top: 4.125rem;
    margin-left: 2rem;
    
    border-radius: .5rem;
    border-right: none;
  }

  .side-bar-backdrop.show-sidebar {
    position: fixed;

    width: 100%;
    height: 100%;
    z-index: 1;

    background-color: #00000050;

    

    margin-top: 4.125rem;
  }

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

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

  .board-hide-btn {
    display: none;
  }

  .boards-nav-links-div .modal-close-btn {
    display: block;
  }

  .mode-switch-container {
    margin-left: 0;
    margin-bottom: .3rem;
    align-self: center;
  }

  h4 {
    margin-top: 1.5rem;
    margin-left: 1rem;
  }

  body {
    font-size: 0.8rem;
  }

  .board-btn {
    font-size: .9375rem;
    justify-content: center;
    width: 18.5rem;
    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%;
  }

  .add-task-btn {
    padding: 0.625rem 1.25rem;

    font-size: 0.8rem;
  }

  .delete-confirm-content {
    font-size: 1rem;
  }
}

/******** 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;
  }

  .task-modal-content {
    margin: 25% auto;
  }

  .add-task-btn {
    padding: 5px 11.7px 9px 11.7px;

    font-size: 0.9375rem;
  }

  .add-task-btn .add-task-text {
    display: none;
  }

  .task-btn-container {
    flex-direction: column;
    gap: 1rem;
  }

  .confirm-btn-container {
    flex-direction: column;
    gap: 0.5rem;
  }
}

@media screen and (max-width: 426px) {
    .side-bar.show-sidebar {
    width: 90%;

    margin-left: 1.25rem;
  }

  .mode-switch-container {
    width: 65%;
  }

  .board-btn{
    width: 85%;
  }
}

@media screen and (max-width: 344px) {
  .side-bar.show-sidebar{
    margin-left: 1rem;
  }
}
