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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  line-height: 1.5;
}

.app-container {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  transition: background-color 0.5s ease;
  background-color: #0078c4;
}

.app-container.dark {
  background-color: #030e2a;
}

/* Semi-transparent overlay */
.overlay {
  position: fixed;
  inset: 0;
  transition: background-color 0.5s ease;
  background-color: rgba(255, 255, 255, 0.9);
  z-index: 2;
}

.dark .overlay {
  background-color: rgba(0, 0, 0, 0.9);
}

/* Content Container */
.content-container {
  position: relative;
  max-width: 56rem;
  margin: 0 auto;
  padding: 2rem;
  z-index: 10;
}

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

h1 {
  font-size: 1.875rem;
  font-weight: bold;
  color: #000;
  transition: color 0.3s ease;
}

.dark h1 {
  color: #fff;
}

.subtitle {
  margin-bottom: 2rem;
  color: #000;
  transition: color 0.3s ease;
}

.dark .subtitle {
  color: #f3f4f6;
}

/* Theme Toggle Button */
.theme-toggle {
  padding: 0.5rem;
  border-radius: 0.375rem;
  border: none;
  cursor: pointer;
  transition: background-color 0.3s ease;
  background-color: rgba(255, 255, 255, 0.3);
  color: #000;
}

.theme-toggle:hover {
  background-color: rgba(255, 255, 255, 0.4);
}

.dark .theme-toggle {
  background-color: #1f2937;
  color: #fbbf24;
}

.dark .theme-toggle:hover {
  background-color: #374151;
}

.theme-toggle svg {
  width: 1.25rem;
  height: 1.25rem;
}

.theme-toggle .sun-icon {
  display: none;
}

.theme-toggle .moon-icon {
  display: block;
}

.dark .theme-toggle .sun-icon {
  display: block;
}

.dark .theme-toggle .moon-icon {
  display: none;
}

/* Card */
.card {
  background-color: #fff;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  padding: 1.5rem;
  transition: background-color 0.3s ease;
}

.dark .card {
  background-color: #1f2937;
}

/* Input Section */
.input-section {
  margin-bottom: 1.5rem;
}

.input-section label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: #374151;
  transition: color 0.3s ease;
}

.dark .input-section label {
  color: #d1d5db;
}

.input-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

@media (min-width: 640px) {
  .input-row {
    flex-direction: row;
  }
}

.input-row input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-size: 1rem;
  outline: none;
  transition: all 0.3s ease;
}

.input-row input:focus {
  border-color: transparent;
  box-shadow: 0 0 0 2px #3b82f6;
}

.dark .input-row input {
  background-color: #374151;
  border-color: #4b5563;
  color: #fff;
}

.dark .input-row input::placeholder {
  color: #9ca3af;
}

.input-row input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.error-message {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: #dc2626;
  display: none;
}

.dark .error-message {
  color: #f87171;
}

.error-message.show {
  display: block;
}

/* Buttons */
.btn-primary {
  padding: 0.5rem 1.5rem;
  background-color: #2563eb;
  color: #fff;
  border: none;
  border-radius: 0.375rem;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.btn-primary:hover {
  background-color: #1d4ed8;
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary svg {
  width: 1rem;
  height: 1rem;
}

.btn-secondary {
  padding: 0.5rem 1.5rem;
  background-color: #f3f4f6;
  color: #374151;
  border: none;
  border-radius: 0.375rem;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-secondary:hover {
  background-color: #e5e7eb;
}

.dark .btn-secondary {
  background-color: #374151;
  color: #e5e7eb;
}

.dark .btn-secondary:hover {
  background-color: #4b5563;
}

.btn-secondary svg {
  width: 1rem;
  height: 1rem;
}

.btn-secondary .chevron-up {
  display: none;
}

.btn-secondary.expanded .chevron-down {
  display: none;
}

.btn-secondary.expanded .chevron-up {
  display: block;
}

/* Translations Grid */
.translations-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 768px) {
  .translations-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .translations-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Translation Card */
.translation-card {
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 1rem;
  transition: all 0.3s ease;
  background-color: #fff;
}

.translation-card:hover {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.dark .translation-card {
  border-color: #374151;
  background-color: #283548;
}

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

.language-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.language-flag {
  font-size: 1.125rem;
}

.language-name {
  font-weight: 500;
  color: #374151;
  transition: color 0.3s ease;
}

.dark .language-name {
  color: #e5e7eb;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.action-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  color: #9ca3af;
  transition: color 0.3s ease;
}

.action-btn:hover {
  color: #2563eb;
}

.action-btn.playing {
  color: #2563eb;
}

.action-btn.copied {
  color: #16a34a;
}

.dark .action-btn {
  color: #6b7280;
}

.dark .action-btn:hover {
  color: #d1d5db;
}

.action-btn svg {
  width: 1rem;
  height: 1rem;
}

.translation-text {
  color: #1f2937;
  word-wrap: break-word;
  transition: color 0.3s ease;
}

.dark .translation-text {
  color: #f3f4f6;
}

.translation-text.loading {
  color: #9ca3af;
  font-style: italic;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.translation-text.placeholder {
  font-style: italic;
  color: #9ca3af;
}

/* Spinner */
.spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid #2563eb;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Action Buttons */
.action-buttons {
  margin-top: 1.5rem;
  display: flex;
  justify-content: center;
  gap: 0.75rem;
}

.hidden {
  display: none !important;
}

/* Extended Grid */
.extended-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: all 0.5s ease;
}

.extended-grid.expanded {
  max-height: 2000px;
  opacity: 1;
  margin-top: 1.5rem;
}

@media (min-width: 768px) {
  .extended-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .extended-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Pulse animation for audio */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.action-btn.playing svg {
  animation: pulse 1s ease-in-out infinite;
}
