/* Залишаємо тільки те що Bootstrap не покриває або є специфічним для проекту */

:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ── Login ───────────────────────────────────────────────── */
.login-body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  position: relative;
  overflow: hidden;
}

/* Starfield: full-screen black layer; dots are injected by JS. */
.starfield {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.star {
  position: absolute;
  background: #fff;
  border-radius: 50%;
}

.star-tw { animation: starTwinkle 3s ease-in-out infinite; }
@keyframes starTwinkle { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }

.comet {
  --comet-angle: 18deg;
  --comet-end-x: 116vw;
  --comet-end-y: 34vh;
  --comet-start-x: -18vw;
  --comet-start-y: 18vh;
  animation: cometFly 15s linear infinite;
  height: 2px;
  left: 0;
  opacity: 0;
  position: fixed;
  top: 0;
  transform: translate3d(var(--comet-start-x), var(--comet-start-y), 0) rotate(var(--comet-angle));
  transform-origin: right center;
  width: 3cm;
  z-index: 0;
}

.comet::before {
  background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,.35) 55%, rgba(255,255,255,.9));
  border-radius: 999px;
  content: "";
  display: block;
  height: 100%;
  width: 100%;
}

.comet::after {
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(255,255,255,.9);
  content: "";
  height: 4px;
  position: absolute;
  right: -1px;
  top: -1px;
  width: 4px;
}

@keyframes cometFly {
  0%, 54% {
    opacity: 0;
    transform: translate3d(var(--comet-start-x), var(--comet-start-y), 0) rotate(var(--comet-angle));
  }
  58% { opacity: .95; }
  80% { opacity: .75; }
  88%, 100% {
    opacity: 0;
    transform: translate3d(var(--comet-end-x), var(--comet-end-y), 0) rotate(var(--comet-angle));
  }
}

@media (prefers-reduced-motion: reduce) {
  .star-tw,
  .comet { animation: none; }
}

/* White login card, centered above the starfield. */
.login-card {
  position: relative;
  z-index: 1;
  width: min(400px, calc(100vw - 32px));
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .55);
  padding: 40px 34px;
  color: #1f2937;
}

.login-logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 20px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  background: linear-gradient(135deg, #0d6efd, #6610f2);
  box-shadow: 0 10px 24px rgba(13, 110, 253, .35);
}

.login-card h1 {
  margin: 0 0 4px;
  font-size: 24px;
  font-weight: 700;
  text-align: center;
}

.login-sub {
  margin: 0 0 26px;
  text-align: center;
  color: #6b7280;
  font-size: 14px;
}

.login-field { display: block; margin-bottom: 16px; }

.login-field span {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  margin-bottom: 6px;
}

.login-field input {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 14px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  font-size: 15px;
  color: #111827;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.login-field input::placeholder { color: #9ca3af; }

.login-field input:focus {
  border-color: #0d6efd;
  box-shadow: 0 0 0 3px rgba(13, 110, 253, .25);
}

.login-btn {
  width: 100%;
  margin-top: 6px;
  padding: 12px 14px;
  border: 0;
  border-radius: 10px;
  background: #0d6efd;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .05s;
}

.login-btn:hover { background: #0b5ed7; }
.login-btn:active { transform: translateY(1px); }

.login-alert {
  margin-bottom: 18px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 14px;
}

/* ── Navbar toolbar ──────────────────────────────────────── */
.navbar-toolbar {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

.navbar-tool {
  align-items: center;
  display: inline-flex;
  height: 34px;
  justify-content: center;
  padding: 0;
  width: 34px;
}

.navbar-tool .bi {
  font-size: 16px;
  line-height: 1;
}

@media (max-width: 991.98px) {
  .navbar-toolbar {
    border-top: 1px solid var(--bs-border-color);
    margin-top: 8px;
    padding-top: 10px;
  }
}

/* ── Collection filter drawer ────────────────────────────── */
.collection-filter-tab {
  align-items: center;
  border-bottom-right-radius: 0;
  border-top-right-radius: 0;
  display: inline-flex;
  gap: 7px;
  padding: 10px 12px;
  position: fixed;
  right: 0;
  top: 42%;
  transform: translateY(-50%);
  writing-mode: vertical-rl;
  z-index: 1030;
}

.collection-filter-tab .bi {
  font-size: 16px;
}

.collection-filter-indicator {
  background: #ffc107;
  border: 2px solid #fff;
  border-radius: 50%;
  height: 10px;
  position: absolute;
  right: 4px;
  top: 4px;
  width: 10px;
}

.collection-filter-panel {
  --bs-offcanvas-width: min(390px, 94vw);
}

.min-w-0 {
  min-width: 0;
}

.period-accordion-label {
  align-items: center;
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
}

.period-accordion-button .period-count {
  flex: 0 0 3rem;
  margin-left: 16px;
  text-align: center;
}

.period-accordion-button::after {
  flex: 0 0 auto;
  margin-left: 12px;
}

@media (max-width: 575.98px) {
  .collection-filter-tab {
    bottom: 20%;
    top: auto;
    transform: none;
  }
}

/* ── Country sidebar ─────────────────────────────────────── */
.country-list {
  max-height: calc(100vh - 200px);
  overflow-y: auto;
}

/* Bootstrap d-flex використовує !important, тому потрібен власний клас
   який йде ПІСЛЯ Bootstrap у каскаді і також має !important */
.country-hidden {
  display: none !important;
}

/* ── Empty state ─────────────────────────────────────────── */
.empty-state {
  align-items: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 360px;
  padding: 32px;
  text-align: center;
}

/* ── Coin cards grid ─────────────────────────────────────── */
.coin-card-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  padding: 14px;
}

.coin-card {
  overflow: hidden;
}

.coin-image-carousel {
  background: #f1f5f9;
}

.coin-image-placeholder {
  align-items: center;
  aspect-ratio: 4 / 3;
  color: #64748b;
  display: flex;
  font-weight: 700;
  justify-content: center;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.coin-image-frame {
  aspect-ratio: 4 / 3;
  background: #f8fafc;
  position: relative;
}

.coin-image-frame img {
  height: 100%;
  object-fit: contain;
  padding: 12px;
  width: 100%;
}

.coin-image-caption {
  align-items: center;
  background: rgb(15 23 42 / 0.74);
  bottom: 0;
  color: #fff;
  display: flex;
  font-size: 12px;
  justify-content: space-between;
  left: 0;
  padding: 6px 10px;
  position: absolute;
  right: 0;
}

.coin-image-caption a {
  color: #dbeafe;
}

.coin-card-meta {
  display: grid;
  gap: 3px 10px;
  grid-template-columns: max-content 1fr;
  margin: 0;
}

.coin-card-meta dt {
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
}

.coin-card-meta dd {
  font-size: 12px;
  margin: 0;
}

/* ── Grade badge (білий текст поверх кольорового фону) ───── */
.grade-badge {
  color: #fff;
}

/* ── Storage location thumbnail ──────────────────────────── */
.storage-photo-cell {
  width: 96px;
}

.storage-thumb {
  align-items: center;
  aspect-ratio: 4 / 3;
  background: #f1f5f9;
  border: 1px solid #dbe3ef;
  border-radius: 6px;
  color: #64748b;
  display: flex;
  font-size: 12px;
  justify-content: center;
  object-fit: cover;
  width: 80px;
}

/* ── Media library ───────────────────────────────────────── */
.media-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  padding: 14px;
}

.media-card {
  overflow: hidden;
}

.media-thumb {
  aspect-ratio: 4 / 3;
  background: #f8fafc;
  border-bottom: 1px solid #e5eaf1;
}

.media-thumb img {
  height: 100%;
  object-fit: contain;
  padding: 10px;
  width: 100%;
}

.media-meta {
  display: grid;
  gap: 3px 10px;
  grid-template-columns: max-content 1fr;
  margin: 0 0 12px;
}

.media-meta dt {
  color: #64748b;
  font-size: 12px;
}

.media-meta dd {
  font-size: 12px;
  margin: 0;
  overflow-wrap: anywhere;
}

.media-modal-image {
  display: block;
  max-height: 75vh;
  max-width: 100%;
  object-fit: contain;
  width: 100%;
}

/* ── Circle crop editor ──────────────────────────────────── */
.crop-editor-wrap {
  align-items: center;
  background: #0f172a;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  min-height: 280px;
  overflow: auto;
  padding: 12px;
}

#cropEditorCanvas {
  background: #111827;
  cursor: grab;
  max-height: 68vh;
  max-width: 100%;
  touch-action: none;
}

#cropEditorCanvas:active {
  cursor: grabbing;
}
