/*
  Project: Write For Me — Beta 4
  File: style.css
  Version Date: 2025-07-05 (Consolidated with all features & Mobile Responsive, with Replay Icons)
*/

body {
  font-family: 'Open Sans', sans-serif;
  background: linear-gradient(135deg, #1c1c2b, #2e2e48);
  color: #eee;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  overflow-x: hidden;
  padding-bottom: 60px; /* Space for the fixed footer */
}

.container {
  text-align: center;
  max-width: 600px;
  padding: 20px;
  width: 90%;
  box-sizing: border-box;
  margin: 20px auto;
}

h1 {
  font-family: 'Playfair Display', serif;
  color: #a0f0ff;
  margin-bottom: 20px;
  font-size: 2.2em;
}

/* Wrapper for input field to position speaker icon */
.input-field-wrapper {
  position: relative;
  width: 100%;
  margin-bottom: 10px;
  box-sizing: border-box;
}

textarea {
  width: 100%;
  height: 150px;
  font-size: 1em;
  padding: 10px 40px 10px 10px; /* Add right padding for icon */
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  color: #fff;
  border: 1px solid #ccc;
  box-sizing: border-box;
  resize: vertical;
}

select, button {
  font-size: 1em;
  padding: 10px;
  margin: 5px;
  border-radius: 6px;
  background-color: #4a4a6b;
  color: #fff;
  border: none;
  cursor: pointer;
  transition: background-color 0.3s ease;
  width: calc(50% - 10px);
  box-sizing: border-box;
}

button {
    width: 100%; /* Speak button takes full width on mobile */
}

select:hover, button:hover {
  background-color: #6a6a8b;
}

/* Speaker Icon Styling */
.speaker-icon {
  display: inline-block;
  width: auto;
  position: absolute;
  bottom: -0.5em; /* Vertically center */
  right: 0em;
  transform: translateY(-50%); /* Adjust for perfect centering */
  background: none;
  border: none;
  font-size: 1.5em;
  cursor: pointer;
  color: #a0f0ff;
  padding: 5px;
  line-height: 1; /* Helps vertically align emoji */
  opacity: 0.8;
  transition: opacity 0.2s ease;
  z-index: 5; /* Ensure it's above text area/result box content */
}

.speaker-icon:hover {
  opacity: 1;
}

#replayInputBtn { display: inline-block; }
#replayOutputBtn{ display: inline-block; top: -0.5em; }

/* Wrapper for output field to position speaker icon */
.output-field-wrapper {
    position: relative;
    width: 100%;
    margin: 15px auto; /* Combines result-box margin here */
    box-sizing: border-box;
}

/* Styling for the rewritten message display box */
.result-box {
  padding: 15px 40px 15px 15px; /* Add right padding for icon */
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid #666;
  border-radius: 10px;
  max-width: 100%;
  word-wrap: break-word;
  text-align: left;
  line-height: 1.6;
  font-size: 1.05em;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  box-sizing: border-box;
}

/* Adjust speaker icon for output field */
.output-field-wrapper .speaker-icon {
    top: 15px; /* Adjust top for result-box's internal padding */
    transform: none; /* No vertical transform needed if top is fixed */
}


.result-box strong {
  color: #a0f0ff;
  font-weight: bold;
}

/* Specific styling based on voice */
.result-box.voice-fable {
  font-family: 'Playfair Display', serif;
  font-size: 1.1em;
  color: #e0d0ff;
  border-color: #8a2be2;
  background: rgba(138, 43, 226, 0.1);
}

.result-box.voice-shimmer {
  color: #ffe0b3;
  border-color: #ffd700;
  background: rgba(255, 215, 0, 0.1);
}

.result-box.voice-nova {
  color: #a0f0ff;
  border-color: #00bcd4;
  background: rgba(0, 188, 212, 0.08);
}

/* Visualizer specific styles */
canvas {
  display: block;
  margin: 20px auto;
  background: rgba(0,0,0,0.2);
  border: 1px solid #555;
  border-radius: 8px;
  width: 90%;
  max-width: 500px;
  box-sizing: border-box;
}

/* Footer Styles */
footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  color: #aaa;
  font-size: 0.8em;
  padding: 10px 0;
  text-align: center;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
  z-index: 100;
  box-sizing: border-box;
}

footer a {
  color: #06a6c2;
  text-decoration: none;
  transition: color 0.3s ease;
}
footer a:hover {
 color: #00d9ff;
  text-decoration: underline;
}
/* Media Queries for Mobile Responsiveness */
@media (max-width: 600px) {
  h1 {
    font-size: 1.8em;
  }

  select, button {
    width: 100%;
    margin: 5px 0;
  }

  .container {
    width: 95%;
    padding: 15px;
  }

  .speaker-icon {
    font-size: 1.2em;
    right: 5px;
    padding: 3px;
  }
  textarea {
    padding-right: 35px; /* Adjust right padding for mobile icon */
  }
  .result-box {
    padding-right: 35px; /* Adjust right padding for mobile icon */
  }
  .output-field-wrapper .speaker-icon {
      top: 10px; /* Smaller top adjustment for mobile */
  }
}

@media (max-width: 400px) {
  h1 {
    font-size: 1.5em;
  }
}
/* #styles {
  displat: block
  text-align: center;
} */
#styles div {
  display: flex;
  width: 45%;
  padding: 10px;
  /* border: 1px solid #444; */
  float: left;
}

#speakBtn {
  background-color: #006e0f;
}
#speakBtn:hover {
  background-color: #00a416;
}}




/* FREQENCY LABELS */

.frequency-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  color: #ccc;
  font-size: 0.75em;
  width: 90%;
  max-width: 500px;
  box-sizing: border-box;
}

.frequency-labels span {
  text-align: center;
  flex: 1;
}

/* CUSTOM TOOLTIP */

.custom-tooltip {
  position: absolute;
  background: rgba(30, 30, 40, 0.95);
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.75em;
  pointer-events: none;
  z-index: 999;
  box-shadow: 0 0 10px rgba(0,0,0,0.5);
  display: none;
  line-height: 1.4;
}
 .frequency-labels {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0;
  margin-top: 8px;
  color: #ccc;
  font-size: 0.75em;
  width: 90%;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
  box-sizing: border-box;
}
.frequency-labels {
  position: relative;
  top: -20px; /* Adjust to align with the visualizer */
}
#resultOutput {
  cursor: pointer;
  transition: background 0.2s ease;
}

#resultOutput:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* HISTORY LIST */

.history-list {
  margin-top: 10px;
  padding: 10px;
  max-height: 200px;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  border: 1px solid #444;
  font-size: 0.85em;
  color: #ccc;
  box-shadow: inset 0 0 6px rgba(0,0,0,0.2);
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding: 6px 8px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.history-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.history-text {
  flex: 1;
  margin-right: 10px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.history-replay {
  font-size: 1.2em;
  color: #a0f0ff;
  cursor: pointer;
  opacity: 0.75;
  transition: opacity 0.2s ease;
}

.history-replay:hover {
  opacity: 1;
}
