:root {
  --primary-color: #7f49b4;
  --secondary-color: #1668c5;
  --accent-color: #cfcfcf;
  --text-color: #e9d2ef;
  --background-color: #200421;
}
* {
  margin: 0;
  padding: 0;
  transition: all 0.3s ease;
}
i[class*='fa']{
  pointer-events: none;
}
body {
  font-size: 0.9rem;
  background-color: var(--background-color);
  color: var(--text-color);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
header{
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content:space-between;
}
#brand{
  display: flex;
  align-items: center;
}
#brand p {
  font-weight: bolder;
  background-image: linear-gradient(to right, var(--primary-color),var(--secondary-color));
  background-clip: text;
  color: transparent;
}
#brand img {
  width: 30px;
}
#pagesBtns{
  display: flex;
  gap: 20px;
  padding: 0 20px;
}
#pagesBtns a{
  padding: 5px 15px;
  text-decoration: none;
  border-radius: 2px;
}
#pagesBtns a:link,#pagesBtns a:visited{
  background-color: var(--primary-color);
  
  color: var(--text-color);
}
#pagesBtns a:hover{
  background-color: var(--secondary-color);
  color: var(--text-color);
  box-shadow: 0 0 10px var(--secondary-color);
}
hr{
  border: none;
  height: 2px;
  background-color: var(--accent-color);

}

main {
  padding: 20px;
  margin: 0 auto;
}
#currentTime {
  display: block;
  text-align: center;
  font-family: monospace;
  margin-bottom: 20px;
  color: var(--accent-color);
}

#formActions{
    display: flex;
  align-items: center;
  gap: 6px;
  flex-direction: row;
  flex-wrap: nowrap;
}
#formActions input{
    font-size: 0.85rem;
  color: var(--text-color);
  text-shadow: 0 0 10px var(--primary-color);
  background-color: #1668c5;
  padding: 5px 10px;
  border-radius: 5px;
  text-decoration: none;
  opacity: 0.8;
  font-weight: 500;
  transition: all 0.3s ease;
  border: solid;
}
#tableBTnsGeneral {
  display: flex;
  flex-direction: column;
  gap: 25px;
  margin-bottom: 10px;
}

#topBtns, #tableBTns {
  display: flex;
  justify-content: center;
  gap: 10px;
}

/* Button Styling */
.btn, button {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  background-color: var(--primary-color);
  color: white;
}

.btn:hover {
  filter: brightness(1.2);
  transform: translateY(-2px);
}

#addBtn { background-color: #28a745; }
#exportBtn { background-color: var(--secondary-color); }
#tableContainer {
  overflow-x: auto;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: center;
}

th, td {
  padding: 12px;
  border: 1px solid rgba(207, 207, 207, 0.1);
}

#thead th {
  background-color: rgba(127, 73, 180, 0.2);
}
.task {
  font-weight: bold;
  text-align: left;
  width: 50%;
}
tbody th[scope='row']{
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}
.taskActions {
  display: flex;
  gap: 5px;
  margin-top: 5px;
}

.deleteTask, .renameTask {
  padding: 4px 8px;
  font-size: 0.7rem;
}

.deleteTask { background-color: #dc3545; }

/* The checkable cells */
.cellToCheck {
  width: 40px;
  height: 40px;
  cursor: pointer;
  font-size: 1.2rem;
  transition: background 0.2s;
}

.cellToCheck:hover {
  background-color: rgba(255, 255, 255, 0.1);
}
dialog {
  background-color: var(--background-color);
  color: var(--text-color);
  border: 2px solid var(--primary-color);
  border-radius: 8px;
  padding: 20px;
  margin: auto; /* Centers it */
  box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.7);
}

form#taskForm {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

input[type="text"] {
  padding: 8px;
  background: #331034;
  border: 1px solid var(--accent-color);
  color: white;
}
th[colspan="8"] p{
  display: flex;
  width: 100%;
  align-items: center;
  font-size: larger;
  justify-content: center;
  height: 20vh;
}
/* Toast Message */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 15px 25px;
  border-radius: 5px;
  color: white;
  transform: translateY(100px);
  transition: transform 0.3s ease-in-out;
  z-index: 1000;
}
.toast.show {
  transform: translateY(0);
}
footer {
  margin-top: auto; 
  padding: 12px 40px;
  /* Glassmorphism Effect */
  background-color: rgba(22, 4, 23, 0.85); 
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  
  /* Gradient Border for that "Habit Loop" tech feel */
  border-top: 1px solid transparent;
  border-image: linear-gradient(to right, var(--primary-color), var(--secondary-color)) 1;
  
  display: flex;
  flex-direction: row; 
  justify-content: space-around;
  align-items: center;
  gap: 20px;
  z-index: 10;
}

#footerbrand img {
  width: 32px;
  filter: drop-shadow(0 0 8px var(--primary-color));
  transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#footerbrand img:hover {
  transform: rotate(360deg) scale(2); /* Fun little interaction */
}

#footerbrand{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap:15px;
}
.footer-links {
  display: flex;
  gap: 30px;
}

.footer-links a {
  font-size: 0.85rem;
  color: var(--text-color);
  text-shadow: 0 0 10px var(--primary-color);
  background-color: #1668c5;
  padding: 5px 10px;
  border-radius: 5px;
  text-decoration: none;
  opacity: 0.8;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.3s ease;
}

.footer-links a:hover ,#formActions input:hover{
  opacity: 1;
  color: #fff;
  text-shadow: 0 0 10px var(--secondary-color);
  transform: translateY(-1px);
}

.footer-bottom {
  text-align: right;
}

.footer-bottom pre {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.75rem;
  color: var(--accent-color);
  letter-spacing: 0.5px;
}

/* Responsive: Smoother transition for mobile */
@media (max-width: 768px) {
  footer {
    flex-direction: column;
    padding: 20px;
    gap: 15px;
    text-align: center;
    border-image: none;
    border-top: 1px solid var(--primary-color);
  }
  
  .footer-links {
    gap: 20px;
  }
  
  .footer-bottom {
    text-align: center;
  }
}

/* Responsive: Stack it only on very small screens */
@media (max-width: 768px) {
  footer {
    flex-direction: column;
    padding: 20px;
    gap: 15px;
    text-align: center;
  }
  
  .footer-bottom {
    text-align: center;
  }
}

/* Responsive tweak for smaller screens */
@media (max-width: 480px) {
  .footer-links {
    flex-direction: column;
    align-items: center;
    gap: 15px;
  }
}
@media (max-width: 600px) {
  /* 1. Header Adjustments */
  header {
    flex-direction: column;
    gap: 15px;
    text-align: center;
  }

  #pagesBtns {
    width: 100%;
    justify-content: center;
    padding: 0;
  }

  /* 2. Controls & Buttons */
  #topBtns {
    flex-wrap: wrap-reverse;
    flex-direction: row-reverse;
    justify-content: center;
    #addBtn{
      order: 1;
    }
  }

  #topBtns button {
    flex: 1 1 40%; /* Buttons grow to fill space in pairs */
    font-size: 0.8rem;
    padding: 12px 8px; /* Larger touch target */
  }

  #tableBTns {
    gap: 5px;
  }

  .tableBTn {
    padding: 10px 15px;
  }

  /* 3. The Table Grid */
  #tableContainer {
    padding: 5px;
    margin: 0 -10px; /* Bleed to the edges of the screen */
    border-radius: 0;
  }

  th, td {
    padding: 8px 4px;
    font-size: 0.8rem;
  }

  /* Make the Task column sticky so you know what you're checking */
  tbody th[scope='row'],#headTh {
    left: 0;
    background-color: var(--background-color);
    z-index: 2;
    min-width: 100px;
    box-shadow: 2px 0 5px rgba(0,0,0,0.3);
  }

  .task {
    width: 100%;
    font-size: 0.85rem;
  }

  .taskActions {
    width: 100%;
    justify-content: flex-start;
  }

  /* 4. The Dialog (Form) */
  dialog {
    width: 90%;
    padding: 15px;
  }

  #formActions {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  #formActions input {
    width: 100%;
    padding: 12px;
  }
}