/* Default styles */
html, body {
  /* font-family: sans-serif; */
  height: 100%;
  margin: 0;
  background-color: #f4f4f4;
  overflow-x: hidden;
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Roboto", "Arial";
}
button {
  padding: 10px 15px;
  cursor: pointer;
  border-radius: 10px;
  transition: 
    transform 0.5s ease,
    background 0.5s ease,
    border 0.5s ease;
}
summary {
  cursor: pointer;
}
i {
  transition: color 0.5s ease;
}
.full-page {
  flex: 1;
  display: flex;
  flex-direction: row;
}
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  z-index: 9;
}
.page-container {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  min-height: 100vh;
}
.main-content {
  flex: 3;
  padding: 15px 30px;
  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 {
  background-color: #b4f2ff;
  border-left: 1px solid #ccc;
  /* transition: flex 0.2s ease, width 0.2s ease, transform 0.2s ease; */
  min-height: 100vh;
  overflow-y: hidden;
  z-index: 10;
  transform: translateX(100%);
  max-width: 300px;
  min-width: 0px;
  width: 0px;
}
.sidebar.show {
  transform: translateX(0);
  flex: 1;
  min-width: 300px;
  overflow-y: auto;
}
.sidebar-content {
  padding: 16px;
  display: none;
}
.sidebar.show .sidebar-content {
  display: block;
}
.sidebar-header {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  height: 27.2px;
}
.sidebar-close {
  position: absolute;
  left: 0;
  align-items: center;
  cursor: pointer;
}
.bar-close-1 {
  width: 35px;
  height: 3px;
  background-color: #333;
  margin: 8px 0;
  transform: rotate(19deg);
}
.bar-close-2 {
  width: 35px;
  height: 3px;
  background-color: #333;
  margin: 8px 0;
  transform: rotate(-19deg);
}
.settings-title {
  text-align: center;
  justify-self: left;
}
.theme-container {
  display: block;
  width: 100%;
}
.theme-button {
  width: 100%;
  text-align: left;
}
.language-wrap {
  margin-top: 10px;
  margin-bottom: 10px;
}
.menu-item {
  padding: 10px;
  margin: 10px;
  cursor: pointer;
  border-radius: 10px;
  transition: background 0.5s ease;
}
#menu-item-home {
  margin-top: 20px;
}
.menu-item a {
  font-weight: bold;
  text-decoration: none;
  cursor: pointer;
}

.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 {
  display: inline-block;
  position: absolute;
  right: 10px;
  bottom: -2px;
  width: 80px;
  text-align: right;
  color: #666;
  font-size: 0.85em;
  pointer-events: none;
}
input, select {
  width: 100%;
  margin-bottom: 20px;
  padding: 10px;
  box-sizing: border-box;
  border-radius: 10px;
}
textarea {
  width: 100%;
  height: 125px;
  min-height: 125px;
  max-height: 400px;
  resize: none;
  margin-bottom: 20px;
  padding: 10px;
  box-sizing: border-box;
  font-family: sans-serif;
  border-radius: 10px;
}
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: 10px;
  padding-right: 105px;
  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: 2rem;
  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: 0.5em 75px;
  border-top: 1px solid #eee;
}
.footer-content {
  margin: 1em 0;
}
.grecaptcha-badge {
  z-index: 20;
  bottom: 20px !important; /* push it up */
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 25px;
  padding: 1em;
  background-color: #f9f9f9;
  border-bottom: 1px solid #ddd;
}
.page-header a {
  text-decoration: none;
  font-weight: bold;
  color: #333;
  margin: 10px;
}
.header-left {
  display: flex;
  align-items: center;
  margin-right: 20px;
  gap: 10px;
}
.header-right {
  display: flex;
  align-items: center;
  margin-left: 20px;
  gap: 20px;
}
.header-center {
  flex: 1;
  display: flex;
  max-width: 600px;
}
.header-center .dropdown {
  flex: 1;
  text-align: center;
  position: relative;
  padding: 10px;
  cursor: pointer;
  border-radius: 10px;
  transition: background 0.5s ease;
}
.dropdown a {
  text-decoration: none;
  padding: 10px;
  cursor: pointer;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.select-page-language {
  flex: 2;
  width: auto;
  box-sizing: border-box;
  margin: 5px;
}
.settings-icon {
  flex: 1;
  align-items: center;
  cursor: pointer;
  margin: 5px;
  transition: 0.3s;
  opacity: 1;
}
.settings-icon.hide {
  opacity: 0;
  pointer-events: none;
}
.menu-icon {
  flex: 1;
  align-items: center;
  cursor: pointer;
  margin: 5px;
  transition: 0.3s;
  opacity: 1;
  display: none;
}
.menu-icon.hide {
  opacity: 0;
  pointer-events: none;
  display: none;
}
.bar1, .bar2, .bar3 {
  width: 35px;
  height: 4px;
  background-color: #333;
  margin: 8px 0;
  transition: 0.3s;
}
.bar1.active {
  opacity: 0;
}
.bar2.active {
  opacity: 0;
}
.bar3.active {
  opacity: 0;
}
.ts-dropdown .option {
  transition: background 0.5s ease;
}

.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;
}

/* 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 .bar-close-1, body.dark .bar-close-2 {
  background-color: #c2c2c2;
}
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;
  border-radius: 10px !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 .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, body.dark .menu-item a {
  color: #c2c2c2;
}
body.dark .settings-icon {
  content: url("/icons/settings-icon-dark.svg");
  width: 40px;
  height: 40px;
}
body.dark .bar1, body.dark .bar2, body.dark .bar3 {
  background-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: #b4f2ff;
  border-left: 1px solid #ccc;
}
body.light .bar-close-1, body.light .bar-close-2 {
  background-color: #333;
}
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;
  border-radius: 10px !important; 
}
body.light .ts-dropdown .option {
  background-color: transparent;
  color: #333;
}
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: #0000EE;
}
/* visited link */
body.light a:visited {
  color: #551A8B;
}
/* selected link */
body.light a:active {
  color: #FF0000;
}

body.light .page-header {
  background-color: #f9f9f9;
  border-bottom: 1px solid #ddd;
}
body.light .page-header a, body.light .menu-item a {
  color: #333;
}
body.light .settings-icon {
  content: url("/icons/settings-icon.svg");
  width: 40px;
  height: 40px;
}
body.light .bar1, body.light .bar2, body.light .bar3 {
  background-color: #333;
}

body.light .content-policy {
  background-color: #fff;
}
body.light .content-contact {
  background-color: #fff;
}

@media (max-width: 1034px) {
  .header-title {
    display: block;
  }
  .header-title.sidebar-open {
    display: none;
  }
}

@media (max-width: 876px) {
  .header-title {
    display: block;
  }
  .header-title.sidebar-open {
    display: block;
  }

  .header-center {
    display: none;
  }

  .menu-icon {
    opacity: 1;
    cursor: pointer;
    display: block;
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0;
  }

  .overlay.show {
    display: block;
  }
}

@media (max-width: 535px) {
  .header-title {
    display: none;
  }
  .header-title.sidebar-open {
    display: none;
  }
}

/* Only enable hover effects on mouse devices */
@media (hover: hover) and (pointer: fine) {
  button#rewriteButton:hover {
    transform: translateY(-5px);
  }

  .menu-item:hover {
    background: #d3f8ff;
  }
  .dropdown:hover {
    background: #b4f2ff;
  }

  body.dark button:hover, body.dark select:hover, body.dark .ts-control:hover {
    background-color: #1c1c1c !important;
    border-color: #0c0c0c !important;
  }
  body.dark button#rewriteButton:hover {
    background-color: #071733 !important;
  }
  body.dark i:hover {
    color: #525252;
  }
  body.dark .ts-dropdown .option:hover {
    background-color: #4f4f4f;
  }
  body.dark .menu-item:hover {
    background: #0d2247;
  }
  body.dark .dropdown:hover {
    background: #071733;
  }

  body.light button:hover, body.light select:hover, body.light .ts-control:hover {
    background-color: #ddd !important;
    border-color: #bbb !important;
  }
  body.light button#rewriteButton:hover {
    background-color: #b4f2ff !important;
    border-color: #071733 !important;
  }
  body.light i:hover {
    color: #bbb
  }
  body.light .ts-dropdown .option:hover {
    background-color: #f0f0f0;
  }
  body.light .menu-item:hover {
    background: #d3f8ff;
  }
  body.light .dropdown:hover {
    background: #b4f2ff;
  }
}
