* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --transition: 0.3s ease;
  --primary-color: #2575fc;
  --primary-hover: #6a11cb;
  --bg-light: linear-gradient(135deg, #6a11cb, #2575fc);
  --bg-dark: linear-gradient(135deg, #0d1117, #1a2234);
}

body {
  font-family: "Poppins", Arial, sans-serif;
  background: var(--bg-light);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: #222;
  padding: 30px;
  transition: background var(--transition), color var(--transition);
}

.container {
  position: relative;
  background: #ffffff;
  padding: 40px 35px;
  border-radius: 20px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
  width: 100%;
  max-width: 600px;
  text-align: center;
  animation: fadeIn 0.6s ease-out;
  transition: background var(--transition), color var(--transition);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

h1 {
  font-size: 1.8rem;
  margin-bottom: 25px;
  color: #333;
  background: linear-gradient(90deg, #6a11cb, #2575fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

textarea {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  border-radius: 12px;
  border: 2px solid #ddd;
  outline: none;
  resize: vertical;
  transition: all 0.3s ease;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

textarea:focus {
  border-color: #6a11cb;
  box-shadow: 0 0 8px rgba(106, 17, 203, 0.4);
}

.stats {
  margin-top: 25px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 20px;
  text-align: left;
}

.stats p {
  background: #f7f9ff;
  padding: 10px 15px;
  border-radius: 10px;
  font-size: 15px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  transition: background var(--transition), transform var(--transition);
}

.stats span {
  font-weight: bold;
  color: #2575fc;
}

.stats p:hover {
  background: #eef3ff;
  transform: translateY(-2px);
}

.theme-toggle-container {
  position: absolute;
  top: 15px;
  right: 20px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 28px;
  cursor: pointer;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.slider {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  background-color: #ccc;
  border-radius: 34px;
  transition: background-color var(--transition);
}

.slider::before {
  content: "";
  position: absolute;
  height: 22px;
  width: 22px;
  right: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: transform var(--transition);
  z-index: 2;
}

.switch input:checked + .slider {
  background-color: var(--primary-color);
}

.switch input:checked + .slider::before {
  transform: translateX(-32px);
}

.icon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 17px;
  user-select: none;
  z-index: 1;
  transition: opacity var(--transition);
}

.icon.sun {
  left: 10px;
  color: #f39c12;
  opacity: 1;
}

.icon.moon {
  right: 10px;
  color: #f1f2f6;
  opacity: 0;
}

.switch input:checked + .slider .sun {
  opacity: 0;
}
.switch input:checked + .slider .moon {
  opacity: 1;
}

body.dark-mode {
  background: var(--bg-dark);
  color: #eee;
}

body.dark-mode .container {
  background: #1c1f26;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.7);
}

body.dark-mode textarea {
  background: #252b37;
  color: #f1f1f1;
  border-color: #333;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6);
}

body.dark-mode .stats p {
  background: #2a3140;
  color: #ddd;
}

body.dark-mode .stats span {
  color: #7da6ff;
}

body.dark-mode footer {
  background: #0d1117;
  color: #aaa;
}

footer {
  margin-top: 25px;
  background: #eee;
  text-align: center;
  padding: 1rem 1.5rem;
  font-size: 0.9rem;
  color: #555;
  border-radius: 15px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 600px;
  transition: background var(--transition), color var(--transition);
}

@media (max-width: 768px) {
  .container {
    padding: 25px 20px;
  }

  h1 {
    font-size: 1.5rem;
  }

  textarea {
    font-size: 15px;
  }

  .stats {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .stats p {
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  body {
    padding: 15px;
  }

  .container {
    padding: 20px 15px;
  }

  h1 {
    font-size: 1.3rem;
    margin-top: 30px;
  }

  .theme-toggle-container {
    top: 10px;
    right: 10px;
    transform: scale(0.9);
  }
}
