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

:root {
  --primary-color: #3b82f6;
  --secondary-color: #10b981;
  --danger-color: #ef4444;
  --background: #f9fafb;
  --surface: #ffffff;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --border: #e5e7eb;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  background: var(--background);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

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

/* Header */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
  margin-bottom: 0.5rem;
  position: relative;
}

.header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
}

.header .sync-status {
  display: inline-block;
  margin-left: 1rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.header .sync-status.synced {
  color: var(--secondary-color);
}

.header .sync-status.unsynced {
  color: var(--danger-color);
}

/* Header Navigation */
.header-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  position: relative;
}

.nav-link {
  text-decoration: none;
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-weight: 500;
  transition: background-color 0.2s;
}

.nav-link:hover {
  background: var(--background);
}

.nav-link-primary {
  background: var(--primary-color);
  color: white;
}

.nav-link-primary:hover {
  background: #2563eb;
}

/* Hamburger Menu */
.btn-hamburger {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--text-primary);
  line-height: 1;
}

.btn-hamburger:hover {
  background: var(--background);
  border-radius: 0.375rem;
}

.hamburger-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  min-width: 200px;
  margin-top: 0.25rem;
}

.hamburger-item {
  display: block;
  padding: 0.75rem 1rem;
  text-decoration: none;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  transition: background-color 0.2s;
}

.hamburger-item:last-child {
  border-bottom: none;
}

.hamburger-item:hover {
  background: var(--background);
}

.hamburger-mobile-only {
  display: none;
}

/* Responsive Navigation */
@media (max-width: 768px) {
  .header-nav .nav-link {
    display: none;
  }

  .hamburger-mobile-only {
    display: block;
  }
}

/* Buttons */
.button-grid {
  accent-color: var(--primary-color);
}

input[type="password"],
input[type="text"] {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  font-size: 1rem;
}

button[type="submit"],
.btn {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 0.375rem;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

button[type="submit"]:hover,
.btn:hover {
  background: #2563eb;
}

.btn-secondary {
  background: var(--text-secondary);
}

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

.btn-danger {
  background: var(--danger-color);
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
}

/* Login page */
.login-container {
  max-width: 400px;
  margin: 4rem auto;
  padding: 2rem;
  background: var(--surface);
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.login-container h1 {
  margin-bottom: 1.5rem;
  text-align: center;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.error-message {
  color: var(--danger-color);
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

.success-message {
  color: #10b981;
  font-size: 0.875rem;
  margin-top: 0.5rem;
  padding: 0.75rem;
  background: rgba(16, 185, 129, 0.1);
  border-radius: 0.375rem;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Stats table */
.stats-container {
  background: var(--surface);
  border-radius: 0.5rem;
  padding: 1.5rem;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: var(--background);
}

th,
td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.875rem;
  text-transform: uppercase;
}

tr:hover {
  background: var(--background);
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
}

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

.badge-warning {
  background: #fef3c7;
  color: #92400e;
}

/* Utility classes */
.mt-1 {
  margin-top: 0.5rem;
}
.mt-2 {
  margin-top: 1rem;
}
.mb-1 {
  margin-bottom: 0.5rem;
}
.mb-2 {
  margin-bottom: 1rem;
}

.text-center {
  text-align: center;
}

.text-primary {
  color: var(--primary-color);
  font-weight: 600;
}

.text-secondary {
  color: var(--text-secondary);
}

.hidden {
  display: none;
}

/* Loading spinner */
.spinner {
  border: 3px solid var(--border);
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  animation: spin 1s linear infinite;
  display: inline-block;
  margin-left: 0.5rem;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Tab Navigation */
.tab-navigation {
  display: flex;
  gap: 0.25rem;
  margin-bottom: -1px;
  position: relative;
}

.tab-button {
  padding: 0.75rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem 0.5rem 0 0;
  background: #e5e7eb;
  color: var(--text-secondary);
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
  position: relative;
  margin-bottom: 0px;
}

.tab-button.active {
  background: var(--background);
  color: var(--text-primary);
  border-bottom: none;
  margin-bottom: 0;
}

.tab-separator {
  border-top: 1px solid var(--border);
  margin-bottom: 1.5rem;
  padding-top: 0.5rem;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: white;
  padding: 2rem;
  border-radius: 0.5rem;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-content-large {
  max-width: 700px;
}

.modal-content-xl {
  max-width: 1200px;
  max-height: calc(100vh - 4rem);
  height: calc(100vh - 4rem);
  width: calc(100vw - 4rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-content-xl > h2 {
  flex-shrink: 0;
}

.modal-content-xl .tab-navigation {
  flex-shrink: 0;
}

.modal-content-xl > form,
.modal-content-xl > div[x-show] {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 0;
  padding-bottom: 1rem;
}

.modal-content-xl .modal-actions {
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  background: white;
  padding-top: 1rem;
  margin-top: 1rem;
  border-top: 1px solid #e5e7eb;
}

.modal-title {
  margin-bottom: 1.5rem;
}

.modal-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

/* Form Fields */
.form-field {
  margin-bottom: 1rem;
}

.form-field-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.form-field-input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 0.25rem;
}

.form-field-input.has-error {
  border-color: #ef4444;
}

.form-field-error {
  color: #ef4444;
  display: block;
  margin-top: 0.25rem;
  font-size: 0.875rem;
}

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

.form-field-checkbox input[type="checkbox"] {
  width: 1.25rem;
  height: 1.25rem;
  cursor: pointer;
}

.form-field-checkbox label {
  margin: 0;
  font-weight: 500;
  cursor: pointer;
}

/* Notification Banners */
.notification-banner {
  padding: 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.notification-banner.info {
  background: #3b82f6;
  color: white;
}

.notification-banner button {
  background: white;
  color: #3b82f6;
}

/* Layout Utilities */
.flex {
  display: flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

.gap-sm {
  gap: 0.5rem;
}

.gap-md {
  gap: 1rem;
}

/* Calendar Heatmap */
.calendar-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
}

.calendar-control-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.calendar-control-label {
  font-size: 0.8rem;
}

.calendar-year {
  margin-bottom: 2rem;
}

.calendar-year-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.calendar-year-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

.calendar-month {
  min-width: 0;
}

.calendar-svg-container {
  width: 100%;
  overflow: visible;
}

.calendar-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.calendar-year-gap {
  border-top: 2px dashed var(--border);
  margin: 0 0 1.5rem;
}

.calendar-day-label {
  font-size: 9px;
  fill: var(--text-secondary);
}

.calendar-month-label {
  font-weight: 600;
  fill: var(--text-primary);
}

.calendar-legend {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 1rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.calendar-legend-label {
  margin: 0 0.25rem;
}

.calendar-legend-cell {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 2px;
}

.calendar-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.calendar-legend-cv {
  font-size: 0.7rem;
  color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
  .button-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }

  .modal-content {
    width: 95%;
    padding: 1.5rem;
  }

  .calendar-year-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .calendar-year-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 769px) and (max-width: 1100px) {
  .calendar-year-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Tags */
.tag-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.tag {
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  display: inline-block;
}

.tag-editable {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tag-remove-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
  opacity: 0.7;
}

.tag-remove-btn:hover {
  opacity: 1;
}

/* Cards */
.item-card,
.collection-card,
.nav-card,
.tour-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.item-card:hover,
.collection-card:hover,
.nav-card:hover,
.tour-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  border-color: var(--primary-color);
}

.nav-card {
  display: block;
  text-decoration: none;
  color: var(--text-primary);
  padding: 1.5rem;
}

.nav-card h2 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--primary-color);
}

.nav-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Images */
.item-image,
.collection-image {
  width: 100%;
  height: 200px;
  object-fit: contain;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

/* Grids */
.item-grid,
.nav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.collection-grid {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  margin-top: 1rem;
}

.collection-grid .collection-card {
  flex: 0 0 250px;
  min-width: 250px;
}

/* Item Picker */
.item-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  max-height: 60vh;
  overflow-y: auto;
  padding: 0.5rem;
}

.item-picker-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.item-picker-item:hover {
  border-color: var(--primary-color);
  background: var(--background);
}

.item-picker-item.selected {
  border-color: var(--primary-color);
  background: rgba(59, 130, 246, 0.1);
}

.item-picker-image {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.item-picker-checkbox {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 20px;
  height: 20px;
}

/* Tag List */
.tag-list {
  margin-top: 2rem;
}

.tag-list-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  cursor: pointer;
  background: var(--surface);
  transition: all 0.2s;
}

.tag-list-item:hover {
  background: var(--background);
  border-color: var(--primary-color);
}

.tag-color-preview {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  flex-shrink: 0;
}

/* Tag Autocomplete */
.tag-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: 4px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
  margin-top: 0.25rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.tag-suggestion-item {
  padding: 0.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tag-suggestion-item:hover {
  background: var(--background);
}

.tag-suggestion-preview {
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
}

.tag-create-hint {
  color: var(--text-secondary);
  font-size: 0.875rem;
  padding: 0.5rem;
}

.tag-create-link {
  color: var(--primary-color);
  cursor: pointer;
  text-decoration: underline;
}

.tag-create-link:hover {
  color: #2563eb;
}

/* Color indicator */
.color-indicator {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-block;
}

/* Link styles */
/* Positioning */
.relative {
  position: relative;
}

/* Scrollable containers */
/* Color input special styling */
input[type="color"].form-field-input {
  height: 50px;
}

/* Margin utilities */
.mr-auto {
  margin-right: auto;
}

/* Tours */
.tour-dates {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

/* Flex utilities */
.flex-wrap {
  flex-wrap: wrap;
}

/* More utilities */
.flex-0 {
  flex: 0;
}

.flex-1 {
  flex: 1;
}

.pt-3 {
  padding-top: 1.5rem;
}

.w-full {
  width: 100%;
}

.form-field-flex1 {
  flex: 1;
  min-width: 180px;
}

.link-inherit {
  text-decoration: none;
  color: inherit;
}

.link-primary {
  color: var(--primary-color);
  text-decoration: underline;
  cursor: pointer;
}

/* Legacy specific classes */
.collection-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
}

.collection-item-card {
  border: 1px solid var(--border);
  padding: 0.5rem;
  border-radius: 4px;
  text-align: center;
}

.collection-item-image {
  width: 100%;
  height: 100px;
  object-fit: contain;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.btn-remove-small {
  margin-top: 0.5rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
}

/* Item picker grid specific sizing */
.item-picker-grid-small {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.item-picker-card {
  border: 2px solid;
  padding: 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}

.item-picker-image-small {
  width: 100%;
  height: 80px;
  object-fit: contain;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

/* Packing list container */
.packing-list-container {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.5rem;
}

.packing-list-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border-bottom: 1px solid #eee;
}

/* Dialog Component */
.dialog-message {
  margin: 1rem 0;
  line-height: 1.5;
}

.modal-content-small {
  max-width: 400px;
}

/* Packing Progress */
.packing-progress {
  padding: 0.75rem;
  background-color: #f5f5f5;
  border-radius: 4px;
  border: 1px solid #ddd;
}
