/* Modern, Sleek TTS Generator Styles */
* {
  box-sizing: border-box;
}

body {
  background: linear-gradient(135deg, #181c20 0%, #23272e 100%);
  color: #f3f3f3;
  font-family: 'Segoe UI', Arial, sans-serif;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.tts-container {
  background: rgba(36, 41, 54, 0.82);
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-radius: 18px;
  border: 1.5px solid rgba(255, 255, 255, 0.13);
  max-width: 440px;
  width: 100%;
  margin: 0 auto;
  padding: 38px 32px 28px 32px;
  transition: box-shadow 0.2s;
}

.tts-container:hover {
  box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.45);
}

h1 {
  margin-top: 0;
  font-size: 2.1rem;
  font-weight: 700;
  background: linear-gradient(90deg, #7ecfff 30%, #a6ffcb 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-fill-color: transparent;
  text-align: center;
  letter-spacing: 0.5px;
}

label {
  display: block;
  margin-top: 18px;
  margin-bottom: 6px;
  font-size: 1.05rem;
  color: #b7c9d9;
  font-weight: 500;
}

textarea {
  width: 100%;
  min-height: 100px;
  resize: vertical;
  border-radius: 10px;
  border: 1.5px solid #3a4250;
  background: rgba(24, 28, 32, 0.95);
  color: #f3f3f3;
  font-size: 1.12rem;
  padding: 12px;
  margin-bottom: 18px;
  box-sizing: border-box;
  outline: none;
  transition: border 0.18s;
}

textarea:focus {
  border: 1.5px solid #7ecfff;
}

.controls {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.controls select,
.controls input[type="checkbox"] {
  margin-left: 6px;
}

#tts-language {
  background: #23272e;
  color: #f3f3f3;
  border-radius: 7px;
  border: 1.2px solid #3a4250;
  padding: 6px 12px;
  font-size: 1rem;
  transition: border 0.18s;
}

#tts-language:focus {
  border: 1.2px solid #7ecfff;
}

.auto-tts-label {
  display: flex;
  align-items: center;
  font-size: 1rem;
  margin-left: auto;
  color: #b7c9d9;
  font-weight: 500;
  user-select: none;
}

.button-group {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

button {
  background: linear-gradient(90deg, #7ecfff 0%, #a6ffcb 100%);
  color: #181c20;
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(126, 207, 255, 0.08);
  transition: background 0.18s, transform 0.13s;
  outline: none;
  min-width: 80px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

button:active {
  transform: scale(0.97);
}

button:disabled {
  background: #3a4250;
  color: #b7c9d9;
  cursor: not-allowed;
  box-shadow: none;
}

.status {
  min-height: 24px;
  text-align: center;
  font-size: 1.08rem;
  color: #ffb86c;
  margin-top: 10px;
  letter-spacing: 0.1px;
  font-weight: 500;
  transition: color 0.18s;
}

/* Progress bar for segmented TTS (optional, for future use) */
.tts-progress-bar {
  width: 0%;
  height: 5px;
  background: linear-gradient(90deg, #7ecfff 0%, #a6ffcb 100%);
  border-radius: 3px;
  margin: 10px 0 0 0;
  transition: width 0.3s;
  box-shadow: 0 1px 4px rgba(126, 207, 255, 0.12);
  display: none;
}

/* Spinner for download loading */
.spinner {
  display: none;
  margin: 0 auto 8px auto;
  border: 4px solid #e0e0e0;
  border-top: 4px solid #7ecfff;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ============================================
   RESPONSIVE MEDIA QUERIES
   ============================================ */

/* Tablets and smaller desktops (768px and below) */
@media screen and (max-width: 768px) {
  body {
    padding: 12px;
  }

  .tts-container {
    padding: 28px 24px 22px 24px;
    border-radius: 14px;
  }

  h1 {
    font-size: 1.8rem;
  }

  label {
    font-size: 1rem;
    margin-top: 16px;
  }

  textarea {
    font-size: 1.05rem;
    min-height: 90px;
  }

  .controls {
    gap: 10px;
  }

  #tts-language {
    font-size: 0.95rem;
  }

  .auto-tts-label {
    font-size: 0.95rem;
  }

  button {
    padding: 11px 20px;
    font-size: 0.95rem;
  }

  .status {
    font-size: 1rem;
  }
}

/* Mobile phones (480px and below) */
@media screen and (max-width: 480px) {
  body {
    padding: 8px;
  }

  .tts-container {
    padding: 22px 18px 18px 18px;
    border-radius: 12px;
    max-width: 100%;
  }

  h1 {
    font-size: 1.5rem;
    letter-spacing: 0.3px;
  }

  label {
    font-size: 0.95rem;
    margin-top: 14px;
    margin-bottom: 5px;
  }

  textarea {
    font-size: 1rem;
    min-height: 80px;
    padding: 10px;
    margin-bottom: 14px;
  }

  .controls {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 18px;
  }

  .controls select,
  .controls input[type="checkbox"] {
    margin-left: 0;
  }

  #tts-language {
    font-size: 0.9rem;
    padding: 8px 10px;
    width: 100%;
  }

  .auto-tts-label {
    font-size: 0.9rem;
    margin-left: 0;
    justify-content: flex-start;
  }

  .button-group {
    gap: 8px;
    margin-bottom: 14px;
  }

  button {
    padding: 10px 16px;
    font-size: 0.9rem;
    min-width: 70px;
    flex: 1 1 calc(50% - 4px);
  }

  .status {
    font-size: 0.95rem;
    margin-top: 8px;
  }

  .spinner {
    width: 28px;
    height: 28px;
    border-width: 3px;
  }
}

/* Very small phones (360px and below) */
@media screen and (max-width: 360px) {
  .tts-container {
    padding: 18px 14px 14px 14px;
  }

  h1 {
    font-size: 1.3rem;
  }

  label {
    font-size: 0.9rem;
  }

  textarea {
    font-size: 0.95rem;
    padding: 9px;
  }

  button {
    padding: 9px 14px;
    font-size: 0.85rem;
    min-width: 65px;
  }

  .status {
    font-size: 0.9rem;
  }
}

/* Landscape orientation for mobile devices */
@media screen and (max-height: 500px) and (orientation: landscape) {
  body {
    align-items: flex-start;
    padding: 8px;
  }

  .tts-container {
    margin-top: 8px;
    margin-bottom: 8px;
  }

  h1 {
    font-size: 1.4rem;
    margin-bottom: 8px;
  }

  textarea {
    min-height: 60px;
  }

  .button-group {
    margin-bottom: 10px;
  }
}
