/* Variables */
html:root {
  --background-image: url("../img/background-light.webp");
  --sidebar-width: 30rem;
  --white: #fff;
  --black: #343434;
  --primary-color: #45b9f4;
  --secondary-color: #1a7dae;
  --background-color: #e8e8e8;
  --shadow: #e9e9e9;
  --sidebar-color: rgba(255, 255, 255, 0.8);
}

@media (prefers-color-scheme: dark) {
  html:root {
    --background-image: url("../img/background-dark.webp");
    --background-color: #232e30;
    --white: #343434;
    --black: white;
    --shadow: #eee;
    --sidebar-color: rgba(0, 0, 0, 0.8);
  }
}

/* Reset and Global Styles */
* {
  box-sizing: border-box;
  margin: 0;
  -ms-touch-action: manipulation;
  touch-action: manipulation;
}

*:focus {
  outline: none;
}

html {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  font-size: 12px;
}

body {
  background-color: var(--background-color);
  color: var(--black);
  background-image: var(--background-image);
  background-size: cover;
  overflow: hidden;
  font-family: "Roboto", sans-serif;
  letter-spacing: 0.05rem;
}

/* Typography */
h1 {
  font-size: 3rem;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: "Poppins", sans-serif;
  line-height: 4rem;
  letter-spacing: 0.15rem;
}

label {
  display: block;
  margin-bottom: 1rem;
}

label span {
  display: block;
  margin-bottom: 0.75rem;
  font-size: 1.25rem;
}

details summary {
  font-size: 1.5rem;
  font-weight: bold;
  text-transform: uppercase;
  padding: 1rem;
}

details .details-content {
  padding: 1rem;
}

/* Inputs */
input,
textarea,
select {
  width: 100%;
  font-size: 1.1rem;
  padding: 0.75rem 1rem;
  border: 0;
  border-radius: 0.5rem;
  color: var(--black);
  background-color: var(--white);
  height: 4rem;
}

textarea {
  resize: none;
  height: 5rem;
}

/* Buttons */
button {
  font-size: 1.5rem;
  padding: 0.75rem 2rem;
  border-radius: 0.25rem;
  border: 0;
  background-color: #fff0;
  color: var(--black);
  cursor: pointer;
}

button[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
}

.btn-secondary {
  background-color: var(--secondary-color);
  color: white;
}

.btn-danger {
  background-color: orangered;
  color: white;
}

/* Tabs */

.tabs {
  display: flex;
  margin: 1rem 0;
  border-bottom: 0.1rem solid var(--shadow);
}

.tabs .tab {
  cursor: pointer;
  padding: 1rem 2rem;
  background-color: var(--shadow);
  color: var(--white);
  backdrop-filter: blur(1rem);
  -webkit-backdrop-filter: blur(1rem);
  transition: 0.2s ease-in-out;
  text-align: center;
  font-size: 1.75rem;
}

.tabs .tab.active {
  background-color: var(--primary-color);
  color: white;
}

/* Tasks Section */
ul.tasks {
  list-style: none;
  padding-left: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

ul.tasks.grid-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

ul.tasks.grid-layout .task {
  width: auto;
}

ul.tasks.grid-layout li.task .task-content {
  flex-direction: column;
  height: auto;
}

ul.tasks.grid-layout li.task .task-content button {
  display: none;
}

ul.tasks.grid-layout li.task .task-content .task-info {
  width: 100%;
}

ul.tasks.grid-layout li.task .custom-checkbox {
  width: 100%;
}

ul.tasks.grid-layout li.task .custom-checkbox .fill {
  height: 100%;
}

@media (max-width: 50rem) {
  ul.tasks.grid-layout {
    grid-template-columns: 1fr;
  }
}

@keyframes loading {
  0% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0 50%;
  }
}

ul.tasks li.task.lazy {
  background: linear-gradient(90deg, var(--white) 25%, rgba(71, 71, 71, 0.1) 50%, var(--white) 75%);
  background-size: 400% 400%;
  animation: loading 1s ease-in-out infinite;
}

ul.tasks li.task.lazy .task-content {
  opacity: 0.5;
}

ul.tasks li.task .task-content {
  display: flex;
  align-items: center;
  gap: 1rem;
  background-color: var(--white);
  border-radius: 0.5rem;
  padding: 1rem;
  line-height: 1.5rem;
  text-wrap: balance;
  backdrop-filter: blur(1rem);
  -webkit-backdrop-filter: blur(1rem);
}

ul.tasks li.task ul.subtasks {
  margin-top: 1rem;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

ul.tasks li.task .task-icon {
  font-size: 2rem;
}

ul.tasks li.task .task-content.past {
  opacity: 0.5;
  display: none;
}

ul.tasks li.task .task-content .task-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: calc(100% - 12rem);
}

ul.tasks li.task .task-content .task-title {
  font-size: 1.25rem;
  white-space: nowrap;
  text-overflow: ellipsis;
  max-width: 100%;
  overflow: hidden;
}

ul.tasks li.task .task-content .task-date {
  font-size: 0.75rem;
  color: var(--shadow);
  font-style: italic;
  display: flex;
  align-items: center;
}

ul.tasks li.task .task-content input.task-title {
  padding: 0;
  height: 2.5rem;
  background-color: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

ul.tasks li.task .custom-checkbox {
  padding: 0;
  min-width: 2.5rem;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: rgba(255, 255, 255, 0.25);
  border-radius: 0.25rem;
  border: 0.1rem solid;
  position: relative;
}

ul.tasks li.task .custom-checkbox[onclick] {
  cursor: pointer;
}

ul.tasks li.task .custom-checkbox i {
  font-size: 2rem;
}

ul.tasks li.task .custom-checkbox .fill {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: var(--primary-color);
}

ul.tasks li.task .task-content.active .custom-checkbox .fill {
  background-color: var(--secondary-color);
}

ul.tasks li.task .custom-checkbox .percentage {
  font-size: 0.6rem;
  z-index: 1;
  text-shadow: 0 0 0.5rem var(--secondary-color);
}

ul.tasks li.task .task-type-icon {
  padding: 0;
  min-width: 2.5rem;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: var(--primary-color);
  border-radius: 0.25rem;
  border: 0.1rem solid var(--primary-color);
  position: relative;
}

ul.tasks li.task .task-type-icon i {
  font-size: 1.5rem;
  color: var(--white);
}

ul.tasks li.task .task-type-icon .percentage {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.6rem;
  font-weight: bold;
  color: var(--black);
  text-shadow: 0 0 0.2rem rgba(255, 255, 255, 0.8);
  z-index: 1;
}

ul.tasks li.task .task-content button {
  padding: 1rem;
}
ul.tasks li.task .task-content[onclick] {
  cursor: pointer;
}

/* Background Overlay */
.background-overlay {
  background-color: var(--sidebar-color);
  backdrop-filter: blur(1rem);
  -webkit-backdrop-filter: blur(1rem);
  opacity: 1;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Sidebar */
.sidebar .header {
  height: 13rem;
}

.sidebar .header .header-top {
  height: 5rem;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 0 2rem;
}

.sidebar .header .header-top button {
  padding: 0;
}

.sidebar .header .header-bottom {
  height: 8rem;
  display: flex;
  align-items: flex-start;
  padding: 0.5rem 2rem;
}

.sidebar .header .header-bottom h1 {
  line-height: 3rem;
  max-width: 100%;
}

.sidebar .header .header-bottom h1 span {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.sidebar .header .header-bottom h1 span:nth-of-type(2) {
  color: var(--primary-color);
}

.sidebar ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sidebar ul.menu {
  height: calc(100% - 13rem);
  overflow-y: auto;
  padding: 1rem 2rem;
}

.sidebar .active {
  background-color: var(--primary-color) !important;
  color: white;
}

/* Task header */
.task-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  gap: 1rem;
}

.task-header button {
  padding: 0;
}

/* Progress bar */

.progress-bar {
  width: 100%;
  height: 2.5rem;
  min-height: 2.5rem;
  border-radius: 0.5rem;
  background-color: var(--shadow);
  overflow: hidden;
  position: relative;
}

.progress-bar .fill {
  height: 100%;
  background-color: var(--primary-color);
  transition: 1s;
}

.progress-bar .percentage {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--white);
  font-weight: bold;
  font-size: 1.5rem;
}

/* App Layout */
.app {
  display: flex;
  height: 100dvh;
  max-width: 80rem;
  margin: auto;
}

.app.no-sidebar {
  max-width: calc(80rem - var(--sidebar-width));
}

.app .sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  max-width: var(--sidebar-width);
  height: 100%;
  transition: 1s;
}

.app:not(.show-sidebar) .sidebar {
  margin-left: calc(var(--sidebar-width) * -1);
}

.app .main {
  width: 100%;
  height: 100%;
}

.app.show-sidebar .main {
  width: calc(100% - var(--sidebar-width));
  min-width: calc(100% - var(--sidebar-width));
}

.app .main .header {
  height: 5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2rem;
}

.app .main .header button {
  padding: 0 !important;
}

.app .main .header .current-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.app .main .header .current-user .initial {
  width: 2rem;
  height: 2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  background-color: var(--primary-color);
  color: white;
  font-size: 1.25rem;
  cursor: pointer;
}

.app .main .header .current-user .info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.app .main .header .current-user .name {
  font-size: 1.25rem;
}

.app .main .header .current-user .time {
  font-size: 0.75rem;
  font-style: italic;
  text-align: right;
  color: #ccc;
}

.app .main .content {
  padding: 1rem;
  height: calc(100% - 5rem);
  overflow-y: auto;
}

.form-quick-task {
  display: flex;
  gap: 1rem;
  opacity: 0.5;
}

.form-quick-task:hover {
  opacity: 1;
}

.form-quick-task input {
  background-color: var(--white);
}

@media (max-width: 50rem) {
  html {
    font-size: 14px;
  }

  body {
    background-image: none !important;
  }

  .app .main .header {
    display: none;
  }
  .app .main .content {
    height: calc(100% - 7.5rem);
  }

  .app .main .footer {
    height: 7.5rem;
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: var(--white);
    border-top: 0.1rem solid var(--shadow);
  }

  .app .main .footer button {
    opacity: 0.25;
    padding: 1rem;
  }

  .app .main .footer button.center-button,
  .app .main .footer button.active {
    opacity: 1;
    background: var(--primary-color);
    color: white;
  }

  .app .sidebar {
    width: 100dvw;
    min-width: 100dvw;
    max-width: 100dvw;
  }

  .app:not(.show-sidebar) .sidebar {
    margin-left: -100dvw;
  }

  .app .main {
    width: 100dvw;
    min-width: 100dvw;
    max-width: 100dvw;
  }

  .move-task-modal {
    width: 95vw;
    max-height: 85vh;
  }

  .modal-header,
  .search-container,
  .modal-footer {
    padding: 0.75rem;
  }
}

/* Options Modal */

.overlay {
  background-color: var(--sidebar-color);
  backdrop-filter: blur(1rem);
}

.modal {
  border-radius: 0.5rem !important;
}

.modal-options {
  padding: 2rem;
  background-color: transparent !important;
}

.modal-options ul.options {
  list-style: none;
  padding-left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}

.modal-options ul.options li {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

.modal-options ul.options li button {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  border: none;
  padding: 0.5rem;
  border-radius: 0.5rem;
  cursor: pointer;
  width: 100%;
}

.modal-options textarea {
  width: 40rem;
  max-width: calc(100dvw - 2rem);
  height: 20rem;
  border: 0.01rem solid var(--shadow);
  letter-spacing: 0.1rem;
  line-height: 3rem;
  font-size: 1.75rem;
}

/* Fonts */
@font-face {
  font-family: "Poppins";
  src: url("../webfonts/Poppins/Poppins-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
}

@font-face {
  font-family: "Poppins";
  src: url("../webfonts/Poppins/Poppins-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
}

@font-face {
  font-family: "Bebas Neue";
  src: url("../webfonts/BebasNeue/BebasNeue-Regular.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: "Roboto";
  src: url("../webfonts/Roboto/Roboto-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
}

@font-face {
  font-family: "Roboto";
  src: url("../webfonts/Roboto/Roboto-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
}

@font-face {
  font-family: "Roboto";
  src: url("../webfonts/Roboto/Roboto-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
}

.move-task-modal {
  width: 90vw;
  max-width: 500px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 1rem;
  border-bottom: 1px solid var(--shadow);
  background: var(--white);
}

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

.current-task {
  margin: 0;
  color: var(--shadow);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.current-task i {
  color: var(--primary-color);
}

.modal-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  max-height: 60vh;
}

.tree-node.selected {
  background-color: var(--primary-color);
  color: var(--white) !important;
}

.search-container {
  padding: 1rem;
  border-bottom: 1px solid var(--shadow);
  background: var(--white);
}

.search-input-wrapper {
  position: relative;
}

.search-input-wrapper i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--shadow);
}

.search-input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  border: 1px solid var(--shadow);
  border-radius: 6px;
  font-size: 0.9rem;
}

.search-input:focus {
  border-color: var(--primary-color);
}

.tree-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--shadow);
  border-radius: 6px;
  background: var(--white);
}

.root-option {
  padding: 1rem;
  border-bottom: 1px solid var(--shadow);
  background: var(--background-color);
}

.tree-content {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.tree-node {
  margin-bottom: 1px;
}

.node-content {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.expand-btn {
  width: 24px;
  height: 24px;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--shadow);
}

.expand-placeholder {
  width: 24px;
}

.task-selector {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 4px;
  text-align: left;
  min-height: 44px;
}

.task-selector:hover:not(:disabled) {
  background: var(--background-color);
}

.task-selector.selected {
  background: var(--primary-color);
  color: var(--white);
}

.task-selector:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.tree-node.disabled {
  opacity: 0.4;
}

.task-icon {
  width: 16px;
  text-align: center;
}

.task-title {
  flex: 1;
}

.task-type {
  font-size: 0.7rem;
  padding: 0.2rem 0.4rem;
  background: var(--shadow);
  border-radius: 10px;
}

.modal-footer {
  padding: 1rem;
  border-top: 1px solid var(--shadow);
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  background: var(--white);
}

.modal-footer button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: 4px;
}
