@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

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

body {
  font-family: "Inter", sans-serif;
  background: #f8fafc;
  color: #1e293b;
  min-height: 100vh;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.subtitle {
  color: #64748b;
  margin-bottom: 2rem;
}

.card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-title .badge {
  background: #eff6ff;
  color: #3b82f6;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 500;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
}

.grid-5 {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
  gap: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field label {
  font-size: 0.82rem;
  font-weight: 500;
  color: #475569;
}

.field input,
.field select {
  padding: 0.55rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.15s;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}

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

.btn-primary {
  background: #3b82f6;
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: #2563eb;
}

.btn-secondary {
  background: #f1f5f9;
  color: #475569;
}

.btn-secondary:hover:not(:disabled) {
  background: #e2e8f0;
}

.btn-success {
  background: #10b981;
  color: white;
}

.btn-success:hover:not(:disabled) {
  background: #059669;
}

.btn-lg {
  padding: 0.85rem 2rem;
  font-size: 1rem;
  font-weight: 600;
}

.actions-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.upload-zone {
  border: 2px dashed #d1d5db;
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s;
  color: #64748b;
}

.upload-zone:hover {
  border-color: #3b82f6;
  color: #3b82f6;
}

.upload-zone input {
  display: none;
}

.task-list {
  margin-top: 1rem;
}

.task-row {
  display: grid;
  grid-template-columns: 40px 1fr 1fr 80px 40px;
  gap: 0.75rem;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid #f1f5f9;
}

.task-row:last-child {
  border-bottom: none;
}

.task-header {
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.task-row .idx {
  text-align: center;
  color: #94a3b8;
  font-weight: 500;
  font-size: 0.85rem;
}

.task-row input {
  padding: 0.45rem 0.6rem;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: inherit;
}

.task-row input:focus {
  outline: none;
  border-color: #3b82f6;
}

.task-row input.hours-input {
  text-align: center;
}

.remove-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #94a3b8;
  font-size: 1.2rem;
  padding: 0.25rem;
  border-radius: 4px;
  transition: color 0.15s;
}

.remove-btn:hover {
  color: #ef4444;
}

.summary-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border-radius: 8px;
  margin-top: 0.75rem;
  font-size: 0.9rem;
}

.summary-bar .total {
  font-weight: 600;
}

.summary-bar .total.over {
  color: #ef4444;
}

.summary-bar .total.match {
  color: #10b981;
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  color: white;
  z-index: 100;
  animation: slideUp 0.3s ease;
}

.toast.error {
  background: #ef4444;
}

.toast.success {
  background: #10b981;
}

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

.generate-section {
  text-align: center;
  padding: 2rem;
}

@media (max-width: 768px) {
  .container {
    padding: 1rem 0.75rem;
  }

  h1 {
    font-size: 1.3rem;
  }

  .card {
    padding: 1rem;
  }

  .grid-2,
  .grid-3,
  .grid-5 {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  .actions-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .upload-zone {
    grid-column: 1 / -1;
    padding: 1rem;
  }

  .task-row {
    grid-template-columns: 28px 1fr 60px 32px;
    gap: 0.5rem;
  }

  .task-row input {
    min-width: 0;
    font-size: 0.8rem;
  }

  .task-header div:nth-child(2),
  .task-row input[data-field="english"] {
    display: none;
  }

  .toast {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    text-align: center;
  }

  .generate-section {
    padding: 1rem;
  }

  .btn-lg {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .grid-2,
  .grid-3,
  .grid-5 {
    grid-template-columns: 1fr;
  }

  .actions-row {
    grid-template-columns: 1fr;
  }
}
