:root {
  /* Pink Sky Theme */
  --primary-color: #ff85a2; /* Vibrant Pink */
  --bg-color: #ffeaf1; /* Soft Pink Background */
  --light-bg-color: #ffffff; /* White Clouds */
  --text-color: #5c3c4c; /* Dark Mauve */
  --light-text-color: #a38a96; /* Muted Mauve */
  --primary-text-color: #ffffff; /* White */
  --transition-speed: 0.3s;
}

::-webkit-scrollbar {
  width: 5px;
}

::-webkit-scrollbar-track {
  border-radius: 30px;
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  border-radius: 30px;
  background: var(--primary-color);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--bg-color);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Gill Sans", "Gill Sans MT", Calibri, "Trebuchet MS", sans-serif;
}

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-color);
  background-color: var(--bg-color);
  transition: background-color var(--transition-speed) ease,
    color var(--transition-speed) ease;
}

body.dark {
  /* Neon Crimson Theme (Slightly Dark) */
  --primary-color: #ff004d; /* Neon Crimson */
  --bg-color: #41353a; /* Slightly Dark Mauve */
  --light-bg-color: #5c4b51; /* Darker Mauve for cards */
  --text-color: #f0f0f0; /* Off-white */
  --light-text-color: #a9a9a9; /* Muted Gray */
  --primary-text-color: #ffffff; /* White for text on primary buttons */

  text-shadow: 0 0 2px rgba(255, 0, 77, 0.5);
}

.container {
  position: relative;
  width: 1200px;
  padding: 0 20px;
  display: flex;
  gap: 10px;
}

.container .card {
  flex: 1;
  padding: 30px;
  border-radius: 20px;
  background-color: var(--light-bg-color);
  transition: background-color var(--transition-speed) ease,
    border-color var(--transition-speed) ease;
}

.container .card .from,
.container .card .to {
  display: flex;
  align-items: center;
  gap: 20px;
}

.container .card .from {
  margin-right: 20px;
}

.container .card .to {
  margin-left: 20px;
}

.container .card .heading {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-color);
  white-space: nowrap;
}

.dropdown-container {
  position: relative;
  margin-bottom: 10px;
  width: 100%;
}

.dropdown-container .dropdown-toggle {
  display: flex;
  align-items: center;
  padding: 15px 20px;
  border-radius: 30px;
  background-color: var(--bg-color);
  cursor: pointer;
  transition: all var(--transition-speed) ease;
  color: var(--text-color);
}

.dropdown-container .dropdown-toggle span {
  flex: 1;
  margin-left: 10px;
}

.dropdown-container .dropdown-toggle ion-icon {
  font-size: 20px;
  transition: transform var(--transition-speed) ease;
}

.dropdown-container.active .dropdown-toggle {
  border-radius: 20px 20px 0 0;
}

.dropdown-container.active .dropdown-toggle ion-icon:last-child {
  transform: rotate(180deg);
}

.dropdown-container .dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  height: 300px;
  overflow: auto;
  display: none;
  padding: 20px;
  z-index: 1;
  list-style: none;
  flex-direction: column;
  background-color: var(--bg-color);
  transition: opacity var(--transition-speed) ease,
    transform var(--transition-speed) ease;
  border-radius: 0 0 20px 20px;
}

.dropdown-container .dropdown-menu::-webkit-scrollbar {
  display: none;
}

.dropdown-container.active .dropdown-menu {
  display: flex;
}

.dropdown-container .dropdown-menu li {
  padding: 10px 20px;
  border-radius: 20px;
  cursor: pointer;
  margin-bottom: 5px;
  border-bottom: 1px solid var(--light-bg-color);
  transition: all var(--transition-speed) ease;
}

.dropdown-container .dropdown-menu li:hover {
  background-color: var(--light-bg-color);
}
.dropdown-container .dropdown-menu li.active {
  color: var(--primary-text-color);
  background-color: var(--primary-color);
  box-shadow: 0 0 5px var(--primary-color);
}

.container .text-area {
  position: relative;
}

.container textarea {
  width: 100%;
  padding: 20px;
  margin: 10px 0;
  background-color: transparent;
  resize: none;
  outline: none;
  border: none;
  color: var(--text-color);
  font-size: 20px;
  transition: color var(--transition-speed) ease;
}

.container textarea::placeholder {
  color: var(--light-text-color);
}

.container textarea:disabled {
  /* Ensure disabled text color matches the theme, overriding browser defaults */
  color: var(--text-color);
  -webkit-text-fill-color: var(--text-color); /* Override for WebKit browsers */
  opacity: 1; /* Reset browser-applied opacity */
}

.container .text-area .chars {
  position: absolute;
  bottom: 0;
  right: 0;
  padding: 10px;
  font-size: 0.8rem;
  color: var(--light-text-color);
}

.card-bottom {
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  padding-top: 20px;
  border-top: 1px solid var(--bg-color);
  transition: border-color var(--transition-speed) ease;
}

.card-bottom p {
  margin-bottom: 20px;
}

/* --- Shared styles for bottom buttons/labels --- */
.card-bottom label,
.card-bottom button {
  height: 50px;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 20px;
  border-radius: 30px;
  border: none;
  outline: none;
  cursor: pointer;
  color: var(--text-color);
  background-color: var(--bg-color);
  font-size: 15px;
  transition: all var(--transition-speed) ease;
}

.card-bottom label:hover,
.card-bottom button:hover {
  color: var(--primary-text-color);
  background-color: var(--primary-color);
  box-shadow: 0 0 10px var(--primary-color);
}

.card-bottom span {
  pointer-events: none; /* Ensure clicking the text triggers the parent label/button */
}

.card-bottom ion-icon {
  font-size: 22px;
}

.container .center {
  position: relative;
}

.swap-position {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 30px;
  left: 50%;
  transform: translateX(-50%);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid var(--bg-color);
  transition: all var(--transition-speed) ease;
  color: var(--primary-text-color);
  background-color: var(--primary-color);
  box-shadow: 0 0 10px var(--primary-color);
}

.swap-position ion-icon {
  font-size: 25px;
}

.swap-position:hover {
  transform: translateX(-50%) scale(1.1);
  box-shadow: 0 0 20px var(--primary-color), 0 0 30px var(--primary-color);
}

.mode {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1;
}

.toggle {
  position: relative;
  cursor: pointer;
}

.toggle-track {
  width: 50px;
  height: 30px;
  border-radius: 30px;
  display: flex;
  align-items: center;
  flex-direction: row;
  padding: 0 3px;
  justify-content: space-between;
  /* Make toggle more visible */
  background-color: var(--light-bg-color);
  border: 1px solid var(--light-text-color);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  transition: all var(--transition-speed) ease;
}

.toggle-track:hover {
  border-color: var(--primary-color);
}

.toggle-checkbox {
  display: none;
}

.toggle-thumb {
  position: absolute;
  top: 2.5px;
  left: 2.5px;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background-color: var(--primary-color);
  transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55),
    background-color var(--transition-speed) ease;
}

.toggle input:checked ~ .toggle-thumb {
  transform: translateX(20px);
}

.toggle img {
  width: 20px;
  height: 20px;
  transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55),
    filter var(--transition-speed) ease;
  /* Add a drop shadow for visibility in light mode without changing icon color */
  filter: drop-shadow(0 0 2px var(--text-color));
}

/* --- Icon Animation States --- */

/* Light Mode: Inactive moon is scaled down */
.toggle-track img:last-of-type {
  transform: scale(0.6);
}

/* Dark Mode: Inactive sun is scaled down and light gray */
.toggle input:checked ~ img:first-of-type {
  transform: scale(0.6);
  filter: grayscale(1) brightness(1.5);
}

/* Dark Mode: Active moon gets color back and animates */
.toggle input:checked ~ img:last-of-type {
  transform: scale(1) rotate(360deg);
  filter: none;
}

/* --- Accessibility Focus Styles --- */
.dropdown-container .dropdown-toggle:focus-visible,
.card-bottom label:focus-visible,
.card-bottom button:focus-visible,
.swap-position:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 3px;
}

/* Cyberpunk focus style */
body.dark .dropdown-container .dropdown-toggle:focus-visible,
body.dark .card-bottom label:focus-visible,
body.dark .card-bottom button:focus-visible,
body.dark .swap-position:focus-visible {
  outline: none;
  box-shadow: 0 0 10px var(--primary-color), 0 0 0 2px var(--light-bg-color),
    0 0 0 4px var(--primary-color);
}

/* Media Querries */

@media (max-width: 800px) {
  .container {
    width: 100%;
    margin-top: 20px;
    flex-direction: column;
  }

  .container .card {
    width: 100%;
  }

  .container .card .from {
    margin-right: 0;
  }

  .container .card .to {
    margin-left: 0;
  }

  .container .card .from,
  .container .card .to {
    flex-direction: column;
  }

  .swap-position {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }

  .swap-position:hover {
    transform: translate(-50%, -50%) scale(1.1);
  }

  .swap-position ion-icon {
    transform: rotate(90deg);
  }
}
