/* ========================================
   COMMON CSS - Reusable Patterns
   Shared styles across all admin pages
   ======================================== */

:root {
  --lang-status-filled: #4caf50;
  --lang-status-empty: #f44336;
  --lang-status-required: #1976d2;
}

/* ── Card Patterns ── */
.mdc-card {
  margin-bottom: 16px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.card-content-wrapper {
  margin-left: 16px;
  margin-right: 16px;
}

/* ── Section Title ── */
.section-title {
  font-size: 20px;
  font-weight: 500;
  margin: 0;
  color: #333;
}

.section-subtitle {
  font-size: 12px;
  color: #666;
  font-family: monospace;
}

/* ── Filters ── */
.filters {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filters__row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
}

.filters__separator {
  width: 1px;
  height: 36px;
  background: #ccc;
  align-self: flex-end;
  margin: 0 4px;
}

.filters__actions {
  display: flex;
  gap: 6px;
  align-items: flex-end;
  margin-left: auto;
  flex-shrink: 0;
}

.filters-form {
  margin: 0;
}

.filters__row .filter-field {
  flex: 1;
  min-width: 100px;
}

.filters-form .filter-field__input {
  width: 100%;
  box-sizing: border-box;
}

.filters-form .filter-multiselect__trigger {
  width: 100%;
  box-sizing: border-box;
}

/* ── Filter Field ── */
.filter-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.filter-field--wide .filter-field__input {
  width: 200px;
}

.filter-field__label {
  font-size: 11px;
  font-weight: 500;
  color: #777;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-field__input-wrap {
  display: flex;
  align-items: center;
  position: relative;
}

.filter-field__input {
  width: 120px;
  height: 32px;
  padding: 0 28px 0 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  color: #333;
  box-sizing: border-box;
}

.filter-field__input::placeholder {
  color: #aaa;
}

.filter-field__input:focus {
  outline: none;
  border-color: #6200ee;
}

.filter-field__input:disabled {
  background: #f0f0f0;
  color: #999;
  cursor: not-allowed;
}

.filter-field__icon {
  position: absolute;
  right: 2px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
  color: #888;
  display: flex;
  align-items: center;
}

.filter-field__icon:hover {
  color: #6200ee;
}

.filter-field__icon .material-icons {
  font-size: 18px;
}

.filter-field__select {
  appearance: none;
  cursor: pointer;
  padding-right: 24px;
}

.filter-field__arrow {
  position: absolute;
  right: 4px;
  pointer-events: none;
  color: #888;
  font-size: 20px;
}

/* Records Per Page - moved to layout.css */

/* ── Table Patterns ── */
.table-wrapper {
  position: relative;
}

.table-container {
  overflow-x: auto;
  margin-bottom: 16px;
}

.mdc-data-table {
  width: 100%;
}

.mdc-data-table__table {
  width: 100%;
  border-collapse: collapse;
}

.mdc-data-table__row,
.mdc-data-table__header-row {
  height: 36px;
}

.mdc-data-table__row {
  cursor: pointer;
  transition: background-color 0.2s;
}

.mdc-data-table__row:hover {
  background-color: rgba(0, 0, 0, 0.04);
}

.mdc-data-table__header-row {
  background: #f5f5f5;
}

.mdc-data-table__header-cell,
.mdc-data-table__cell {
  padding: 4px 12px;
}

.mdc-data-table__header-cell {
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  line-height: 28px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #666;
  border-bottom: 1px solid #e0e0e0;
  white-space: nowrap;
}

.mdc-data-table__header-cell.sortable {
  cursor: pointer;
  user-select: none;
}

.mdc-data-table__header-cell.sortable:hover {
  background: #eeeeee;
}

.mdc-data-table__cell {
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
  font-size: 13px;
}

.mdc-data-table__row:last-child .mdc-data-table__cell {
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
}

.sort-icon {
  font-size: 16px;
  vertical-align: middle;
  margin-left: 4px;
}

/* ── Table Loader ── */
.table-loader {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background-color: rgba(255, 255, 255, 0.8);
  border-radius: 4px;
  z-index: 1000;
  pointer-events: none;
}

.htmx-indicator {
  display: none;
}

.htmx-indicator.htmx-request {
  display: flex;
}

.htmx-request .table-loader,
.htmx-request #table-loader {
  display: flex !important;
}

.spinner {
  margin-right: 10px;
}

.spinner-circle {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-top-color: #6200ee;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* ── Pagination ── */
.pagination {
  display: flex;
  gap: 4px;
  justify-content: center;
  align-items: center;
}

/* Pagination styles moved to layout.css */

/* ── Property Tags ── */
.property-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-top: 2px;
}

.property-tag {
  background-color: #e0e0e0;
  color: #333;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 11px;
  white-space: nowrap;
}

/* ── Sort Bar ── */
.sort-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 8px;
  font-size: 12px;
}

.sort-bar__label {
  color: #888;
  margin-right: 2px;
}

.sort-bar__btn {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px 10px;
  border: 1px solid #ddd;
  border-radius: 14px;
  background: #fff;
  font-size: 12px;
  font-family: inherit;
  color: #555;
  cursor: pointer;
  user-select: none;
}

.sort-bar__btn:hover {
  border-color: #aaa;
  background: #f5f5f5;
}

.sort-bar__btn--active {
  border-color: #6200ee;
  color: #6200ee;
  background: #f3e8ff;
}

/* ── Detail Page Patterns ── */
.detail-top {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
}

.detail-top__thumb {
  flex-shrink: 0;
}

.detail-top__img {
  width: 200px;
  height: 200px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}

.detail-top__img--empty {
  width: 200px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f0f0;
  border-radius: 6px;
  color: #bbb;
}

.detail-top__img--empty .material-icons {
  font-size: 48px;
}

.detail-top__info {
  flex: 1;
  min-width: 0;
}

.detail-top__fields {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.detail-section {
  margin-bottom: 20px;
}

.detail-section-title {
  font-size: 14px;
  font-weight: 500;
  color: #333;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid #e0e0e0;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.detail-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.detail-field--full {
  grid-column: 1 / -1;
}

.detail-label {
  font-size: 11px;
  font-weight: 500;
  color: #888;
  text-transform: uppercase;
}

.detail-value {
  font-size: 14px;
  color: #333;
  word-break: break-word;
}

.detail-value a {
  color: #6200ee;
  text-decoration: none;
}

.detail-value a:hover {
  text-decoration: underline;
}

.detail-description {
  font-size: 14px;
  line-height: 1.6;
  color: #333;
  white-space: pre-wrap;
}

.detail-description p {
  margin: 0 0 8px;
}

.detail-images {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.detail-thumbnail {
  width: 150px;
  height: 100px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #e0e0e0;
  transition: transform 0.2s;
}

.detail-thumbnail:hover {
  transform: scale(1.05);
}

/* ── Header Actions ── */
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ── List Item Patterns (Events/Attractions) ── */
.item-list {
  display: flex;
  flex-direction: column;
  margin-bottom: 16px;
}

.item-list__empty {
  padding: 32px;
  text-align: center;
  color: #999;
  font-size: 14px;
}

/* ── Item Row Pattern ── */
.item-row {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition: background-color 0.15s;
}

.item-row:hover {
  background-color: rgba(0, 0, 0, 0.03);
}

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

.item-row__thumb {
  flex-shrink: 0;
}

.item-row__img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 4px;
  display: block;
}

.item-row__img--empty {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f0f0;
  border-radius: 4px;
  color: #bbb;
}

.item-row__img--empty .material-icons {
  font-size: 28px;
}

.item-row__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
}

.item-row__line1 {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.item-row__title {
  font-size: 14px;
  font-weight: 500;
  color: #222;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}

.item-row__tags {
  display: inline-flex;
  gap: 3px;
}

.item-row__meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #888;
  white-space: nowrap;
  flex-shrink: 0;
}

.item-row__line2 {
  font-size: 13px;
  color: #555;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-row__line3 {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: #777;
}

/* ── Clickable Row ── */
.clickable-row {
  cursor: pointer;
}

/* ── No Data Message ── */
.no-data {
  color: #666;
  font-style: italic;
}

/* ── Generic multi-select dropdown for filter forms ── */
.filter-multiselect {
  position: relative;
}

.filter-multiselect__trigger {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 200px;
  height: 32px;
  padding: 0 4px 0 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  font-size: 13px;
  font-family: inherit;
  color: #333;
  cursor: pointer;
  text-align: left;
}

.filter-multiselect__trigger:hover {
  border-color: #999;
}

.filter-multiselect__trigger:focus {
  outline: none;
  border-color: #6200ee;
}

.filter-multiselect__trigger span {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-multiselect__arrow {
  font-size: 20px;
  color: #888;
  transition: transform 0.15s;
}

.filter-multiselect__arrow--open {
  transform: rotate(180deg);
}

.filter-multiselect__dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 200;
  width: 260px;
  margin-top: 2px;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.filter-multiselect__search {
  padding: 6px;
  border-bottom: 1px solid #eee;
}

.filter-multiselect__search-input {
  width: 100%;
  height: 28px;
  padding: 0 8px;
  border: 1px solid #ddd;
  border-radius: 3px;
  font-size: 12px;
  font-family: inherit;
  box-sizing: border-box;
}

.filter-multiselect__search-input:focus {
  outline: none;
  border-color: #6200ee;
}

.filter-multiselect__actions {
  display: flex;
  gap: 4px;
  padding: 4px 6px;
  border-bottom: 1px solid #eee;
}

.filter-multiselect__actions button {
  background: none;
  border: none;
  font-size: 11px;
  color: #6200ee;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 2px;
}

.filter-multiselect__actions button:hover {
  background: #f3e8ff;
}

.filter-multiselect__list {
  max-height: 220px;
  overflow-y: auto;
  padding: 4px 0;
}

.filter-multiselect__group-label {
  padding: 6px 10px 2px;
  font-size: 11px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-multiselect__item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 20px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}

.filter-multiselect__item:hover {
  background: #f5f5f5;
}

.filter-multiselect__item input[type="checkbox"] {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: #6200ee;
  flex-shrink: 0;
}

/* ── Language Coverage Badges ── */
.lang-tags {
  display: inline-flex;
  gap: 3px;
}

.lang-tag {
  padding: 1px 5px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.lang-tag--complete {
  background-color: #e8f5e9;
  color: var(--lang-status-filled);
}

.lang-tag--missing {
  background-color: #ffebee;
  color: var(--lang-status-empty);
}

.lang-tag--queued {
  background-color: #fff8e1;
  color: #f57f17;
}

.translate-status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0 4px;
  font-size: .85em;
  color: #555;
  min-height: 28px;
}

/* ── Icon Colors ── */
.icon-green {
  color: #4caf50;
}

.icon-red {
  color: #f44336;
}

.icon-small {
  font-size: 16px;
  margin: 0 2px;
  vertical-align: middle;
}
