/* Additional custom styles for TravelList */

/* Section headers with buttons aligned to the right */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

/* Remove background and border from sections */
.travelers-section,
.timelines-section,
.categories-section,
.category-item,
.traveler-item,
.timeline-item,
.checklist-categories,
.items-list,
.checklist-tab-content,
.traveler-tab-content {
  margin-bottom: 2rem;
  padding: 0;
  background: none;
  border: none;
  box-shadow: none;
}

/* Category spacing */
.category-item {
  margin-bottom: 3rem;
  padding: 0;
}

/* Traveler and timeline spacing */
.traveler-item,
.timeline-item {
  margin-bottom: 1.5rem;
  padding: 0;
}

/* Style the site title link */
.site-title a {
  color: var(--primary-color);
  text-decoration: none;
  transition: var(--transition);
}

.site-title a:hover {
  color: var(--primary-dark);
}

/* Make the "Add Item" button primary color */
.add-item {
  background-color: var(--primary-color) !important;
  color: white !important;
}

/* Grid-based table alternative */
.grid-table {
  display: grid;
  width: 100%;
  max-width: 916px;
  font-size: 13px;
  margin-bottom: 1rem;
}

/* Timeline column for template items */
.grid-cell-timeline {
  text-align: left;
}

/* Header row */
.grid-table-header {
  display: grid;
  grid-template-columns: 20px 1fr 50px 80px;
  border-bottom: 1px solid #aaa;
  font-weight: 500;
  color: #666;
  padding: 3px 0;
}

/* For tables with category column (timeline view) */
.grid-table-header.with-category {
  grid-template-columns: 20px 1fr 50px 100px 100px 80px;
}

/* For tables with traveler column (edit mode) */
.grid-table-header.with-traveler {
  grid-template-columns: 1fr 50px 150px 80px;
}

/* For tables with traveler and trip types columns */
.grid-table-header.with-traveler.with-trip-types {
  grid-template-columns: 1fr 50px 150px 150px 80px;
}

/* For tables without traveler column (traveler-specific tabs) */
.grid-table-header.without-traveler {
  grid-template-columns: 20px 1fr 50px 80px;
}

.grid-table-header > div {
  padding: 3px 5px;
  text-align: left;
}

/* Row styles */
.grid-table-row {
  display: grid;
  grid-template-columns: 20px 1fr 50px 80px;
  border-top: 1px dotted #aaa;
  height: 21px;
  align-items: center;
}

/* For tables with category column (timeline view) */
.grid-table-row.with-category {
  grid-template-columns: 20px 1fr 50px 100px 100px 80px;
}

/* For tables with traveler column (edit mode) */
.grid-table-row.with-traveler {
  grid-template-columns: 1fr 50px 150px 80px;
}

/* For tables with traveler and trip types columns */
.grid-table-row.with-traveler.with-trip-types {
  grid-template-columns: 1fr 50px 150px 150px 80px;
}

/* For tables without traveler column (traveler-specific tabs) */
.grid-table-row.without-traveler {
  grid-template-columns: 20px 1fr 50px 80px;
}

.grid-table-row > div {
  padding: 2px 5px;
  height: 21px;
  display: flex;
  align-items: center;
}

/* Cell styles */
.grid-cell-checkbox {
  text-align: center;
  justify-content: center;
}

.grid-cell-name {
  text-align: left;
}

.grid-cell-quantity {
  text-align: center;
  justify-content: center;
  color: var(--light-text);
}

.grid-cell-traveler {
  text-align: left;
  word-break: break-word;
  overflow-wrap: break-word;
  line-height: 1.2;
}

.grid-cell-trip-types {
  text-align: left;
  word-break: break-word;
  overflow-wrap: break-word;
  line-height: 1.2;
  color: var(--primary-color);
  font-size: 0.9em;
}

.grid-cell-category {
  text-align: left;
}

.grid-cell-actions {
  text-align: right;
  justify-content: flex-end;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .grid-table-header,
  .grid-table-header.with-category,
  .grid-table-header.with-traveler,
  .grid-table-header.with-traveler.with-trip-types,
  .grid-table-header.without-traveler {
    grid-template-columns: 20px 1fr 50px 80px;
  }

  .grid-table-row,
  .grid-table-row.with-category,
  .grid-table-row.with-traveler,
  .grid-table-row.with-traveler.with-trip-types,
  .grid-table-row.without-traveler {
    grid-template-columns: 20px 1fr 50px 80px;
  }

  .grid-cell-traveler,
  .grid-cell-category,
  .grid-cell-trip-types {
    display: none;
  }
}

/* Keep the old table styles for backward compatibility */
.items-table {
  width: 100%;
  max-width: 916px;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 1rem;
}

/* Make sure list tables are full width */
#templates-list .items-table,
#checklists-list .items-table {
  width: 100%;
  max-width: 916px;
  margin: 0 auto;
}

/* Make sure list containers are full width */
#templates-list,
#checklists-list,
.templates-list,
.checklists-list {
  width: 100%;
  max-width: 916px;
  margin: 0 auto;
}

/* Ensure container width is consistent */
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 15px;
}

/* Force tables to be full width */
.app-view table.items-table {
  width: 100% !important;
  max-width: 916px !important;
  margin: 0 auto !important;
  table-layout: fixed;
}

/* Ensure view headers are also properly sized */
.view-header {
  width: 100%;
  max-width: 916px;
  margin: 0 auto 1rem;
}

.items-table thead th {
  text-align: left;
  padding: 3px 5px;
  border-bottom: 1px solid #aaa;
  font-weight: 500;
  color: #666;
}

.items-table tbody tr {
  border-top: 1px dotted #aaa;
  height: 21px;
}

.items-table tfoot tr {
  border-top: 1px solid #aaa;
}

.items-table tbody td,
.items-table tfoot td {
  padding: 2px 5px;
  vertical-align: middle;
  height: 21px;
}

.items-table .item-checkbox {
  width: 20px;
}

.items-table .item-name {
  width: auto;
}

.items-table .item-quantity {
  width: 50px;
  text-align: center;
  color: var(--light-text);
}

.items-table .item-traveler {
  width: 120px;
}

.items-table .item-category {
  width: 100px;
}

.items-table .item-actions {
  width: 80px;
  text-align: right;
}

/* Small button styles for all grid and table views */
.grid-table .btn-sm,
.items-table .btn-sm {
  padding: 1px 3px;
  font-size: 10px;
  margin-left: 2px;
  line-height: 1.2;
}

/* Normal buttons for action areas */
.timeline-actions .btn,
.category-actions .btn,
.traveler-actions .btn {
  padding: 4px 8px;
  font-size: 12px;
  margin-left: 4px;
}

/* Empty state styling */
.empty-state {
  color: #999;
  font-style: italic;
  text-align: center;
  padding: 1rem;
}

/* Tighter spacing for items */
.checklist-item {
  padding: 0.3rem 0;
  border-top: 1px dotted #aaa;
  height: 21px;
  font-size: 13px;
}

/* Tabs for checklist and template views */
.checklist-tabs,
.template-editor-tabs,
.checklist-editor-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
}

.checklist-tab,
.template-tab,
.checklist-editor-tab {
  padding: 0.5rem 1rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-right: 0.5rem;
}

.checklist-tab.active,
.template-tab.active,
.checklist-editor-tab.active {
  border-bottom: 2px solid var(--primary-color);
  color: var(--primary-color);
  font-weight: 500;
}

.checklist-tab-content,
.template-tab-content,
.checklist-editor-tab-content {
  display: none;
}

.checklist-tab-content.active,
.template-tab-content.active,
.checklist-editor-tab-content.active {
  display: block;
}

/* Traveler tabs for checklist */
.traveler-tabs {
  display: flex;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.traveler-tab {
  padding: 0.3rem 0.8rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-size: 0.9rem;
}

.traveler-tab.active {
  border-bottom: 2px solid var(--primary-color);
  color: var(--primary-color);
}

.traveler-tab-content {
  display: none;
}

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

/* Make the template and checklist cards more compact */
.template-card,
.checklist-card {
  padding: 1rem;
  margin-bottom: 1rem;
}

.card-title {
  font-size: 1.1rem;
}

.card-description {
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

/* Fix for the template selection in create checklist modal */
.template-select-item {
  margin-bottom: 0.5rem;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
}

.template-select-item label {
  display: flex;
  align-items: center;
  margin-bottom: 0.25rem;
}

.template-select-item input[type="radio"] {
  margin-right: 0.5rem;
}

.template-name {
  font-weight: 500;
}

.template-description {
  margin-left: 1.5rem;
  font-size: 0.9rem;
  color: var(--light-text);
}

/* Fix for the checklist view */
.checklist-summary {
  margin-bottom: 1rem;
}

/* Common items vs. personal items */
.common-items,
.personal-items {
  margin-bottom: 1.5rem;
}

.common-items h4,
.personal-items h4 {
  margin-bottom: 0.5rem;
  font-size: 1rem;
  color: var(--light-text);
}

/* Date range inputs */
.date-range .date-inputs {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.date-range .date-input {
  flex: 1;
}

.date-range .date-input label {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
}

.trip-length-display {
  font-size: 0.9rem;
  color: var(--light-text);
  margin-top: 0.5rem;
}

/* Scaling options */
.scaling-inputs {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.scaling-input {
  flex: 1;
}

.scaling-input label {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
}

.scaling-options {
  margin: 0.5rem 0;
}

.scaling-options .checkbox-group {
  display: flex;
  gap: 1rem;
}

.scaling-options label {
  font-size: 0.85rem;
  display: flex;
  align-items: center;
}

.scaling-options input[type="checkbox"] {
  margin-right: 0.25rem;
}

.calculated-quantity {
  font-size: 0.9rem;
  color: var(--primary-color);
  font-weight: 500;
  margin-top: 0.5rem;
  padding: 0.25rem;
  background-color: rgba(var(--primary-rgb), 0.1);
  border-radius: 4px;
}

/* Hide elements */
.hidden {
  display: none !important;
}

/* Scaled quantity indicator */
.scaled-quantity {
  color: var(--primary-color);
  font-weight: 500;
  cursor: help;
  position: relative;
}

.scaled-quantity::after {
  content: '⚖️';
  font-size: 0.8em;
  margin-left: 2px;
  vertical-align: super;
}

/* Timeline days indicator */
.timeline-days {
  font-size: 0.8rem;
  color: var(--light-text);
  font-weight: normal;
  background-color: rgba(var(--primary-rgb), 0.1);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  margin-left: 0.5rem;
}

/* Footer actions for template and checklist editors */
.template-footer-actions,
.checklist-footer-actions {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
}

/* Item traveler and category badges */
.item-traveler,
.item-category {
  font-size: 0.8rem;
  color: var(--light-text);
  background-color: rgba(var(--primary-rgb), 0.1);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  margin-left: 0.5rem;
  display: inline-block;
}

.item-traveler {
  background-color: rgba(var(--accent-rgb), 0.1);
  color: var(--accent-color);
}

.item-category {
  background-color: rgba(var(--secondary-rgb), 0.1);
  color: var(--secondary-color);
}
