:root {
  --background-color: #f4f7f9;
  --container-color: #ffffff;
  --primary-text-color: #2c3e50;
  --secondary-text-color: #5a6a7a;
  --primary-color: #3498db;
  --primary-color-hover: #2980b9;
  --secondary-color: #8e44ad;
  --secondary-color-hover: #7d3c98;
  --defensive-color: #e67e22;
  --defensive-color-hover: #d35400;
  --discussion-color: #27ae60;
  --discussion-color-hover: #229954;
  --border-color: #dce4e9;
  --shadow-color: rgba(44, 62, 80, 0.1);
  --error-color: #e74c3c;
  --success-color: #2ecc71;
  --turn-elle-bg: #eaf2ff;
  --turn-moi-bg: #e6f9f0;
  --font-family: 'Inter', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--background-color);
  color: var(--primary-text-color);
  line-height: 1.6;
  padding: 1rem;
}

#root {
  max-width: 800px;
  margin: 2rem auto;
  padding: 2rem;
  background-color: var(--container-color);
  border-radius: 12px;
  box-shadow: 0 8px 32px var(--shadow-color);
}

h1 {
  text-align: center;
  color: var(--primary-text-color);
  margin-bottom: 2rem;
  font-weight: 700;
}

.textarea-container {
  position: relative;
  margin-bottom: 1rem;
}

textarea {
  width: 100%;
  min-height: 200px;
  padding: 1rem 2.5rem 1rem 1rem;
  font-family: var(--font-family);
  font-size: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  resize: vertical;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.paste-icon-button {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  color: var(--secondary-text-color);
  opacity: 0.6;
  transition: opacity 0.2s ease;
  z-index: 5;
}

.paste-icon-button:hover {
  opacity: 1;
}

.button-group {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  margin-bottom: 2rem;
}

.defensive-container {
  position: relative;
  display: flex;
  gap: 0.5rem;
}

.defensive-tones {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background-color: var(--container-color);
  padding: 0.5rem;
  border-radius: 8px;
  box-shadow: 0 4px 12px var(--shadow-color);
  z-index: 10;
  width: max-content;
}

.tone-button {
  background-color: transparent;
  border: none;
  padding: 0.6rem 1.2rem;
  font-family: var(--font-family);
  font-size: 0.95rem;
  color: var(--primary-text-color);
  cursor: pointer;
  border-radius: 6px;
  text-align: left;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.tone-button:hover {
  background-color: var(--defensive-color);
  color: #fff;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.1s ease;
  color: #fff;
}

.button:active {
  transform: translateY(1px);
}

.button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.button-correct {
  background-color: var(--primary-color);
}

.button-correct:not(:disabled):hover {
  background-color: var(--primary-color-hover);
}

.button-improve {
  background-color: var(--secondary-color);
}

.button-improve:not(:disabled):hover {
  background-color: var(--secondary-color-hover);
}

.button-defensive {
  background-color: var(--defensive-color);
}

.button-defensive:not(:disabled):hover {
  background-color: var(--defensive-color-hover);
}

.button-discussion {
  background-color: var(--discussion-color);
}

.button-discussion:not(:disabled):hover {
  background-color: var(--discussion-color-hover);
}

.discussion-interface {
  padding: 1.5rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin-top: 1rem;
  margin-bottom: 2rem;
  background-color: #fdfdfd;
}

.discussion-interface h3 {
  text-align: center;
  margin-bottom: 1.5rem;
  color: var(--secondary-text-color);
  font-weight: 500;
}

.conversation-history {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.conversation-turn {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.conversation-turn label {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--secondary-text-color);
  padding-left: 0.25rem;
}

.turn-input-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.turn-input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: var(--font-family);
  font-size: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  color: var(--primary-text-color);
  flex-grow: 1;
}

.turn-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.turn-elle .turn-input {
    background-color: var(--turn-elle-bg);
}

.turn-moi .turn-input {
    background-color: var(--turn-moi-bg);
}

.delete-turn-button {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  color: var(--secondary-text-color);
  opacity: 0.6;
  transition: opacity 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
}

.delete-turn-button:hover {
  opacity: 1;
  color: var(--error-color);
}


.discussion-controls {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.turn-button {
  background-color: var(--secondary-text-color);
  padding: 0.6rem 1.2rem;
  font-size: 0.95rem;
}

.turn-button:not(:disabled):hover {
    background-color: var(--primary-text-color);
}

.discussion-defensive {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
}

.results-container {
  margin-top: 1rem;
}

.results-container h2 {
  text-align: center;
  color: var(--secondary-text-color);
  margin-bottom: 1.5rem;
  font-weight: 500;
}

.loading-spinner {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.error-message {
  text-align: center;
  color: var(--error-color);
  background-color: rgba(231, 76, 60, 0.1);
  padding: 1rem;
  border-radius: 8px;
  border: 1px solid var(--error-color);
}

.result-card {
  background-color: #fdfdfd;
  padding: 1.5rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin-bottom: 1rem;
  box-shadow: 0 4px 16px var(--shadow-color);
}

.result-card p {
  white-space: pre-wrap;
  margin-bottom: 1rem;
}

.copy-button {
  background-color: var(--secondary-text-color);
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
  margin-left: auto;
  display: block;
}

.copy-button.copied {
    background-color: var(--success-color);
}