/* Unpack All button styling */
.unpack-all-btn {
  margin-left: 1em;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 0.3em 1em;
  font-size: 0.95em;
  cursor: pointer;
  transition: background 0.15s;
}
.unpack-all-btn:hover, .unpack-all-btn:focus {
  background: #1746a0;
  outline: none;
}
/* Remove duplicate and conflicting flexbox rules for .bag-header-row and .bag-btn-group */
/* Bag header row for inline bag buttons */
.bag-header-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 1em;
  margin-top: 2em;
  background-color: #f3f4f6;
  border-radius: 8px;
  padding: 0.5em 1em;
}

.bag-header-row .bag-header {
  flex: 1 1 0%;
  min-width: 0;
  background: none;
  padding: 0;
  margin: 0;
  border-radius: 0;
}

.bag-btn-group {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5em;
  justify-content: flex-end;
}

@media (max-width: 480px) {
  .bag-header-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5em;
    padding: 0.5em 0.5em;
  }
  .bag-btn-group {
    flex-direction: row;
    justify-content: flex-end;
    gap: 0.5em;
  }
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  max-width: 600px;
  margin: 2em auto;
  padding: 0 1em;
  background: #f9fafb;
  color: #111;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

h1 {
  text-align: center;
  margin-bottom: 1em;
  font-weight: 700;
  color: #333;
}

.add-bag-section {
  display: flex;
  gap: 0.5em;
  margin-bottom: 2em;
  align-items: center;
}

.add-bag-section input {
  flex-grow: 1;
  padding: 0.6em 1em;
  font-size: 1em;
  border: 2px solid #ddd;
  border-radius: 8px;
  outline-offset: 2px;
  -webkit-appearance: none;
  appearance: none;
}

.add-bag-section input:focus {
  border-color: #2563eb;
  outline: none;
}

.item {
  display: flex;
  align-items: center;
  margin: 0.5em 0;
  padding: 0.75em 1em;
  border-radius: 8px;
  font-size: 1.1em;
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
  transition: background-color 0.3s ease;
}

.unpacked {
  background-color: #fee2e2;
  color: #b91c1c;
}

.packed {
  background-color: #d1fae5;
  color: #065f46;
}

button.toggle-btn {
  background: none;
  border: 2px solid currentColor;
  border-radius: 20px;
  width: 38px;
  height: 24px;
  position: relative;
  cursor: pointer;
  outline-offset: 3px;
  transition: all 0.3s ease;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}

button.toggle-btn:focus {
  outline: 2px solid #2563eb;
}

button.toggle-btn::before {
  content: "";
  position: relative;
  width: 20px;
  height: 20px;
  background: currentColor;
  border-radius: 50%;
  transition: transform 0.3s ease;
  transform: translateX(0);
}

button.toggle-btn.packed::before {
  transform: translateX(14px);
}

button.toggle-btn.packed {
  background-color: #065f46;
  border-color: #065f46;
  color: #d1fae5;
}

input[type="text"] {
  width: 100%;
  padding: 0.5em 1em;
  font-size: 1.1em;
  border: 2px solid #ddd;
  border-radius: 8px;
  box-sizing: border-box;
  margin-top: 0.5em;
  outline-offset: 2px;
  transition: border-color 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
}

input[type="text"]:focus {
  border-color: #2563eb;
  outline: none;
}

.edit-input {
  background: white !important;
  border: 2px solid #2563eb !important;
  border-radius: 4px !important;
  padding: 0.3em 0.5em !important;
  font-size: inherit !important;
  color: inherit !important;
  width: 100% !important;
  margin: 0 !important;
  outline: none !important;
}

button.add-btn {
  margin-top: 0.5em;
  background-color: #2563eb;
  color: white;
  border: none;
  padding: 0.6em 1.2em;
  font-size: 1em;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}

button.add-btn:hover {
  background-color: #1d4ed8;
}

button.add-btn:focus {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}

.item-label {
  flex-grow: 1;
  margin-left: 1em;
  margin-right: 1em;
  user-select: text;
  -webkit-user-select: text;
  line-height: 1.2;
  cursor: pointer;
  padding: 0.2em 0.4em;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.item-label:hover {
  background-color: rgba(0,0,0,0.05);
}

button.remove-btn {
  background: none;
  border: none;
  font-size: 1.2em;
  cursor: pointer;
  color: #9ca3af;
  flex-shrink: 0;
  padding: 0.2em;
  border-radius: 4px;
  transition: all 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}

button.remove-btn:hover {
  color: #ef4444;
  background-color: rgba(239, 68, 68, 0.1);
}

button.remove-btn:focus {
  outline: 2px solid #ef4444;
  outline-offset: 2px;
}

.bag-header {
  display: flex;
  align-items: center;
  gap: 1em;
  background: none;
  padding: 0;
  border-radius: 0;
  margin: 0;
}

.bag-header.packed {
  background-color: #d1fae5;
  color: #065f46;
}

.bag-header.unpacked {
  background-color: #fee2e2;
  color: #b91c1c;
}

.bag-name {
  font-weight: 600;
  font-size: 1.1em;
  cursor: pointer;
  flex-grow: 1;
  padding: 0.2em 0.4em;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.bag-name:hover {
  background-color: rgba(0,0,0,0.05);
}

button.unpack-btn {
  margin-top: 0.5em;
  margin-right: 0.5em;
  background-color: #f59e0b;
  color: white;
  border: none;
  padding: 0.4em 0.8em;
  font-size: 0.9em;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}

button.unpack-btn:hover {
  background-color: #d97706;
}

button.unpack-btn:focus {
  outline: 2px solid #fbbf24;
  outline-offset: 2px;
}

button.remove-bag-btn {
  margin-top: 0.5em;
  background-color: #ef4444;
  color: white;
  border: none;
  padding: 0.4em 0.8em;
  font-size: 0.9em;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}

button.remove-bag-btn:hover {
  background-color: #dc2626;
}

button.remove-bag-btn:focus {
  outline: 2px solid #fca5a5;
  outline-offset: 2px;
}

.magic-url-section {
  margin-top: 3em;
  padding: 1em;
  background-color: #f8fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.magic-url-section h3 {
  margin-top: 0;
  color: #374151;
  font-size: 1.1em;
}

.magic-url-container {
  display: flex;
  gap: 0.5em;
  align-items: center;
}

.magic-url-input {
  flex-grow: 1;
  padding: 0.5em;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 0.9em;
  background: white;
  margin-top: 0 !important;
  -webkit-appearance: none;
  appearance: none;
}

.magic-url-input:focus {
  border-color: #2563eb;
  outline: none;
}

.copy-btn {
  background-color: #6b7280;
  color: white;
  border: none;
  padding: 0.5em 1em;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9em;
  transition: background-color 0.3s ease;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.copy-btn:hover {
  background-color: #4b5563;
}

.copy-btn:focus {
  outline: 2px solid #9ca3af;
  outline-offset: 2px;
}

.copy-btn.copied {
  background-color: #10b981;
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
  input[type="text"] {
    -webkit-appearance: none;
    -webkit-border-radius: 8px;
  }
  
  button {
    -webkit-appearance: none;
    -webkit-border-radius: 8px;
  }
}

/* Focus styles for better accessibility */
*:focus {
  outline-offset: 2px;
}

/* Responsive design */
@media (max-width: 480px) {
  body {
    padding: 0 0.5em;
    margin: 1em auto;
  }
  
  .add-bag-section {
    flex-direction: column;
    gap: 0.5em;
  }
  
  .add-bag-section input {
    width: 100%;
  }
  
  .magic-url-container {
    flex-direction: column;
    gap: 0.5em;
  }
  
  .magic-url-input {
    width: 100%;
  }
  
  .copy-btn {
    width: 100%;
  }
}