:root {
  --color-bg: #EBF6FF;
  --color-card: #ffffff;
  --color-border: #e9ecef;
  --color-text: #212529;
  --color-text-secondary: #6c757d;
  --color-text-muted: #adb5bd;
  --color-primary: #09A5FF;
  --color-primary-hover: #0891E6;
  --color-success: #10b981;
  --color-error: #ef4444;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: rgba(0, 20, 40, 0.07) 0px 2px 8px -1px;
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --transition: all 0.2s ease;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  padding: 2rem 1rem;
  line-height: 1.6;
}

.logo-container {
  text-align: center;
  margin-top: 1rem;
  margin-bottom: 3rem;
}

.logo {
  height: 60px;
  width: auto;
  display: inline-block;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.translation-panel {
  background: var(--color-card);
  padding: 2rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  border: 1px solid var(--color-border);
}

.translation-panel:hover {
  box-shadow: var(--shadow-lg);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

label {
  display: block;
  font-weight: 600;
  color: var(--color-text);
  font-size: 1.1rem;
}

.panel-meta {
  display: flex;
  gap: 1rem;
  align-items: center;
  font-size: 0.875rem;
  color: var(--color-text-secondary);
}

.char-count {
  color: var(--color-text-muted);
}

.char-count.char-limit-warning {
  color: #f59e0b;
  font-weight: 600;
}

.char-count.char-limit-exceeded {
  color: var(--color-error);
  font-weight: 600;
}

.rate-limit-info {
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.rate-limit-warning {
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
}

.rate-limit-exceeded {
  color: var(--color-error);
  background: rgba(239, 68, 68, 0.1);
}

.button {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

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

.button-primary:hover {
  background: var(--color-primary-hover);
  transform: scale(1.05);
}

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

.button-secondary:hover {
  background: #dee2e6;
}

.button-outline {
  background: transparent;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
}

.button-outline:hover {
  background: var(--color-primary);
  color: white;
}

.button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.button-primary:disabled:hover,
.button-outline:disabled:hover {
  background: var(--color-primary);
  transform: none;
}

.button-outline:disabled {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.button-outline:disabled:hover {
  background: transparent;
  color: var(--color-primary);
}

.panel-actions {
  display: flex;
  flex-direction: row-reverse;
  gap: 0.75rem;
  margin-top: 1rem;
  justify-content: flex-start;
}

textarea {
  width: 100%;
  min-height: 150px;
  padding: 1rem;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
  transition: var(--transition);
  line-height: 1.6;
}

textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.output-text {
  min-height: 150px;
  padding: 1rem;
  background: var(--color-bg);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 1rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
  position: relative;
}

.output-text:empty::before {
  content: attr(data-placeholder);
  color: var(--color-text-muted);
}

.loading {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-primary);
  font-size: 0.875rem;
  font-weight: 500;
}

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

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

.error-text {
  color: var(--color-error);
  padding: 1rem;
  background: rgba(239, 68, 68, 0.1);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.success-feedback {
  color: var(--color-success);
  font-size: 0.875rem;
  font-weight: 500;
}

.flow-indicator {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 1.5rem;
  margin: -0.5rem 0;
}

@media (max-width: 768px) {
  body {
    padding: 1rem 1rem;
  }
  
  .logo-container {
    margin-top: 2rem;
    margin-bottom: 2rem;
  }
  
  .logo {
    height: 48px;
  }
  
  .container {
    gap: 1.05rem;
  }
  
  .translation-panel {
    padding: 1.25rem;
  }
  
  .translation-panel:hover {
    transform: none;
  }
  
  .panel-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  
  label {
    font-size: 1rem;
  }
  
  .panel-meta {
    width: 100%;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 1rem;
  }
  
  .button {
    padding: 0.125rem 0.625rem;
    font-size: 0.8125rem;
    min-height: 32px;
    justify-content: center;
    border-radius: var(--radius-sm);
  }
  
  .panel-actions {
    justify-content: stretch;
  }
  
  .panel-actions .button {
    flex: 1;
  }
  
  .loading {
    font-size: 1rem;
  }
  
  textarea {
    min-height: 120px;
    font-size: 1rem;
  }
  
  .output-text {
    min-height: 120px;
    font-size: 1rem;
  }
  
  .flow-indicator {
    font-size: 1.25rem;
    margin: -0.25rem 0;
  }
}
