/* Watches — index and detail pages */

/* ── Page shell ─────────────────────────────────────────────────────────── */

.watches-page {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.watches-page__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  gap: 1rem;
}

.watches-page__title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.watches-page__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ── Toolbar ─────────────────────────────────────────────────────────────── */

.watches-page__toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1rem;
}

/* ── View toggle ─────────────────────────────────────────────────────────── */

.view-toggle {
  display: flex;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.view-toggle__btn {
  background: transparent;
  border: none;
  color: var(--color-muted);
  cursor: pointer;
  padding: 0.4rem 0.65rem;
  line-height: 1;
  font-size: 1rem;
  transition: background 0.15s, color 0.15s;
}

.view-toggle__btn[aria-pressed="true"] {
  background: var(--color-surface);
  color: var(--color-accent);
}

.view-toggle__btn:hover {
  color: var(--color-text);
}

/* ── Grid view ───────────────────────────────────────────────────────────── */

.watches-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.watch-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: calc(var(--radius) * 1.5);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s, transform 0.15s;
}

.watch-card:hover {
  border-color: var(--color-accent);
  transform: translateY(-2px);
}

.watch-card__cover {
  aspect-ratio: 1;
  background: var(--color-surface-raised);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-border);
  font-size: 2.5rem;
  overflow: hidden;
}

.watch-card__cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.watch-card__body {
  padding: 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
}

.watch-card__brand {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.watch-card__model {
  font-size: 0.95rem;
  font-weight: 600;
}

/* ── List view ───────────────────────────────────────────────────────────── */

.watches-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.watch-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.875rem 1.125rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s;
}

.watch-row:hover {
  border-color: var(--color-accent);
}

.watch-row__cover {
  width: 42px;
  height: 42px;
  border-radius: calc(var(--radius) * 0.75);
  background: var(--color-surface-raised);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-border);
  font-size: 1.25rem;
  flex-shrink: 0;
  overflow: hidden;
}

.watch-row__cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: calc(var(--radius) * 0.75);
}

.watch-row__info {
  flex: 1;
  min-width: 0;
}

.watch-row__brand {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.watch-row__model {
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.watch-row__ref {
  font-size: 0.8rem;
  color: var(--color-muted);
}

.watch-row__right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

/* ── Condition badge ─────────────────────────────────────────────────────── */

.condition-badge {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border-radius: 99px;
  border: 1px solid;
}

.condition-badge--unworn   { color: var(--badge-unworn);    border-color: color-mix(in srgb, var(--badge-unworn)    30%, transparent); background: color-mix(in srgb, var(--badge-unworn)    10%, transparent); }
.condition-badge--mint     { color: var(--badge-mint);      border-color: color-mix(in srgb, var(--badge-mint)      30%, transparent); background: color-mix(in srgb, var(--badge-mint)      10%, transparent); }
.condition-badge--excellent{ color: var(--badge-excellent); border-color: color-mix(in srgb, var(--badge-excellent) 30%, transparent); background: color-mix(in srgb, var(--badge-excellent) 10%, transparent); }
.condition-badge--good     { color: var(--badge-good);      border-color: color-mix(in srgb, var(--badge-good)      30%, transparent); background: color-mix(in srgb, var(--badge-good)      10%, transparent); }
.condition-badge--fair     { color: var(--badge-fair);      border-color: color-mix(in srgb, var(--badge-fair)      30%, transparent); background: color-mix(in srgb, var(--badge-fair)      10%, transparent); }

/* ── Empty state ─────────────────────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 5rem 1.5rem;
  color: var(--color-muted);
}

.empty-state__icon {
  font-size: 3rem;
  margin-bottom: 1.25rem;
  opacity: 0.4;
}

.empty-state__title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.5rem;
}

.empty-state__body {
  font-size: 0.9rem;
  margin-bottom: 1.75rem;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

/* ── Detail page ─────────────────────────────────────────────────────────── */

.watch-detail {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.watch-detail__nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  gap: 1rem;
}

.watch-detail__nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.watch-detail__back {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.875rem;
  color: var(--color-muted);
  text-decoration: none;
}

.watch-detail__back:hover { color: var(--color-text); }

.watch-detail__header {
  margin-bottom: 2rem;
}

.watch-detail__brand {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 0.35rem;
}

.watch-detail__model {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.watch-detail__ref {
  font-size: 0.9rem;
  color: var(--color-muted);
  margin-top: 0.35rem;
}

.watch-detail__cover {
  aspect-ratio: 4/3;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: calc(var(--radius) * 1.5);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-border);
  font-size: 4rem;
  margin-bottom: 2rem;
}

/* ── Photo gallery ───────────────────────────────────────────────────────── */

.photo-gallery {
  margin-bottom: 2rem;
}

.photo-gallery__cover {
  aspect-ratio: 4/3;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: calc(var(--radius) * 1.5);
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.photo-gallery__cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-gallery__thumbs {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.photo-gallery__thumb {
  position: relative;
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid transparent;
  transition: border-color 0.15s;
}

.photo-gallery__thumb--active {
  border-color: var(--color-accent);
}

.photo-gallery__thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-gallery__thumb-actions {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  opacity: 0;
  transition: opacity 0.15s;
}

.photo-gallery__thumb:hover .photo-gallery__thumb-actions {
  opacity: 1;
}

.photo-gallery__btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: calc(var(--radius) * 0.5);
  color: #fff;
  cursor: pointer;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.35rem;
  line-height: 1.2;
  transition: background 0.1s;
}

.photo-gallery__btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.photo-gallery__btn--delete {
  color: #ffb3b3;
  border-color: rgba(255, 100, 100, 0.5);
}

.photo-gallery__btn--delete:hover {
  background: rgba(220, 50, 50, 0.4);
}

.photo-gallery__single-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

/* ── Form file input ─────────────────────────────────────────────────────── */

.watch-form__file-input {
  font-size: 0.9rem;
  color: var(--color-text);
}

.watch-form__hint {
  font-size: 0.78rem;
  color: var(--color-muted);
  margin: 0;
}

.watch-detail__fields {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: calc(var(--radius) * 1.5);
  overflow: hidden;
}

.watch-detail__field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.875rem 1.25rem;
  gap: 1rem;
}

.watch-detail__field + .watch-detail__field {
  border-top: 1px solid var(--color-border);
}

.watch-detail__field-label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-muted);
  flex-shrink: 0;
}

.watch-detail__field-value {
  font-size: 0.95rem;
  text-align: right;
}

.watch-detail__notes {
  margin-top: 1.5rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: calc(var(--radius) * 1.5);
  padding: 1.25rem;
}

.watch-detail__notes-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: 0.75rem;
}

.watch-detail__notes-body {
  font-size: 0.95rem;
  line-height: 1.7;
  white-space: pre-wrap;
}

/* ── Form page ───────────────────────────────────────────────────────────── */

.watch-form-page {
  max-width: 640px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.watch-form-page__header {
  margin-bottom: 2rem;
}

.watch-form-page__title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-top: 0.75rem;
}

.watch-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

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

.watch-form__field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.watch-form__field label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.watch-form__field input,
.watch-form__field select,
.watch-form__field textarea {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text);
  font-size: 0.95rem;
  padding: 0.6rem 0.85rem;
  width: 100%;
  transition: border-color 0.15s;
}

.watch-form__field input:focus,
.watch-form__field select:focus,
.watch-form__field textarea:focus {
  outline: none;
  border-color: var(--color-accent);
}

.watch-form__field select option {
  background: var(--color-surface);
}

.watch-form__field textarea {
  resize: vertical;
}

.watch-form__errors {
  background: color-mix(in srgb, var(--color-error) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-error) 35%, transparent);
  border-radius: var(--radius);
  padding: 0.875rem 1rem;
  font-size: 0.9rem;
  color: var(--color-error);
}

.watch-form__errors ul {
  margin: 0;
  padding-left: 1.25rem;
}

.watch-form__actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  padding-top: 0.5rem;
}

/* ── Service status ──────────────────────────────────────────────────────── */

.service-status {
  margin-top: 1.5rem;
}

.service-status__fields {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: calc(var(--radius) * 1.5);
  overflow: hidden;
}

.service-badge {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border-radius: 99px;
  border: 1px solid;
  margin-left: 0.5rem;
}

.service-badge--ok {
  color: var(--badge-mint);
  border-color: color-mix(in srgb, var(--badge-mint) 30%, transparent);
  background: color-mix(in srgb, var(--badge-mint) 10%, transparent);
}

.service-badge--due_soon {
  color: var(--badge-fair);
  border-color: color-mix(in srgb, var(--badge-fair) 30%, transparent);
  background: color-mix(in srgb, var(--badge-fair) 10%, transparent);
}

.service-badge--overdue {
  color: var(--color-error);
  border-color: color-mix(in srgb, var(--color-error) 30%, transparent);
  background: color-mix(in srgb, var(--color-error) 10%, transparent);
}

/* ── Warranty status ─────────────────────────────────────────────────────── */

.warranty-status {
  margin-top: 1.5rem;
}

.warranty-status__fields {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: calc(var(--radius) * 1.5);
  overflow: hidden;
}

.warranty-badge {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border-radius: 99px;
  border: 1px solid;
  margin-left: 0.5rem;
}

.warranty-badge--active {
  color: var(--badge-mint);
  border-color: color-mix(in srgb, var(--badge-mint) 30%, transparent);
  background: color-mix(in srgb, var(--badge-mint) 10%, transparent);
}

.warranty-badge--expiring_soon {
  color: var(--badge-fair);
  border-color: color-mix(in srgb, var(--badge-fair) 30%, transparent);
  background: color-mix(in srgb, var(--badge-fair) 10%, transparent);
}

.warranty-badge--expired {
  color: var(--color-error);
  border-color: color-mix(in srgb, var(--color-error) 30%, transparent);
  background: color-mix(in srgb, var(--color-error) 10%, transparent);
}

/* ── Toggle switch ───────────────────────────────────────────────────────── */

.toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
}

.toggle__input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle__track {
  display: block;
  width: 40px;
  height: 22px;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: 99px;
  transition: background 0.2s, border-color 0.2s;
}

.toggle__track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: var(--color-muted);
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}

.toggle__input:checked + .toggle__track {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.toggle__input:checked + .toggle__track::after {
  transform: translateX(18px);
  background: var(--btn-primary-text);
}

.watch-form__field--inline {
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
}

.watch-form__toggle-label {
  font-size: 0.9rem;
}

/* ── Service history ─────────────────────────────────────────────────────── */

.service-history {
  margin-top: 2rem;
}

.service-history__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.service-history__title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.service-history__list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.service-history__empty {
  font-size: 0.9rem;
  color: var(--color-muted);
  padding: 1.25rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: calc(var(--radius) * 1.5);
  text-align: center;
}

.service-record {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: calc(var(--radius) * 1.5);
  padding: 1rem 1.25rem;
}

.service-record__main {
  flex: 1;
  min-width: 0;
}

.service-record__type {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.service-record__meta {
  font-size: 0.8rem;
  color: var(--color-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
}

.service-record__sep {
  color: var(--color-border);
}

.service-record__notes {
  font-size: 0.85rem;
  color: var(--color-muted);
  margin-top: 0.5rem;
  white-space: pre-wrap;
}

.service-record__right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  flex-shrink: 0;
}

.service-record__cost {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-accent);
}

.service-record__actions {
  display: flex;
  gap: 0.4rem;
}

/* ── Export ──────────────────────────────────────────────────────────────── */

.export-tagline {
  font-size: 0.78rem;
  color: var(--color-muted);
  margin-top: 0.5rem;
}

.export-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
  .watches-page { padding: 1.25rem 1rem; }
  .watches-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .watch-detail { padding: 1.25rem 1rem; }
  .watch-detail__model { font-size: 1.5rem; }
  .watch-form-page { padding: 1.25rem 1rem; }
  .watch-form__row { grid-template-columns: 1fr; }
}
