/*! HTML5 Boilerplate v9.0.1 | MIT License | https://html5boilerplate.com/ */

/* main.css 3.0.0 | MIT License | https://github.com/h5bp/main.css#readme */
/*
 * What follows is the result of much research on cross-browser styling.
 * Credit left inline and big thanks to Nicolas Gallagher, Jonathan Neal,
 * Kroc Camen, and the H5BP dev community and team.
 */

/* ==========================================================================
   Base styles: opinionated defaults
   ========================================================================== */

html {
  color: #222;
  font-size: 1em;
  line-height: 1.4;
}

/*
 * Remove text-shadow in selection highlight:
 * https://twitter.com/miketaylr/status/12228805301
 *
 * Customize the background color to match your design.
 */

::-moz-selection {
  background: #b3d4fc;
  text-shadow: none;
}

::selection {
  background: #b3d4fc;
  text-shadow: none;
}

/*
 * A better looking default horizontal rule
 */

hr {
  display: block;
  height: 1px;
  border: 0;
  border-top: 1px solid #ccc;
  margin: 1em 0;
  padding: 0;
}

/*
 * Remove the gap between audio, canvas, iframes,
 * images, videos and the bottom of their containers:
 * https://github.com/h5bp/html5-boilerplate/issues/440
 */

audio,
canvas,
iframe,
img,
svg,
video {
  vertical-align: middle;
}

/*
 * Remove default fieldset styles.
 */

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

/*
 * Allow only vertical resizing of textareas.
 */

textarea {
  resize: vertical;
}

/* ==========================================================================
   Author's custom styles
   ========================================================================== */

/* Toxic Land custom styles */
body {
  background-color: #000;
  margin: 0;
  padding: 0;
}

.toxicland-container {
  max-width: 420px;
  margin: 0 auto;
  padding: 32px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(0, 0, 0, 0.9);
  border: 2px solid #00ff00;
  border-radius: 16px;
  box-shadow: 0 0 20px rgba(0, 255, 0, 0.3);
  min-height: 100vh;
  justify-content: center;
}

.toxicland-logo {
  max-width: min(400px, 60%);
  height: auto;
  margin-bottom: 12px;
  display: block;
}

.toxicland-title {
  font-size: 2.2rem;
  font-weight: bold;
  margin-bottom: 12px;
  text-align: center;
  letter-spacing: 2px;
}

.toxicland-subtitle {
  font-size: 1.1rem;
  margin-bottom: 18px;
  text-align: center;
  color: #fff;
}

.toxicland-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
  justify-content: center;
}

.toxicland-lang-select {
  margin-bottom: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toxicland-lang-select select {
  background-color: #333;
  color: #fff;
  border: 1px solid #00ff00;
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 1rem;
}

.toxicland-lang-select select:focus {
  outline: none;
  border-color: #00ff00;
  box-shadow: 0 0 5px rgba(0, 255, 0, 0.5);
}

.toxicland-auth-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}

.google-sign-in-btn, .apple-sign-in-btn {
  background: #333;
  color: #fff;
  border: 1px solid #00ff00;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.google-sign-in-btn:hover, .apple-sign-in-btn:hover {
  background: #444;
  box-shadow: 0 0 5px rgba(0, 255, 0, 0.3);
}

.toxicland-user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #00ff00;
  font-size: 0.9rem;
}

.user-display-name {
  font-weight: bold;
}

.sign-out-btn {
  background: #ff4444;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 0.8rem;
  cursor: pointer;
}

.toxicland-input-area {
  display: flex;
  width: 100%;
  gap: 8px;
  margin-bottom: 12px;
}

.toxicland-textarea {
  flex: 1;
  resize: none;
  border-radius: 8px;
  border: 1px solid #00ff00;
  background-color: #000;
  color: #00ff00;
  padding: 10px;
  font-size: 1rem;
  min-height: 64px;
  max-height: 120px;
  box-sizing: border-box;
  outline: none;
  transition: border 0.2s;
}

.toxicland-textarea:focus {
  border: 2px solid #00ff00;
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
}

.toxicland-textarea::placeholder {
  color: #666;
}

.toxicland-send-btn {
  background: #00ff00;
  color: #000;
  border: none;
  border-radius: 8px;
  padding: 0 18px;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  height: 48px;
}
.toxicland-send-btn:hover {
  background: #00cc00;
}
.toxicland-send-btn:disabled {
  background: #004400;
  cursor: not-allowed;
}

.toxicland-error {
  color: #ff6b6b;
  margin-bottom: 8px;
  font-size: 1rem;
}
.toxicland-success {
  color: #00ff00;
  margin-bottom: 8px;
  font-size: 1rem;
}

.toxicland-hello {
  color: #00ff00;
  font-size: 1.2rem;
  font-weight: bold;
  margin-bottom: 12px;
  text-align: center;
  text-shadow: 0 0 5px rgba(0, 255, 0, 0.3);
}

/* Nick Modal Styles */
.nick-modal {
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
}

.nick-modal-content {
  background: rgba(0, 0, 0, 0.95);
  border: 2px solid #00ff00;
  border-radius: 12px;
  padding: 30px;
  width: 90%;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 0 25px rgba(0, 255, 0, 0.4);
}

.nick-modal-content h2 {
  color: #fff;
  margin-bottom: 20px;
  font-size: 1.8rem;
  letter-spacing: 1px;
}

.nick-input {
  width: 100%;
  padding: 12px;
  border: 1px solid #00ff00;
  border-radius: 8px;
  background-color: #000;
  color: #00ff00;
  font-size: 1rem;
  margin-bottom: 15px;
  box-sizing: border-box;
  outline: none;
  transition: border 0.2s;
}

.nick-input:focus {
  border: 2px solid #00ff00;
  box-shadow: 0 0 8px rgba(0, 255, 0, 0.4);
}

.nick-input::placeholder {
  color: #666;
}

.nick-error {
  color: #ff6b6b;
  margin-bottom: 15px;
  font-size: 0.9rem;
}

.nick-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.nick-ok-btn, .nick-cancel-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}

.nick-ok-btn {
  background: #00ff00;
  color: #000;
}

.nick-ok-btn:hover {
  background: #00cc00;
}

.nick-cancel-btn {
  background: #ff4444;
  color: #fff;
}

.nick-cancel-btn:hover {
  background: #cc3333;
}

/* Nickname warning message */
.nickname-warning {
  background-color: #fff3cd;
  border: 1px solid #ffeaa7;
  color: #856404;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
}

/* Disabled message input */
.message-input.disabled {
  background-color: #f8f9fa;
  color: #6c757d;
  cursor: not-allowed;
  border-color: #dee2e6;
  opacity: 0.6;
}

.message-input.disabled::placeholder {
  color: #adb5bd;
  font-style: italic;
}

/* Disabled analyze button */
.analyze-button:disabled {
  background-color: #e9ecef;
  color: #6c757d;
  cursor: not-allowed;
  border-color: #dee2e6;
  opacity: 0.6;
}

.analyze-button:disabled:hover {
  background-color: #e9ecef;
  transform: none;
  box-shadow: none;
}

/* Profile section styling */
.profile-section {
  margin-top: 1rem;
  padding: 1rem;
  background: rgba(0, 255, 0, 0.05);
  border: 1px solid rgba(0, 255, 0, 0.2);
  border-radius: 8px;
}

.profile-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.profile-buttons {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

.profile-buttons button {
  flex: 1;
  max-width: 150px;
}

.logout-button.secondary {
  background: #666;
  border-color: #999;
  color: #fff;
}

.logout-button.secondary:hover {
  background: #777;
  box-shadow: 0 0 5px rgba(153, 153, 153, 0.3);
}

.profile-error {
  margin-top: 0.5rem;
  padding: 0.75rem;
  background: rgba(255, 68, 68, 0.1);
  border: 1px solid rgba(255, 68, 68, 0.3);
  border-radius: 6px;
  color: #ff4444;
  font-size: 0.9rem;
  text-align: center;
}

/* Nickname availability styles */
.profile-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}

.nick-input {
  padding: 10px;
  border: 2px solid #444;
  border-radius: 5px;
  background: #222;
  color: #fff;
  font-size: 16px;
}

.nick-availability {
  position: absolute;
  right: 15px;
  top: 12px;
  font-size: 14px;
  font-weight: bold;
  pointer-events: none;
  z-index: 10;
}

.nick-availability.available {
  color: #4CAF50;
}

.nick-availability.taken {
  color: #f44336;
}

.nick-availability.checking {
  color: #ff9800;
}

.profile-buttons {
  display: flex;
  gap: 10px;
}

@media (max-width: 600px) {
  .toxicland-container {
    max-width: 100vw;
    padding: 16px 4px;
    border-radius: 0;
    min-height: 100vh;
  }
  .toxicland-title {
    font-size: 1.5rem;
  }
  .toxicland-subtitle {
    font-size: 1rem;
  }
  .toxicland-controls {
    flex-direction: column;
    gap: 12px;
  }
  .toxicland-input-area {
    flex-direction: column;
    gap: 6px;
  }
  .toxicland-send-btn {
    width: 100%;
    height: 44px;
    font-size: 1.2rem;
  }
  .google-sign-in-btn, .apple-sign-in-btn {
    font-size: 0.8rem;
    padding: 6px 10px;
  }
  .nick-modal-content {
    padding: 20px;
    width: 95%;
  }

  .nick-modal-content h2 {
    font-size: 1.4rem;
  }

  .nick-buttons {
    flex-direction: column;
    gap: 8px;
  }

  .nick-ok-btn, .nick-cancel-btn {
    width: 100%;
  }
}

/* AI Results Styles */
.ai-results {
  background: rgba(0, 20, 0, 0.9);
  border: 1px solid #00ff00;
  border-radius: 8px;
  padding: 15px;
  margin-top: 12px;
  color: #fff;
}

.ai-results h3 {
  color: #00ff00;
  margin: 0 0 10px 0;
  font-size: 1rem;
  text-align: center;
}

.ai-results ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.ai-results li {
  background: rgba(0, 255, 0, 0.1);
  padding: 5px 8px;
  border-radius: 4px;
  font-size: 0.9rem;
  text-align: center;
}

@media (max-width: 600px) {
  .ai-results ul {
    grid-template-columns: 1fr;
  }
}

/* Character counter styling */
.character-counter {
  font-size: 12px;
  color: #666;
  text-align: right;
  margin-top: 5px;
  margin-bottom: 10px;
}

.character-counter.near-limit {
  color: #ff9800;
}

.character-counter.at-limit {
  color: #f44336;
  font-weight: bold;
}

/* ==========================================================================
   Helper classes
   ========================================================================== */

/*
 * Hide visually and from screen readers
 */

.hidden,
[hidden] {
  display: none !important;
}

/*
 * Hide only visually, but have it available for screen readers:
 * https://snook.ca/archives/html_and_css/hiding-content-for-accessibility
 *
 * 1. For long content, line feeds are not interpreted as spaces and small width
 *    causes content to wrap 1 word per line:
 *    https://medium.com/@jessebeach/beware-smushed-off-screen-accessible-text-5952a4c2cbfe
 */

.visually-hidden {
  border: 0;
  clip: rect(0, 0, 0, 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
  /* 1 */
}

/*
 * Extends the .visually-hidden class to allow the element
 * to be focusable when navigated to via the keyboard:
 * https://www.drupal.org/node/897638
 */

.visually-hidden.focusable:active,
.visually-hidden.focusable:focus {
  clip: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  position: static;
  white-space: inherit;
  width: auto;
}

/*
 * Hide visually and from screen readers, but maintain layout
 */

.invisible {
  visibility: hidden;
}

/*
 * Clearfix: contain floats
 *
 * The use of `table` rather than `block` is only necessary if using
 * `::before` to contain the top-margins of child elements.
 */

.clearfix::before,
.clearfix::after {
  content: "";
  display: table;
}

.clearfix::after {
  clear: both;
}

/* ==========================================================================
   EXAMPLE Media Queries for Responsive Design.
   These examples override the primary ('mobile first') styles.
   Modify as content requires.
   ========================================================================== */

@media only screen and (min-width: 35em) {
  /* Style adjustments for viewports that meet the condition */
}

@media print,
  (-webkit-min-device-pixel-ratio: 1.25),
  (min-resolution: 1.25dppx),
  (min-resolution: 120dpi) {
  /* Style adjustments for high resolution devices */
}

/* ==========================================================================
   Print styles.
   Inlined to avoid the additional HTTP request:
   https://www.phpied.com/delay-loading-your-print-css/
   ========================================================================== */

@media print {
  *,
  *::before,
  *::after {
    background: #fff !important;
    color: #000 !important;
    /* Black prints faster */
    box-shadow: none !important;
    text-shadow: none !important;
  }

  a,
  a:visited {
    text-decoration: underline;
  }

  a[href]::after {
    content: " (" attr(href) ")";
  }

  abbr[title]::after {
    content: " (" attr(title) ")";
  }

  /*
   * Don't show links that are fragment identifiers,
   * or use the `javascript:` pseudo protocol
   */
  a[href^="#"]::after,
  a[href^="javascript:"]::after {
    content: "";
  }

  pre {
    white-space: pre-wrap !important;
  }

  pre,
  blockquote {
    border: 1px solid #999;
    page-break-inside: avoid;
  }

  tr,
  img {
    page-break-inside: avoid;
  }

  p,
  h2,
  h3 {
    orphans: 3;
    widows: 3;
  }

  h2,
  h3 {
    page-break-after: avoid;
  }
}
