/* ============================================================================
   styles.css — odpowiednik Tailwind + shadcn/ui z oryginału (Next.js).
   Zmienne kolorów 1:1 z src/app/globals.css (motyw jasny).
   ========================================================================= */

:root {
  --background: 0 0% 94.1%;
  --foreground: 0 0% 3.9%;
  --card: 0 0% 100%;
  --card-foreground: 0 0% 3.9%;
  --popover: 0 0% 100%;
  --popover-foreground: 0 0% 3.9%;
  --primary: 207 70% 53%;
  --primary-foreground: 0 0% 98%;
  --secondary: 0 0% 96.1%;
  --secondary-foreground: 0 0% 9%;
  --muted: 0 0% 92%;
  --muted-foreground: 0 0% 45.1%;
  --accent: 145 63% 49%;
  --accent-foreground: 0 0% 98%;
  --destructive: 0 84.2% 60.2%;
  --destructive-foreground: 0 0% 98%;
  --border: 0 0% 89.8%;
  --input: 0 0% 89.8%;
  --ring: 207 70% 53%;
  --radius: 0.5rem;

  --font-sans: ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji',
    'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
}

/* --------------------------------------------------------------- reset --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  border: 0 solid hsl(var(--border));
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h4,
h5,
p,
ul {
  margin: 0;
  font-size: inherit;
  font-weight: inherit;
}

ul {
  padding: 0;
}

button,
textarea {
  font-family: inherit;
  font-size: 100%;
  line-height: inherit;
  color: inherit;
  margin: 0;
}

button {
  padding: 0;
  background-color: transparent;
  cursor: pointer;
}

svg {
  display: block;
  flex-shrink: 0;
}

[hidden] {
  display: none !important;
}

/* ----------------------------------------------------------- container --- */
/* container mx-auto py-8 px-4 md:px-6 lg:px-8 max-w-4xl */
.container {
  width: 100%;
  max-width: 56rem;
  margin-left: auto;
  margin-right: auto;
  padding: 2rem 1rem;
}

@media (min-width: 640px) {
  .container {
    max-width: 56rem;
  }
}

@media (min-width: 768px) {
  .container {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

@media (min-width: 1024px) {
  .container {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

/* ------------------------------------------------------------- header --- */
.page-header {
  margin-bottom: 2.5rem;
  text-align: center;
}

.page-title {
  font-size: 3rem;
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.025em;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-title-sparkles {
  width: 3rem;
  height: 3rem;
  margin-right: 0.75rem;
  color: hsl(var(--primary));
}

.page-subtitle {
  color: hsl(var(--muted-foreground));
  margin-top: 0.5rem;
  font-size: 1.125rem;
  line-height: 1.75rem;
}

.page-footer {
  margin-top: 4rem;
  text-align: center;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: hsl(var(--muted-foreground));
}

/* --------------------------------------------------------------- card --- */
.card {
  border-radius: var(--radius);
  border: 1px solid hsl(var(--border));
  background-color: hsl(var(--card));
  color: hsl(var(--card-foreground));
}

.card-shadow-lg {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

.card-result {
  margin-top: 2.5rem;
}

.card-header {
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
}

.card-header > * + * {
  margin-top: 0.375rem;
}

.card-header-row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.card-header-row > * + * {
  margin-top: 0;
}

.card-title {
  font-size: 1.5rem;
  line-height: 1;
  font-weight: 600;
  letter-spacing: -0.025em;
  display: flex;
  align-items: center;
}

.card-title svg {
  height: 1.5rem;
  width: 1.5rem;
  margin-right: 0.5rem;
  color: hsl(var(--primary));
}

.card-description {
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: hsl(var(--muted-foreground));
}

.card-content {
  padding: 0 1.5rem 1.5rem;
}

.card-content > * + * {
  margin-top: 1.5rem;
}

/* --------------------------------------------------------------- form --- */
.form-item > * + * {
  margin-top: 0.5rem;
}

.form-label {
  /* shadcn Label — element inline */
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
}

.form-message {
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
  color: hsl(var(--destructive));
}

.grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 1.5rem;
}

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

/* ----------------------------------------------------------- textarea --- */
.textarea {
  display: flex;
  width: 100%;
  min-height: 150px;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid hsl(var(--input));
  background-color: hsl(var(--background));
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  line-height: 1.5rem;
  resize: vertical;
  outline: none;
}

.textarea::placeholder {
  color: hsl(var(--muted-foreground));
}

.textarea:focus {
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 2px hsl(var(--primary));
}

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

@media (min-width: 768px) {
  .textarea {
    font-size: 0.875rem;
    line-height: 1.25rem;
  }
}

/* ------------------------------------------------------------- select --- */
.select {
  position: relative;
  margin-top: 0.5rem;
}

.select-trigger {
  display: flex;
  height: 2.5rem;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid hsl(var(--input));
  background-color: hsl(var(--background));
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  outline: none;
}

.select-trigger > svg:first-child {
  height: 1rem;
  width: 1rem;
  margin-right: 0.5rem;
}

.select-trigger > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.select-trigger:focus-visible {
  box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring));
}

.select-chevron {
  height: 1rem;
  width: 1rem;
  opacity: 0.5;
}

.select-content {
  position: absolute;
  z-index: 50;
  top: calc(100% + 0.25rem);
  left: 0;
  width: 100%;
  max-height: 24rem;
  min-width: 8rem;
  overflow: hidden auto;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid hsl(var(--border));
  background-color: hsl(var(--popover));
  color: hsl(var(--popover-foreground));
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  animation: select-in 150ms ease-out;
}

@keyframes select-in {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-0.5rem);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.select-viewport {
  padding: 0.25rem;
}

.select-item {
  position: relative;
  display: flex;
  width: 100%;
  cursor: default;
  user-select: none;
  align-items: center;
  border-radius: calc(var(--radius) - 4px);
  padding: 0.375rem 0.5rem 0.375rem 2rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  outline: none;
}

.select-item:hover,
.select-item.is-active {
  background-color: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

.select-item-indicator {
  position: absolute;
  left: 0.5rem;
  display: flex;
  height: 0.875rem;
  width: 0.875rem;
  align-items: center;
  justify-content: center;
}

.select-item-indicator svg {
  height: 1rem;
  width: 1rem;
  visibility: hidden;
}

.select-item.is-selected .select-item-indicator svg {
  visibility: visible;
}

/* ------------------------------------------------------------- button --- */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: nowrap;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
  outline: none;
  transition: background-color 150ms cubic-bezier(0.4, 0, 0.2, 1),
    color 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

.button svg {
  height: 1rem;
  width: 1rem;
  pointer-events: none;
}

.button:focus-visible {
  box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring));
}

.button:disabled {
  pointer-events: none;
  opacity: 0.5;
}

/* w-full bg-accent hover:bg-accent/90 text-accent-foreground text-lg py-6
   rounded-lg shadow-md transition-transform hover:scale-105 */
.button-translate {
  width: 100%;
  height: 2.5rem;
  padding: 1.5rem 1rem;
  font-size: 1.125rem;
  line-height: 1.75rem;
  border-radius: var(--radius);
  background-color: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  transition: transform 150ms cubic-bezier(0.4, 0, 0.2, 1),
    background-color 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

.button-translate:hover {
  background-color: hsl(var(--accent) / 0.9);
  transform: scale(1.05);
}

.button-translate svg {
  height: 1.25rem;
  width: 1.25rem;
  margin-right: 0.5rem;
}

.button-outline {
  border: 1px solid hsl(var(--input));
  background-color: hsl(var(--background));
}

.button-outline:hover {
  background-color: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

.button-icon {
  height: 2.5rem;
  width: 2.5rem;
}

/* ml-auto rounded-full hover:bg-primary/10 */
.speak-button {
  margin-left: auto;
  border-radius: 9999px;
}

.speak-button:hover {
  background-color: hsl(var(--primary) / 0.1);
  color: inherit;
}

.speak-button svg {
  height: 1.25rem;
  width: 1.25rem;
}

.icon-volume {
  color: hsl(var(--primary));
}

.icon-volume-x {
  color: hsl(var(--destructive));
}

.spin {
  animation: spin 1s linear infinite;
}

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

/* -------------------------------------------------------------- alert --- */
.alert {
  position: relative;
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid hsl(var(--border));
  padding: 1rem;
  margin-top: 2rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
}

.alert-destructive {
  border-color: hsl(var(--destructive) / 0.5);
  color: hsl(var(--destructive));
}

.alert-title {
  margin-bottom: 0.25rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.025em;
}

.alert-description {
  font-size: 0.875rem;
  line-height: 1.25rem;
}

/* -------------------------------------------------- HighlightedText ----- */
.highlighted > * + * {
  margin-top: 1rem;
}

.translation-text {
  white-space: pre-wrap;
  font-size: 1.125rem;
  line-height: 1.625;
}

.idiom {
  border-bottom: 2px solid hsl(var(--primary));
  font-weight: 500;
  cursor: pointer;
  transition: background-color 150ms cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0.125rem;
  border-radius: calc(var(--radius) - 4px);
}

.idiom:hover {
  background-color: hsl(var(--primary) / 0.1);
}

.alternatives {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid hsl(var(--border));
}

.alternatives-title {
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.5rem;
  margin-bottom: 0.5rem;
  color: hsl(var(--foreground) / 0.8);
}

.alternatives-list {
  list-style-type: disc;
  list-style-position: inside;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: hsl(var(--muted-foreground));
}

.alternatives-list > * + * {
  margin-top: 0.25rem;
}

/* ------------------------------------------------------------ tooltip --- */
.tooltip {
  position: absolute;
  z-index: 50;
  overflow: hidden;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid hsl(var(--border));
  background-color: hsl(var(--popover));
  color: hsl(var(--popover-foreground));
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  pointer-events: none;
  animation: tooltip-in 150ms ease-out;
}

@keyframes tooltip-in {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* -------------------------------------------------------------- toast --- */
.toast-viewport {
  position: fixed;
  top: 0;
  z-index: 100;
  display: flex;
  max-height: 100vh;
  width: 100%;
  flex-direction: column-reverse;
  padding: 1rem;
  gap: 0.5rem;
}

@media (min-width: 640px) {
  .toast-viewport {
    bottom: 0;
    right: 0;
    top: auto;
    flex-direction: column;
  }
}

@media (min-width: 768px) {
  .toast-viewport {
    max-width: 420px;
  }
}

.toast {
  pointer-events: auto;
  position: relative;
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid hsl(var(--border));
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  padding: 1.5rem 2rem 1.5rem 1.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  animation: toast-in 150ms ease-out;
}

.toast > * + * {
  margin-left: 1rem;
}

.toast.is-destructive {
  border-color: hsl(var(--destructive));
  background-color: hsl(var(--destructive));
  color: hsl(var(--destructive-foreground));
}

.toast.is-closing {
  animation: toast-out 150ms ease-in forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(100%);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

.toast-body > * + * {
  margin-top: 0.25rem;
}

.toast-title {
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 600;
}

.toast-description {
  font-size: 0.875rem;
  line-height: 1.25rem;
  opacity: 0.9;
}

.toast-close {
  position: absolute;
  right: 0.5rem;
  top: 0.5rem;
  border-radius: calc(var(--radius) - 2px);
  padding: 0.25rem;
  color: hsl(var(--foreground) / 0.5);
  opacity: 0;
  transition: opacity 150ms, color 150ms;
}

.toast:hover .toast-close {
  opacity: 1;
}

.toast-close:hover {
  color: hsl(var(--foreground));
}

.toast.is-destructive .toast-close {
  color: rgb(252 165 165);
}

.toast-close svg {
  height: 1rem;
  width: 1rem;
}
