/* Default styles */
html, body {
  font-family: sans-serif;
  height: 100%;
  margin: 0;
  background-color: #f4f4f4;
  overflow-x: hidden;
}
button {
  padding: 10px 15px;
  cursor: pointer;
}
.page-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.content {
  flex: 1;
  display: flex;
  flex-direction: row;
}
.main-content {
  flex: 3;
  padding: 30px;
  padding-top: 15px;
  background-color: #fff;
}
.title-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.language-display-container {
  display: flex;
  align-items: center;
  gap: 5px;
}
.language-display {
  display: none;
  margin-top: 0.1rem;
  font-style: italic;
  color: gray;
}
.sidebar {
  flex: 1;
  padding: 10px;
  background-color: #e8f0fe;
  border-left: 1px solid #ccc;
  transition: flex 0.2s ease, width 0.2s ease;
  max-width: 500px;
}
.sidebar-content {
  padding: 10px;
  opacity: 1;
  display: block;
  transition: opacity 0.3s ease;
}
.sidebar.collapsed {
  flex: 0 0 40px; /* Collapsed width */
  width: 40px;
}
.sidebar.collapsed .sidebar-content {
  opacity: 0;
  display: none;
  pointer-events: none;
}
.language-wrap {
  margin-top: 10px;
  margin-bottom: 10px;
}
.input-with-counter {
  position: relative;
  display: flex;
  align-items: end;
  width: 100%;
}
.input-with-counter input,
.input-with-counter textarea {
  flex: 1;
  padding-right: 50px; /* space for counter */
}
.char-count {
  position: absolute;
  right: 10px;
  bottom: -2px;
  color: #666;
  font-size: 0.85em;
  pointer-events: none;
}
input, select {
  width: 100%;
  margin-bottom: 20px;
  padding: 10px;
  box-sizing: border-box;
}
textarea {
  width: 100%;
  height: 200px;
  resize: vertical;
  margin-bottom: 20px;
  padding: 10px;
  box-sizing: border-box;
  font-family: sans-serif;
}
input, textarea {
  margin-top: 10px;
}
select {
  margin-top: 5px;
}
.textarea-wrap {
  align-items: flex-end; /* aligns counter to bottom right of textarea */
}
.output-group {
  margin-top: 20px;
}
.output, .output-subject {
  flex: 1;
  margin-top: 5px;
  margin-bottom: 5px;
  padding: 12px;
  padding-right: 82px;
  background-color: #e0f7fa;
  border-radius: 6px;
}
.output-subject {
  font-weight: bold;
  background-color: #e0e7ff;
}
.copy-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.copy-button {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  right: 10px;
  padding: 4px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
}
/* .icon-copy {
  width: 18px;
  height: 18px;
}
.icon-check {
  width: 18px;
  height: 18px;
  display: none;
} */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #333;
  color: #fff;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease-in-out;
  z-index: 9999;
}
.toast.show {
  opacity: 1;
  pointer-events: auto;
}
.checkbox-container {
  margin-top: 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center; /* Align at top */
  gap: 1em;              /* Space between checkbox and text */
}
.checkbox-label {
  flex: 1;
  line-height: 1.4;
}
.checkbox {
  width: 1.2em;
  height: 1.2em;
  flex-shrink: 0;
  margin: 0;
}
.tips-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.tips-toggle {
  background-color: none;
  border: none;
  font-size: 1.2em;
  cursor: pointer;
}
.tips-content-container {
  opacity: 1;
  transition: opacity 0.2s ease;
}
.tips-content-container.collapsed {
  opacity: 0;
}


footer {
  text-align: center;
  font-size: 0.9rem;
  color: #777;
  padding: 1em 0;
  border-top: 1px solid #eee;
}
.grecaptcha-badge {
  bottom: 120px !important; /* push it up */
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  height: 25px;
  padding: 1em;
  background-color: #f9f9f9;
  border-bottom: 1px solid #ddd;
  text-align: center;
}
.page-header a {
  text-decoration: none;
  font-weight: bold;
  color: #333;
  margin: 10px;
}
.select-page-language {
  width: auto;
  box-sizing: border-box;
  margin: 10px;
  position: absolute;
  right: 1rem;
}

.content-policy {
  flex: 1;
  padding-left: 20px;
  padding-right: 20px;
  background-color: #fff;
}

.content-contact {
  flex: 1;
  padding-left: 20px;
  padding-right: 20px;
  background-color: #fff;
}
.contact-result {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 1.25rem;
  max-width: 100%;
  width: fit-content;
  transition: opacity 0.3s ease;
}

/* Dark mode styles: auto */ 
@media (prefers-color-scheme: dark) {
  html, body {
    background-color: #202020;
    color: #c2c2c2;
  }
  .main-content {
    background-color: #363636;
  }
  .sidebar {
    background-color: #071733;
    border-left: 1px solid #1c1c1c;
  }
  .char-count {
    color: #a7a7a7;
  }
  .output {
    background-color: #0e273c;
  }
  .output-subject {
    background-color: #0f1c49;
  }
  .copy-button {
    background-color: #303030;
    border: 1px solid #1c1c1c;
    color: #c2c2c2;
  }
  input, textarea, select, button {
    background-color: #2c2c2c;
    color: #c2c2c2;
    border: 1px solid #1c1c1c;
  }
  input:-webkit-autofill,
  input:-webkit-autofill:hover,
  input:-webkit-autofill:focus,
  textarea:-webkit-autofill,
  textarea:-webkit-autofill:hover,
  textarea:-webkit-autofill:focus,
  select:-webkit-autofill,
  select:-webkit-autofill:hover,
  select:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px #2c2c2c inset !important;
    box-shadow: 0 0 0 1000px #2c2c2c inset !important;
    -webkit-text-fill-color: #c2c2c2 !important;
    caret-color: #c2c2c2 !important;
    transition: background-color 5000s ease-in-out 0s;
  }
  .ts-control, .ts-dropdown, .ts-wrapper{
    background-color: #2c2c2c !important;
    color: #c2c2c2 !important;
    border: 1px solid #1c1c1c !important;
  }
  .ts-dropdown .option {
    background-color: transparent;
    color: #c2c2c2;
  }
  .ts-dropdown .option:hover {
    background-color: #4f4f4f;
  }
  .checkbox {
    accent-color: #00918f;
  }
  .tips-toggle {
    background: none;
    border: none;
  }

  footer {
    color: #c2c2c2;
    border-top: 1px solid #1c1c1c;
  }

  /* unvisited link */
  a:link {
    color: lightskyblue;
  }
  /* visited link */
  a:visited {
    color: #6d4b8d;
  }
  /* selected link */
  a:active {
    color: #ff4040;
  }

  .page-header {
  background-color: #202020;
  border-bottom: 1px solid #1c1c1c;
  }
  .page-header a {
    color: #c2c2c2;
  }

  .content-policy {
    background-color: #363636;
  }

  .content-contact {
    background-color: #363636;
  }
}

/* Manual dark mode styles */
html.dark, body.dark {
  background-color: #202020;
  color: #c2c2c2;
}
body.dark .main-content {
  background-color: #363636;
}
body.dark .sidebar {
  background-color: #071733;
  border-left: 1px solid #1c1c1c;
}
body.dark .char-count {
  color: #a7a7a7;
}
body.dark .output {
  background-color: #0e273c;
}
body.dark .output-subject {
  background-color: #0f1c49;
}
body.dark .copy-button {
  background-color: #303030;
  border: 1px solid #1c1c1c;
  color: #c2c2c2;
}
body.dark input, body.dark textarea, body.dark select, body.dark button {
  background-color: #2c2c2c;
  color: #c2c2c2;
  border: 1px solid #1c1c1c;
}
body.dark .ts-control, body.dark .ts-dropdown, body.dark .ts-wrapper{
  background-color: #2c2c2c !important;
  color: #c2c2c2 !important;
  border: 1px solid #1c1c1c !important;
}
body.dark input:-webkit-autofill,
body.dark input:-webkit-autofill:hover,
body.dark input:-webkit-autofill:focus,
body.dark textarea:-webkit-autofill,
body.dark textarea:-webkit-autofill:hover,
body.dark textarea:-webkit-autofill:focus,
body.dark select:-webkit-autofill,
body.dark select:-webkit-autofill:hover,
body.dark select:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px #2c2c2c inset !important;
  box-shadow: 0 0 0 1000px #2c2c2c inset !important;
  -webkit-text-fill-color: #c2c2c2 !important;
  caret-color: #c2c2c2 !important;
  transition: background-color 5000s ease-in-out 0s;
}
body.dark .ts-dropdown .option {
  background-color: transparent;
  color: #c2c2c2;
}
body.dark .ts-dropdown .option:hover {
  background-color: #4f4f4f;
}
body.dark .checkbox {
  accent-color: #00918f;
}
body.dark footer {
  color: #c2c2c2;
  border-top: 1px solid #1c1c1c;
}
body.dark .tips-toggle {
  background: none;
  border: none;
}

/* unvisited link */
body.dark a:link {
    color: lightskyblue;
}
/* visited link */
body.dark a:visited {
  color: #6d4b8d;
}
/* selected link */
body.dark a:active {
  color: #ff4040;
}

body.dark .page-header {
  background-color: #202020;
  border-bottom: 1px solid #1c1c1c;
}
body.dark .page-header a {
  color: #c2c2c2;
}

body.dark .content-policy {
  background-color: #363636;
}
body.dark .content-contact {
  background-color: #363636;
}


/* Manual light mode styles */
html.light, body.light {
  background-color: #f4f4f4;
  color: #333;
}
body.light .main-content {
  background-color: #fff;
}
body.light .sidebar {
  background-color: #e8f0fe;
  border-left: 1px solid #ccc;
}
body.light .char-count {
  color: #666;
}
body.light .output {
  background-color: #e0f7fa;
}
body.light .output-subject {
  background-color: #e0e7ff;
}
body.light .copy-button {
  background-color: #f0f0f0;
  border: 1px solid #ccc;
  color: #333;
}
body.light input, body.light textarea, body.light select, body.light button {
  background-color: #fff;
  color: #333;
  border: 1px solid #ccc;
}
body.light input:-webkit-autofill,
body.light input:-webkit-autofill:hover,
body.light input:-webkit-autofill:focus,
body.light textarea:-webkit-autofill,
body.light textarea:-webkit-autofill:hover,
body.light textarea:-webkit-autofill:focus,
body.light select:-webkit-autofill,
body.light select:-webkit-autofill:hover,
body.light select:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px #fff inset !important;
  box-shadow: 0 0 0 1000px #fff inset !important;
  -webkit-text-fill-color: #333 !important;
  caret-color: #333 !important;
  transition: background-color 5000s ease-in-out 0s;
}
body.light .ts-control, body.light .ts-dropdown, body.light .ts-wrapper{
  background-color: #fff !important;
  color: #333 !important;
  border: 1px solid #ccc !important;
}
body.light .ts-dropdown .option {
  background-color: transparent;
  color: #333;
}
body.light .ts-dropdown .option:hover {
  background-color: #f0f0f0;
}
body.light .checkbox {
  accent-color: #00918f;
}
body.light footer {
  color: #333;
  border-top: 1px solid #ccc;
}
body.light .tips-toggle {
  background: none;
  border: none;
}

/* unvisited link */
body.light a:link {
  color: #00a2ff;
}
/* visited link */
body.light a:visited {
  color: #9802d3;
}
/* selected link */
body.light a:active {
  color: #d400ff;
}

body.light .page-header {
  background-color: #f9f9f9;
  border-bottom: 1px solid #ddd;
}
body.light .page-header a {
  color: #333;
}

body.light .content-policy {
  background-color: #fff;
}
body.light .content-contact {
  background-color: #fff;
}
