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

  /* Status message variables */
  --loading-bg: #e3f2fd;
  --loading-color: #1976d2;
  --loading-border: #bbdefb;
  --error-bg: #ffebee;
  --error-color: #d32f2f;
  --error-border: #ffcdd2;
}

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

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

  /* Dark mode status message variables */
  --loading-bg: #1e3a5f;
  --loading-color: #90caf9;
  --loading-border: #64b5f6;
  --error-bg: #4a1f29;
  --error-color: #f48fb1;
  --error-border: #e57373;

}

body.dark-mode .side-bar-btn,
body.dark-mode .theme-toggle-btn,
body.dark-mode #theme, body.dark-mode #add-new-task-btn{
  background-color: var(--primary-btn-color);
  color: #fff;
}
body.dark-mode .theme-toggle-btn{
  background-color: var(--primary-color);
}
body.dark-mode .slider{
 color:  var(--secondary-color);
} 

/* ================
   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;
  transition: all 0.3s ease-in-out;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1000; /* Ensure sidebar is above main content */
}
.side-bar.hidden {
  transform: translateX(-100%); /* Slide in */
}
.show-sidebar-btn {
  position: fixed;
  bottom: 20px;
  left: 0;
  background-color: var(--primary-btn-color);
  color: var(primary-color);
  border: none;
  border-radius: 0 100px 100px 0;
  padding: 10px 15px;
  font-size: 1.2rem;
  cursor: pointer;
  display: none; /* Hidden by default */
  z-index: 1001; /* Above sidebar */
}
.show-sidebar-btn:hover {
  background-color: #A8A4FF; 
}

.close-sidebar-btn {
  display: none; /* hidden by default */
  background: none;
  border: none;
  font-size: 1.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;
  padding: 20px;
}

/* Show when sidebar is hidden */
.side-bar.hidden ~ .show-sidebar-btn {
  display: block;
}

.sidebar-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between; /* Space between nav links and theme toggle */
}
#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 */
}

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

.boards-header{
  display: flex;
  justify-content: space-between; /* space between text + X */
  align-items: center;
}

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

.theme-toggle-btn {
    position: relative;
    width: 40px;
    height: 20px;
    background-color: var(--primary-btn-color);
    border: none;
    border-radius: 34px;
    cursor: pointer;
    padding: 0;
}

.theme-toggle-btn .slider {
    position: absolute;
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: #ffff;
    border-radius: 50%;
    transition: .4s;
}

body.dark-mode .theme-toggle-btn .slider {
    transform: translateX(20px);
}

#theme{
  background-color: var(--secondary-color);
  height: 48px;
  font-weight: 600;
  gap: 20px;
  margin: 0 20px 0 20px;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  margin-top:420px;
  border-radius: 6px;
}
#hide-sidebar-btn{
  display: flex;
}
.side-bar-btn {
  display: flex;
  align-items: center;
  gap: 30px; /* Space between icon and text */
  border: none;
  background-color: var(--secondary-color);
  color: var(--primary-btn-color);
  border-radius: 0 100px 100px 0; /* Pill shape only on right side */
  height: 48px;
  width: 276px;
  gap: 20px;
  padding: 28px 12px 28px 50px;
  margin-bottom: 20px; ;
  font-size: 0.9375rem;
  cursor: pointer;
  overflow: hidden; /* Prevents overflowed text/icons from showing */
}



/* ===============
   Main Layout
================ */
#layout {
  /*flex: 1; /* Fills remaining space beside sidebar */
  width: 100%;
  min-height: 100vh;
  transition: 0.3s ease-in-out;
}

#layout.with-sidebar {
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
}

/* ===============
   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; 
  margin-bottom: 20px;
  font-size: 0.9375rem;
  font-weight: bold;
}

.priority-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
}

/* Priority colors */
.priority-high {
  background-color: #ea5555; /* red */
}

.priority-medium {
  background-color: #f1c40f; /* yellow */
}

.priority-low {
  background-color: #2ecc71; /* green */
}

/* ===============
   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;
  color: white;
  background-color: var(--primary-color);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  /*font-family: "Plus Jakarta Sans", sans-serif;*/
}

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

.modal-header h3 {
  color: var(--primary-font-color);
  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: var(--secondary-font-color);
}

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-color: var(--primary-color);
  color: var(--primary-font-color);
  background-size: 1.4rem;
  padding-right: 1rem;
}

#add-new-task-btn {
  background-color: var(--primary-btn-color);
  color: var(--primary-color);
  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 {
  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: white;
  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;
}

.button-group {
  display: flex;
  justify-content: space-between;
  gap: 10px;  
  margin-top: 20px;   
}
.button-group button {
  flex: 1; /* Each button takes equal space */  
  padding: 14px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  color: white;
}
#save-task-btn {
  background-color: var(--primary-btn-color);
}
#delete-task-btn {
  background-color: #ea5555; /* Red color for delete */ 
}

/* ========================
   Status Message Styles
======================== */

.status-message {
  padding: 10px;
  margin: 10px 20px;
  border-radius: 4px;
  text-align: center;
  display: none;
  font-weight: 500;
  transition: all 0.3s ease;
}

.status-message.loading {
  display: block;
  background-color: var(--loading-bg);
  color: var(--loading-color);
  border: 1px solid var(--loading-border);
}

.status-message.error {
  display: block;
  background-color: var(--error-bg);
  color: var(--error-color);
  border: 1px solid var(--error-border);
}

.status-message.loading::after {
  content: "...";
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%, 20% { color: rgba(25, 118, 210, 0); }
  40% { color: rgba(25, 118, 210, 1); }
  60%, 100% { color: rgba(25, 118, 210, 0); }
}

body.dark-mode .status-message.loading::after {
  animation: dots-dark 1.5s steps(4, end) infinite;
}

@keyframes dots-dark {
  0%, 20% { color: rgba(144, 202, 249, 0); }
  40% { color: rgba(144, 202, 249, 1); }
  60%, 100% { color: rgba(144, 202, 249, 0); }
}


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

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

  .side-bar.hidden + #layout {
    margin: 0; /* Remove left margin when sidebar is hidden */
  }

  .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: 768px) {
  .header-board-name{
    display: none;
  }

  .side-bar {
    position: fixed;
    top: 12%;
    left: 50%;
    transform: translateX(-50%) scale(0.95);
    width: 85%;
    height: auto;
    max-width: 340px;
    border-radius: 12px;
    background: var(--primary-color);
    z-index: 1002;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
  }

  #theme{
    margin: 20px;
  }

  .side-bar.show-sidebar {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) scale(1);/ /*smooth pop up */
  }

  .sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5); /* Dim background */
    z-index: 1001;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }

  .sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
  }

  .boards-header{
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .close-sidebar-btn {
    display: inline-block;
  }

  .container {
    padding: 0;
    width: 100%;
    align-items: center;
  }

  .logo-mobile{
    width: 25px;
    height: 25px;
    display: block;
    cursor: pointer; 
  }

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

  #hide-sidebar-btn, #show-sidebar-btn {
    display: none;
  }

  .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: 16px;
    font-weight: 800;
    padding-left: 14px;
    padding-right: 14px;
    padding-top: 0;
    padding-bottom: 0;
  }
   /* stack up buttons*/
  .button-group {
    display: flex;
    flex-direction: column;
}
}
