*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

li {
  list-style: none;
}

:root {
  --light-gray: #f8f9fa;
  --black: #111;
  --white: #fff;

  --background: var(--light-gray);
  --text-color: var(var(--black));
  --background-secondary: var(--white);
  --border-color: #e4e7eb;

  --border-radius: 16px;

  --pending: #ff9f00;
  --danger: #cb0404;
  --success: #a0c878;
}

body {
  background-color: var(--background);
  color: var(--text-color);
  font-family: "Josefin Sans", sans-serif;
  font-optical-sizing: auto;
  font-weight: 400;
  font-style: normal;
}

.app {
  padding: 1rem;
}

.app__container {
  max-width: 960px;
  margin: auto;
}

.navbar {
  background-color: var(--background-secondary);
  padding: 1rem 1rem;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  margin-bottom: 2rem;
}

.navbar__logo {
  font-size: 1rem;
  text-decoration: none;
  color: var(--text-color);
  font-weight: bold;
}

.habit,
.streak {
  background-color: var(--background-secondary);
  padding: 2rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
}

.habit__title {
  font-size: 1.5rem;
  text-align: center;
  margin-bottom: 2rem;
}

.habit__list {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  margin-bottom: 2rem;
}

.habit__list > li {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.habit__list > li > button {
  appearance: none;
  border: none;
  background-color: transparent;
  margin-bottom: 12px;
  padding: 8px;
  border-radius: 50%;
}

.habit__list img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.habit__form div {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 1rem;
}

.habit__form input {
  border-radius: 6px;
  border: 1px solid var(--border-color);
  padding: 1rem;
}
.habit__form button {
  width: 100%;
  background-color: #222831;
  color: #fff;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  border: 1px solid #111;
  transition: background 0.3s ease-in;
  cursor: pointer;
}

.habit__form button:hover {
  background-color: #555;
}

.streak {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
}

.streak__icon {
  font-size: 32px;
  font-weight: 800;
}

.streak__days {
  font-size: 32px;
  font-weight: 800;
}

.streak__count {
  font-size: 12px;
}

.history {
  padding: 2rem 0rem;
}
.history__title {
  margin-bottom: 1rem;
  font-size: 24px;
}

.history__card {
  background-color: var(--background-secondary);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.history__card--content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history__card--content h3 {
  margin-right: 8px;
  line-height: 1.8;
  font-weight: 500;
  font-size: 15px;
}

.history__card--content span {
  margin-right: 4px;
}

.history__card--actions {
  display: flex;
  gap: 8px;
}

.history__card--actions button {
  border: none;
  outline: 0;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s ease-in;
}

.history__card--actions button > svg {
  width: 14px;
  height: 14px;
}

.pen-icon {
  color: #0c497f;
}

.pen-icon-btn {
  background-color: #c1e4ff;
}
.pen-icon-btn:hover {
  background-color: #d3e9f9;
}

.trash-icon {
  color: #cb0404;
}

.trash-icon-btn {
  background-color: #ffcccc;
}
.trash-icon-btn:hover {
  background-color: #fbd3d3;
}

.ellipsis-icon {
  color: #111;
}

.ellipsis-icon-btn {
  background-color: var(--background);
}

.ellipsis-icon-btn:hover {
  background-color: #eee;
}

.habit-card__content {
  display: flex;
  flex-direction: column;
  justify-content: start;
  gap: 2px;
}

.habit-card-activity {
  padding: 4px 6px;
  border-radius: 8px;
  background-color: #afddff;
  color: var(--text-color);
  font-size: 12px;
  line-height: 1.4;
}

.status-card {
  padding: 4px 6px;
  border-radius: 8px;
  background-color: var(--pending);
  color: #fff;
  font-size: 12px;
  line-height: 1.4;
}

.status-todo {
  background-color: var(--danger);
}

.status-progress {
  background-color: var(--pending);
}

.status-completed {
  background-color: var(--success);
}

.container {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.analytics {
  margin-top: 2rem;
  display: flex;
  flex-direction: column-reverse;
  gap: 2rem;
}

.insights {
  background-color: #fff;
  padding: 2rem 1rem;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
}

.insights__title {
  margin-bottom: 1rem;
}

.insights__list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.insights__item {
  border: 1px solid var(--border-color);
  padding: 1rem 1rem;
  display: flex;

  justify-content: space-between;
  align-items: start;
  gap: 8px;
  border-radius: 8px;
}

.insights__item > div {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.insights__item h4 {
  font-size: 32px;
}

.insights__item p {
  font-size: 14px;
  color: #555;
}

.ellipsis-oneline {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1; /* number of lines */
  overflow: hidden;
}

.large-screen {
  display: none;
}

.small-screen {
  display: inline-block;
}

.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  bottom: 100%; /* Position above the button */
  right: 0;
  margin-bottom: 4px;
  background: white;
  border: 1px solid #ccc;
  padding: 0;
  list-style: none;
  min-width: 160px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  z-index: 100;
}

.dropdown-menu.hidden {
  display: none;
}

.dropdown-item {
  padding: 10px 16px;
  cursor: pointer;
}

.dropdown-item:hover {
  background-color: #f0f0f0;
}

.selected {
  background-color: #fbf3c1 !important;
}

.habits__empty {
  margin: auto;
  background-color: #fff;
  padding: 4rem 1rem;
  text-align: center;
  color: #333;
}

.hidden {
  display: none;
}

.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: #323232;
  color: white;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-size: 0.9rem;
  opacity: 0;
  transition: opacity 0.3s ease, bottom 0.3s ease;
  z-index: 9999;
}

.toast.visible {
  opacity: 1;
  bottom: 2.5rem;
}

.toast--error {
  background: var(--danger);
}

.toast--success {
  background: var(--success);
}

/* Tablet Mode */
@media screen and (min-width: 768px) {
  .app {
    padding: 2rem;
  }

  .container,
  .analytics {
    display: grid;
    grid-template-columns: 1fr 320px;
  }

  .insights {
    align-self: start;
  }

  .large-screen {
    display: block;
  }

  .small-screen {
    display: none;
  }

  .dropdown-menu {
    top: 100%;
    bottom: auto;
    left: 0;
  }

  .habit-card-activity {
    font-size: 12px;
    background-color: #afddff;
    border-radius: 4px;
    padding: 2px 4px;
    text-align: center;
    align-self: flex-start;
  }
}

/* Desktop Mode */
@media screen and (min-width: 1024px) {
}
