/* DictaCraft CSS - Pink Theme */

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  background: linear-gradient(135deg, #fdf2f8, #fce4ec);
  min-height: 100vh;
  color: #2d2d2d;
  line-height: 1.6;
}

.container {
  max-width: 1000px;
  margin: 20px auto;
  background: #ffffff;
  box-shadow: 0 8px 32px rgba(244, 143, 177, 0.1);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid #fce4ec;
}

/* Header */
header {
  background: linear-gradient(135deg, #f48fb1, #ec407a);
  color: #ffffff;
  padding: 24px;
  text-align: center;
  position: relative;
}

header h1 {
  font-size: 2.2rem;
  font-weight: 400;
  margin: 0;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Toolbar */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px;
  background: linear-gradient(135deg, #fdf2f8, #fce4ec);
  border-bottom: 1px solid #f8bbd9;
  align-items: center;
}

.toolbar .group-label {
  font-weight: 600;
  color: #880e4f;
  font-size: 0.9rem;
  margin-right: 8px;
}

.toolbar button,
.toolbar select,
.toolbar input {
  background: linear-gradient(135deg, #f48fb1, #ec407a);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(244, 143, 177, 0.25);
}

.toolbar button:hover:not(:disabled),
.toolbar select:hover,
.toolbar input:hover {
  background: linear-gradient(135deg, #ec407a, #e91e63);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(244, 143, 177, 0.35);
}

.toolbar button:disabled {
  background: #e0e0e0;
  color: #9e9e9e;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.toolbar button.loading {
  position: relative;
  color: transparent;
}

.toolbar button.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid #fff;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Input Areas */
.input-section {
  padding: 20px;
  position: relative;
}

.input-label {
  font-size: 1.1rem;
  font-weight: 600;
  color: #880e4f;
  margin-bottom: 12px;
  display: block;
}

textarea {
  width: 100%;
  min-height: 140px;
  padding: 16px;
  border: 2px solid #f8bbd9;
  border-radius: 12px;
  font-size: 16px;
  font-family: inherit;
  background: #fefefe;
  color: #2d2d2d;
  resize: vertical;
  transition: border-color 0.3s ease;
}

textarea:focus {
  outline: none;
  border-color: #f48fb1;
  box-shadow: 0 0 0 3px rgba(244, 143, 177, 0.1);
}

.word-count {
  position: absolute;
  bottom: 24px;
  right: 24px;
  font-size: 0.85rem;
  color: #666;
  background: rgba(255, 255, 255, 0.9);
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid #f48fb1;
}

.word-count.warning {
  color: #f57c00;
  border-color: #ff9800;
}

.word-count.error {
  color: #d32f2f;
  border-color: #f44336;
}

/* Copy Button */
.copy-btn {
  position: absolute;
  top: 50px;
  right: 24px;
  background: #f48fb1;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10;
}

.copy-btn:hover {
  background: #ec407a;
  transform: scale(1.05);
}

.copy-btn.success {
  background: #4caf50;
}

.copy-btn.error {
  background: #f44336;
}

/* Passage Display */
.passage-section {
  padding: 0 20px 20px;
}

#passageDisplay,
.passage-display {
  background: #fefefe;
  border: 2px solid #f8bbd9;
  border-radius: 12px;
  padding: 20px;
  min-height: 120px;
  line-height: 1.8;
  font-size: 1.05rem;
  user-select: none;
  color: #2d2d2d;
}

#passageDisplay:empty::before {
  content: "Your rendered passage will appear here. Click on words to select them for creating fill-in-the-blank exercises.";
  color: #999;
  font-style: italic;
  user-select: none;
  pointer-events: none;
}

#passageDisplay .word {
  display: inline;
  margin: 0 1px;
  padding: 2px 4px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

#passageDisplay .word:hover {
  background: #fce4ec;
}

#passageDisplay .word.selected {
  background: #f48fb1;
  color: #ffffff;
  font-weight: 500;
}

/* Conversion Options */
.conversion-section {
  padding: 20px;
  background: #fefefe;
  border-top: 1px solid #f8bbd9;
}

.conversion-options {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: stretch;
}

.print-format-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: 140px;
}

.print-format-group select {
  background: linear-gradient(135deg, #fce4ec, #f8bbd9);
  color: #666;
  border: 1px solid #f8bbd9;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.85rem;
  cursor: pointer;
}

/* Word Bank Options */
.wordbank-options {
  margin-top: 16px;
  padding: 12px;
  background: #fefefe;
  border-radius: 8px;
  border: 1px solid #f8bbd9;
}

.checkbox-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 0.9rem;
  color: #666;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  margin-right: 8px;
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #f48fb1;
}

.checkbox-label:hover {
  color: #f48fb1;
}

.conversion-options button {
  flex: 1;
  min-width: 120px;
  background: linear-gradient(135deg, #f8bbd9, #f48fb1);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
}

.conversion-options button:hover {
  background: linear-gradient(135deg, #f48fb1, #ec407a);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(244, 143, 177, 0.35);
}

/* Audio Controls */
.audio-section {
  padding: 20px;
  background: #fff;
  border-top: 1px solid #f8bbd9;
}

.audio-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.audio-controls select {
  min-width: 140px;
}

.audio-player {
  background: #fefefe;
  border-radius: 12px;
  padding: 16px;
  border: 1px solid #f8bbd9;
  margin-top: 12px;
  display: none;
}

.audio-player.active {
  display: block;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.player-controls button {
  background: #f48fb1;
  color: white;
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.player-controls button:hover {
  background: #ec407a;
  transform: scale(1.1);
}

.progress-container {
  flex: 1;
  margin: 0 12px;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: #f8bbd9;
  border-radius: 3px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #f48fb1, #f8bbd9);
  border-radius: 3px;
  width: 0%;
  transition: width 0.1s ease;
}

.time-display {
  font-size: 0.85rem;
  color: #666;
  min-width: 80px;
  text-align: center;
}

/* Output Section */
.output-section {
  padding: 20px;
  border-top: 1px solid #f8bbd9;
  position: relative;
}

#outputArea {
  background: #fafafa;
  border: 2px solid #f8bbd9;
}

/* Status Messages */
.status-message {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: 8px;
  color: white;
  font-weight: 500;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  z-index: 1000;
  max-width: 300px;
}

.status-message.show {
  opacity: 1;
  transform: translateY(0);
}

.status-message.success {
  background: #4caf50;
}

.status-message.error {
  background: #f44336;
}

.status-message.warning {
  background: #ff9800;
}

.status-message.info {
  background: #2196f3;
}

/* Footer */
.powered {
  font-size: 0.85rem;
  text-align: center;
  color: #666;
  padding: 8px 16px;
  background: #fdf2f8;
}

.footer {
  padding: 8px 16px;
  text-align: center;
  background: #fdf2f8;
  color: #666;
  font-size: 0.85rem;
  border-top: 1px solid #f8bbd9;
}

.powered a, .footer a {
  color: #f48fb1;
  text-decoration: none;
  transition: color 0.2s ease;
}

.powered a:hover, .footer a:hover {
  color: #ec407a;
  text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    margin: 10px;
    border-radius: 12px;
  }
  
  .toolbar {
    padding: 12px;
    gap: 8px;
  }
  
  .toolbar button,
  .toolbar select,
  .toolbar input {
    font-size: 0.85rem;
    padding: 8px 12px;
  }
  
  .conversion-options {
    flex-direction: column;
  }
  
  .audio-controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .player-controls {
    justify-content: center;
  }
  
  header h1 {
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  body {
    padding: 5px;
  }
  
  .input-section,
  .passage-section,
  .conversion-section,
  .audio-section,
  .output-section {
    padding: 15px;
  }
  
  textarea {
    font-size: 16px; /* Prevent zoom on iOS */
  }
}