/* Reset & base */
* {
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
  margin: 0;
  padding: 1.5rem;
  color: #1a1a2e;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  transition: background 0.4s ease;
}

/* Main container */
.app {
  max-width: 600px;      /* max width for large screens */
  min-width: 280px;      /* minimum width so it doesn't shrink too much */
  width: 90vw;           /* responsive width: 90% of viewport width */
  background: rgba(255, 255, 255, 0.867);
  border-radius: 16px;
  box-shadow:
    0 4px 6px rgba(58, 58, 58, 0.1),
    0 1px 3px rgba(0, 0, 0, 0.06);
  padding: 2rem 2.5rem;
  animation: fadeInUp 0.6s ease forwards;
  margin: 1rem auto;
}

/* Header */
header {
  text-align: center;
  margin-bottom: 2rem;
}

header h1 {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: #4a148c;
  text-shadow: 0 2px 4px rgba(74, 20, 140, 0.25);
  margin: 0;
}

/* Card container */
.card {
  background: #fff;
  padding: 1.75rem 2rem;
  border-radius: 12px;
  box-shadow: 0 10px 20px rgba(74, 20, 140, 0.12);
  transition: box-shadow 0.3s ease;
}

.card:hover {
  box-shadow: 0 14px 30px rgba(74, 20, 140, 0.2);
}

/* Textarea */
textarea {
  width: 100%;
  resize: vertical;
  min-height: 120px;
  font-size: 1.1rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 2px solid #b39ddb;
  font-family: inherit;
  color: #3c1361;
  background-color: #f3e5f5;
  box-shadow: inset 0 2px 5px rgba(180, 157, 219, 0.3);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  box-sizing: border-box;
}

textarea:focus {
  outline: none;
  border-color: #7e57c2;
  box-shadow: 0 0 8px #7e57c2aa;
}

/* Controls container */
.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  margin: 1.8rem 0 2rem 0;
}

/* Selects container */
.selects {
  flex: 1 1 100%;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  min-width: 280px;
}

/* Each field */
.field {
  flex: 1 1 45%;
  min-width: 140px;
  display: flex;
  flex-direction: column;
  margin-bottom: 1rem;
}

/* Buttons container */
.buttons {
  flex: 1 1 100%;
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

/* Labels */
label {
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: #512da8;
  letter-spacing: 0.8px;
  font-size: 0.95rem;
  user-select: none;
}

/* Select boxes */
select {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 2px solid #b39ddb;
  font-size: 1rem;
  font-weight: 600;
  color: #4527a0;
  background: #ede7f6;
  cursor: pointer;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  box-sizing: border-box;
}

select:hover,
select:focus {
  border-color: #7e57c2;
  box-shadow: 0 0 6px #7e57c2aa;
  outline: none;
}

/* Buttons */
button {
  background: linear-gradient(135deg, #6a1b9a, #8e24aa);
  border: none;
  color: white;
  padding: 0.65rem 1.3rem;
  border-radius: 30px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  box-shadow: 0 6px 12px rgba(142, 36, 170, 0.5);
  transition: background 0.4s ease, transform 0.15s ease, box-shadow 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: nowrap;
}

button:hover {
  background: linear-gradient(135deg, #8e24aa, #ba68c8);
  box-shadow: 0 8px 20px rgba(186, 104, 200, 0.65);
  transform: translateY(-2px);
}

button:active {
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(142, 36, 170, 0.4);
}

/* Status message */
.status {
  font-style: italic;
  color: #6a1b9a;
  font-weight: 600;
  text-align: center;
  user-select: none;
  min-height: 1.2em;
  transition: color 0.3s ease;
}

/* Responsive adjustments */

/* Tablet and small screens (max-width: 768px) */
@media (max-width: 768px) {
  .app {
    padding: 1.5rem 2rem;
  }

  .controls {
    flex-direction: column;
    gap: 1rem;
  }

  .selects {
    flex-direction: column;
  }

  .field {
    min-width: 100%;
    flex: 1 1 100%;
  }

  .buttons {
    justify-content: center;
  }

  button {
    width: 100%;
  }
}

/* Mobile phones (max-width: 480px) */
@media (max-width: 480px) {
  body {
    padding: 1rem 0.75rem;
    align-items: center;
  }

  .app {
    max-width: 100%;
    border-radius: 0;
    padding: 1.5rem 1.25rem;
    box-shadow: none;
  }

  header h1 {
    font-size: 1.75rem;
    letter-spacing: 1px;
  }

  .card {
    padding: 1.25rem 1.5rem;
    border-radius: 10px;
    box-shadow: 0 6px 15px rgba(74, 20, 140, 0.1);
  }

  textarea {
    font-size: 1rem;
    min-height: 100px;
  }

  select {
    font-size: 0.95rem;
  }

  .buttons {
    gap: 0.75rem;
    justify-content: center;
  }

  button {
    padding: 0.55rem 1rem;
    font-size: 0.95rem;
  }
}

/* Very small phones (max-width: 320px) */
@media (max-width: 320px) {
  body {
    padding: 0.75rem 0.5rem;
  }

  header h1 {
    font-size: 1.5rem;
  }

  textarea {
    font-size: 0.9rem;
    min-height: 90px;
  }

  select {
    font-size: 0.9rem;
  }

  button {
    padding: 0.5rem 0.9rem;
    font-size: 0.9rem;
  }
}

/* Small phones around 400px width */
@media (max-width: 400px) {
  .field {
    flex: 1 1 100%;
    min-width: unset;
  }

  .buttons {
    justify-content: stretch;
  }

  button {
    width: 100%;
  }

  textarea, select {
    font-size: 0.95rem;
  }
}

/* Animations */
@keyframes fadeInUp {
  0% {
    opacity: 0;
    transform: translateY(25px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}
