* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: Poppins, sans-serif;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: Poppins, sans-serif;
  background: lightblue;
  margin: 0;
  padding: 0;
}

body.dark {
  background: #121212;
  color: #f1f1f1;
}

body.dark header {
  background: linear-gradient(135deg, #232526, #414345);
}

body.dark .note {
  background: #1e1e1e;
  color: white;
}

body.dark textarea,
body.dark input {
  background: #2a2a2a;
  color: white;
  border: 1px solid #555;
}

body.dark .search {
  background: #2a2a2a;
  color: white;
  border: 1px solid #555;
}

body.dark .edit {
  background: #444;
  color: white;
}

body.dark .delete {
  background: #b71c1c;
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #4141b7, #0d2a80);
  color: white;
  padding: 15px 40px;
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.logo {
  font-size: 28px;
  letter-spacing: 2px;
}

.nav-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.nav-btn {
  text-decoration: none;
  border: none;
  padding: 12px 28px;
  border-radius: 40px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.3s;
  background: #0f172a;
  color: white;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.container {
  width: 95%;
  max-width: 900px;
  margin: 30px auto;
  padding: 0 10px;
}

.note-input {
  position: relative;
  display: flex;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.note-input textarea {
  flex: 1;
  padding: 15px;
  padding-bottom: 25px;
  border-radius: 12px;
  border: 1px solid #ccc;
  resize: none;
  outline: none;
  font-size: 15px;
  min-height: 90px;
  max-height: 200px;
}

.note-input textarea:focus {
  border-color: #4caf50;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.note-input button {
  padding: 0 25px;
  border: none;
  border-radius: 20px;
  background: linear-gradient(135deg, #8e2de2, #4a00e0);
  color: white;
  font-weight: bold;
  min-height: 45px;
  cursor: pointer;
}

.note-input button:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

.note-timestamp {
  display: block;
  font-size: 12px;
  color: #333;
  margin-top: 6px;
  font-weight: 700;
}

body.dark .note-timestamp {
  color: #ccc;
}

input,
textarea {
  padding: 10px;
  width: 100%;
  border: 1px solid #ccc;
  border-radius: 10px;
  font-size: 15px;
}

#charCount {
  position: relative;
  display: block;
  text-align: right;
  font-size: 15px;
  bottom: 30px;
  color: gray;
  margin-top: 4px;
  align-self: flex-end;
  pointer-events: none;
}

button {
  padding: 0px 25px;
  border: none;
  background: blueviolet;
  background: linear-gradient(135deg, #8e2de2, #d230d2);
  color: white;
  font-family: Poppins;
  font-weight: 700;
  border-radius: 20px;
  cursor: pointer;
}

button:hover {
  background: #e4ce0d;
}

.note {
  background: linear-gradient(135deg, #f4f4f5, #0d2a80);
  border-radius: 20px;
  padding: 20px;
  margin-top: 20px;
  color: #000;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.15);
  font-weight: 700;
  justify-content: space-between;
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  border-left: 8px solid darkblue;
  border-right: 8px solid darkblue;
  transition: 0.3s;
}

.note:hover {
  transform: translateY(-2px);
}

.note-actions {
  flex-wrap: wrap;
  margin-top: 15px;
  display: flex;
  gap: 5px;
}

#noteCategory {
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #ccc;
  background: white;
  color: black;
  cursor: pointer;
  font-weight: 700;
}

body.dark #noteCategory {
  background: #2b2b2b;
  color: white;
  border: 1px solid #555;
}

body.dark select option {
  background: #2b2b2b;
  color: white;
  font-weight: 700;
}

.delete {
  background: red;
  border: none;
  border-radius: 20px;
  padding: 8px 18px;
  cursor: pointer;
  font-weight: 700;
}

.edit {
  background: #eee;
  color: black;
  border: none;
  border-radius: 20px;
  padding: 8px 18px;
  cursor: pointer;
  font-weight: 700;
}

.edit:hover {
  background: #ddd;
}

.delete:hover {
  background: #cc0000;
}

.search {
  width: 100%;
  margin-bottom: 15px;
  padding: 14px;
  border-radius: 10px;
  border: 1px solid #ccc;
  outline: none;
  font-size: 15px;
}

.search:focus {
  border-color: #3e4db3;
  box-shadow: 0 0 8px rgba(76, 175, 80, 0.3);
}

#themeToggle {
  background: #0b0220;
  color: white;
  padding: 12px 26px;
  border-radius: 40px;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 700;
}

#themeToggle:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  transition: 0.3s;
}

#themeToggle:active {
  transform: scale(0.95);
  box-shadow: 0 3px 4px rgba(0, 0, 0, 0.3);
}

body.dark #themeToggle {
  background: linear-gradient(135deg, #fffefe, #343232);
  color: #fff;
}

.note-input select,
#categoryFilter {
  padding: 10px;
  border-radius: 12px;
  border: 1px solid #ccc;
  font-size: 14px;
  outline: none;
}

.note p strong {
  color: #fff;
  background: #4caf50;
  padding: 2px 8px;
  border-radius: 8px;
  margin-right: 5px;
  font-weight: 700;
}

.popup-error {
  color: white;
  font-size: 14px;
  font-weight: 600;
  margin-top: 5px;
  position: fixed;
  bottom: 25px;
  right: 25px;
  background: #ff4d4f;
  padding: 12px 20px;
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  z-index: 999;
}

.popup-error.show {
  opacity: 1;
  transform: translateY(0);
}

body.dark .popup-error {
  background: #b71c1c;
}

.popup-success {
  position: fixed;
  bottom: 25px;
  right: 25px;
  background: #4caf50;
  color: white;
  padding: 12px 20px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  z-index: 999;
}

.popup-success.show {
  opacity: 1;
  transform: translateY(0);
}

.note.pinned {
  border: 2px solid gold;
  background: linear-gradient(135deg, #fff9c4, #ffe082);
  box-shadow: 0 8px 20px rgba(255, 193, 7, 0.35);
  position: relative;
  transform: scale(1.02);
  transition: 0.3s ease;
}

.note.pinned::before {
  content: "📌";
  position: absolute;
  top: -10px;
  right: -10px;
  background: gold;
  color: black;
  font-size: 14px;
  padding: 6px 8px;
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.note.pinned:hover {
  transform: scale(1.05);
  box-shadow: 0 12px 30px rgba(255, 193, 7, 0.5);
}

body.dark .note.pinned {
  background: linear-gradient(135deg, #5c4d00, #7a6500);
  border-color: #ffd700;
  box-shadow: 0 8px 20px rgba(255, 215, 0, 0.25);
  color: #fff;
}

.note-actions .pin {
  background: linear-gradient(135deg, #ffd700, #ffbf00);
  color: black;
  font-weight: 700;
  border: none;
  border-radius: 20px;
  padding: 8px 18px;
  cursor: pointer;
  transition: all 0.3 ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.note-actions .pin:hover {
  background: linear-gradient(135deg, #ffe066, #ffcc33);
  transform: scale(1.05);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

.trash-btn {
  position: relative;
  text-decoration: none;
  background: blue;
  color: white;
  padding: 12px 24px;
  border-radius: 40px;
  font-weight: 700;
  border: none;
  white-space: nowrap;
  display: inline-block;
}

.trash-btn:hover {
  background: white;
  color: black;
  transform: translateY(-2px);
}

body.dark .trash-btn {
  background: #f1f1f1;
  color: #111;
  box-shadow: 0 6px 15px rgba(255, 255, 255, 0.2);
}

body.dark .trash-btn:hover {
  background: blue;
  color: #000;
}

.badge {
  background: red;
  color: white;
  font-size: 12px;
  padding: 2px 7px;
  border-radius: 50%;
  margin-left: 6px;
}

body.dark .badge {
  background: red;
  color: white;
  box-shadow: 0 6px 15px rgba(255, 255, 255, 0.2);
}

@media (max-width: 600px) {
  #themeToggle {
    top: 10px;
    right: 10px;
    padding: 6px 12px;
    font-size: 12px;
  }

  .note {
    flex-direction: column;
    align-items: flex-start;
  }
  .note-input button {
    width: 100%;
    flex-direction: column;
  }
}
