/* UmkhoAI Classroom Translator - Custom Styles */

/* Base */
* {
  box-sizing: border-box;
}

body {
  font-family: 'Nunito', sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Spinner */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #E8F5E9;
  border-top-color: #1B5E20;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Textarea styling */
#sourceText {
  font-size: 18px;
  line-height: 1.6;
}

/* Language chip */
.lang-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border: 2px solid #e5e7eb;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 600;
  font-size: 0.95rem;
  user-select: none;
  background: white;
}

.lang-chip:hover {
  border-color: #2E7D32;
  background: #E8F5E9;
}

.lang-chip.selected {
  border-color: #1B5E20;
  background: #1B5E20;
  color: white;
}

.lang-chip.selected:hover {
  background: #2E7D32;
  border-color: #2E7D32;
}

.lang-chip .check-icon {
  width: 18px;
  height: 18px;
  border: 2px solid #d1d5db;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.lang-chip.selected .check-icon {
  border-color: white;
  background: white;
  color: #1B5E20;
}

/* Result card */
.result-card {
  background: white;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  transition: box-shadow 0.2s;
}

.result-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.result-card .result-header {
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #f3f4f6;
}

.result-card .result-body {
  padding: 1.25rem;
  font-size: 18px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Modal animations */
.modal-enter {
  animation: modalIn 0.25s ease-out;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Toast animation */
#toast:not(.hidden) {
  animation: toastIn 0.3s ease-out, toastOut 0.3s ease-in 2.5s forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 20px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translate(-50%, 0); }
  to { opacity: 0; transform: translate(-50%, 20px); }
}

/* History item */
.history-item {
  padding: 0.75rem 1rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.history-item:hover {
  background: #E8F5E9;
  border-color: #2E7D32;
}

/* Print styles */
@media print {
  header, footer, #translateBtn, .no-print {
    display: none !important;
  }
  .result-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ddd;
  }
  main {
    padding: 0;
  }
}

/* Responsive tweaks */
@media (max-width: 640px) {
  #sourceText {
    font-size: 16px;
  }
  .result-card .result-body {
    font-size: 16px;
  }
  .lang-chip {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
  }
}

/* Accessibility: focus styles */
button:focus-visible,
select:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: 3px solid #2E7D32;
  outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}