/* Design System */
:root {
  --background: hsl(0 0% 100%);
  --foreground: hsl(213 31% 20%);
  --card: hsl(0 0% 100%);
  --card-foreground: hsl(213 31% 20%);
  --primary: hsl(213 85% 48%);
  --primary-foreground: hsl(0 0% 100%);
  --secondary: hsl(213 20% 96%);
  --secondary-foreground: hsl(213 31% 20%);
  --muted: hsl(213 20% 96%);
  --muted-foreground: hsl(213 15% 60%);
  --accent: hsl(213 30% 92%);
  --accent-foreground: hsl(213 31% 20%);
  --border: hsl(213 25% 88%);
  --input: hsl(213 25% 88%);
  --success: hsl(142 76% 36%);
  --success-foreground: hsl(0 0% 100%);
  --warning: hsl(38 92% 50%);
  --warning-foreground: hsl(0 0% 100%);
  --radius: 0.5rem;
}

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--secondary);
  background-color: hsl(213 20% 96% / 0.3);
  color: var(--foreground);
  line-height: 1.5;
  min-height: 100vh;
  padding: 2rem 1rem;
}

/* Layout */
.container {
  max-width: 64rem;
  margin: 0 auto;
}

/* Card Component */
.card {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
}

.card-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  color: var(--primary);
  margin: 0;
}

.card-content {
  padding: 1.5rem;
}

/* Form Elements */
.form-group {
  margin-bottom: 1rem;
}

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

@media (min-width: 768px) {
  .form-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--foreground);
}

.input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  background-color: var(--background);
  color: var(--foreground);
  font-size: 0.875rem;
  transition: all 0.2s;
}

.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px hsl(213 85% 48% / 0.2);
}

.input.number-input {
  width: 5rem;
}

.textarea {
  width: 100%;
  min-height: 3.75rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  background-color: var(--background);
  color: var(--foreground);
  font-size: 0.875rem;
  resize: vertical;
  font-family: inherit;
  transition: all 0.2s;
}

.textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px hsl(213 85% 48% / 0.2);
}

/* Tabs */
.tabs {
  margin-top: 1.5rem;
}

.tabs-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background-color: var(--muted);
  border-radius: calc(var(--radius) - 2px);
  padding: 0.25rem;
  margin-bottom: 1rem;
}

.tab-trigger {
  background: none;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: calc(var(--radius) - 4px);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted-foreground);
  cursor: pointer;
  transition: all 0.2s;
}

.tab-trigger:hover {
  color: var(--foreground);
}

.tab-trigger.active {
  background-color: var(--background);
  color: var(--foreground);
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
}

.tab-trigger.error {
  background-color: hsl(0 84% 60%);
  color: white;
  box-shadow: 0 0 0 2px hsl(0 84% 60% / 0.2);
}

.tab-trigger.error:hover {
  background-color: hsl(0 84% 55%);
  color: white;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.tab-content h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 1rem;
}

/* Checklist Items */
.checklist-item {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}

.checklist-header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.checkbox {
  width: 1rem;
  height: 1rem;
  margin-top: 0.125rem;
  cursor: pointer;
}

.checklist-label {
  flex: 1;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
}

.additional-fields {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.number-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.number-field .label {
  margin: 0;
  white-space: nowrap;
  font-size: 0.875rem;
}

.comment-section {
  margin-left: 1.75rem;
}

.comment-label {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-bottom: 0.25rem;
  display: block;
}

/* Anmärkningar section */
.remarks-section {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}

.remarks-section .label {
  font-weight: 500;
  margin-bottom: 0.5rem;
}

/* Error Validation */
.input.error, .textarea.error {
  border-color: hsl(0 84% 60%);
  box-shadow: 0 0 0 2px hsl(0 84% 60% / 0.2);
}

.input.error:focus, .textarea.error:focus {
  border-color: hsl(0 84% 60%);
  box-shadow: 0 0 0 2px hsl(0 84% 60% / 0.3);
}

.label.error {
  color: hsl(0 84% 60%);
}

/* Button */
.button {
  background-color: var(--primary);
  color: var(--primary-foreground);
  border: none;
  padding: 0.5rem 2rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: block;
  margin: 2rem auto 0;
}

.button:hover {
  background-color: hsl(213 85% 45%);
}

.button:focus {
  outline: none;
  box-shadow: 0 0 0 2px hsl(213 85% 48% / 0.2);
}

/* Toast */
.toast {
  position: fixed;
  top: 1rem;
  right: 1rem;
  background-color: var(--success);
  color: var(--success-foreground);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgb(0 0 0 / 0.15);
  transform: translateX(100%);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 1000;
  max-width: 320px;
  word-wrap: break-word;
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

.toast.error {
  background-color: hsl(0 84% 60%);
  color: white;
}

.toast-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.toast-description {
  font-size: 0.75rem;
  opacity: 0.9;
  white-space: pre-line;
  line-height: 1.4;
}

/* Responsive */
@media (max-width: 767px) {
  body {
    padding: 1rem 0.5rem;
  }
  
  .tabs-list {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.25rem;
  }
  
  .tab-trigger {
    font-size: 0.75rem;
    padding: 0.5rem 0.25rem;
  }
  
  .additional-fields {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
  }
}

/* SMS Section and Copy Button */
.copy-button {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #4CAF50;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 6px 8px;
  cursor: pointer;
  font-size: 12px;
  transition: background-color 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.copy-button:hover {
  background: #45a049;
}

.copy-button:active {
  background: #3e8e41;
}

.sms-section {
  border-left: 3px solid #e0e0e0;
  padding-left: 1rem;
}