/* ───────────────────────────────────────────
   Antalya Kuyumcular – Design System
   ─────────────────────────────────────────── */

/* Root font-size scales with viewport height.
   At 1080px → ~22.4px,  720px → ~14.9px,  1440px → ~29.8px.
   Everything in rem scales proportionally as a single unit. */
html {
  font-size: 1.85vh;
}

:root {
  --bg:            #0b0f19;
  --bg-card:       #151d2b;
  --bg-card-hover: #1d2740;
  --gold:          #d4b462;
  --gold-soft:     rgba(212, 180, 98, 0.07);
  --gold-border:   rgba(212, 180, 98, 0.2);
  --text:          #eceae5;
  --text-secondary:#9da3b4;
  --text-dim:      #6e7590;
  --border:        #252f45;
  --radius:        0.875rem;
  --radius-sm:     0.625rem;
  --danger:        #ff4d4f;
  --success:       #00c853;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Global scrollbar styling (WebKit/Blink, used by Chrome/Edge) */
body::-webkit-scrollbar,
.sort-list::-webkit-scrollbar {
  width: 8px;
}

body::-webkit-scrollbar-track,
.sort-list::-webkit-scrollbar-track {
  background: transparent;
}

body::-webkit-scrollbar-thumb,
.sort-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

body::-webkit-scrollbar-thumb:hover,
.sort-list::-webkit-scrollbar-thumb:hover {
  background: rgba(212, 180, 98, 0.4);
}

/* ── Page Shell ───────────────────────────── */

.page {
  height: 100vh;
  max-width: 1600px;
  margin: 0 auto;
  padding: 0rem 2.5rem 0.875rem;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -webkit-flex-direction: column;
  flex-direction: column;
  overflow: hidden;
}

/* dvh for browsers that support it */
@supports (height: 100dvh) {
  .page { height: 100dvh; }
}

/* ── Header ───────────────────────────────── */

.header {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -webkit-flex-direction: column;
  flex-direction: column;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  padding-bottom: 0.5rem;
  margin-bottom: 0.625rem;
  border-bottom: 1px solid #252f45;
  border-bottom: 1px solid var(--border);
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
}

.header-top {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: justify;
  -webkit-justify-content: space-between;
  justify-content: space-between;
  width: 100%;
  gap: 1rem;
}

.header-logo {
  height: 3.5rem;
  width: auto;
  -o-object-fit: contain;
  object-fit: contain;
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
}

.header-center {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -webkit-flex-direction: column;
  flex-direction: column;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  text-align: center;
  -webkit-box-flex: 1;
  -webkit-flex: 1;
  flex: 1;
  min-width: 0;
}

.site-title {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #d4b462;
  color: var(--gold);
}

.site-subtitle {
  font-size: 1.05rem;
  color: #9da3b4;
  color: var(--text-secondary);
  font-weight: 400;
}

.header-info {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.info-separator {
  color: #6e7590;
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1;
}

.contact-link {
  display: -webkit-box;
  display: -webkit-inline-flex;
  display: inline-flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  gap: 0.375rem;
  color: #6e7590;
  color: var(--text-dim);
  text-decoration: none;
  -webkit-transition: color 0.2s;
  transition: color 0.2s;
  font-size: 0.95rem;
  white-space: nowrap;
}

.contact-link:hover {
  color: #d4b462;
  color: var(--gold);
}

.contact-icon {
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
  opacity: 0.7;
  -webkit-transition: opacity 0.2s;
  transition: opacity 0.2s;
  font-size: 1.1rem;
  width: 1.1rem;
  text-align: center;
  line-height: 1;
  display: inline-block;
}

.contact-link:hover .contact-icon {
  opacity: 1;
}

.last-update {
  font-size: 0.95rem;
  color: #6e7590;
  color: var(--text-dim);
  white-space: nowrap;
}

/* ── Main Content ────────────────────────── */

main {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -webkit-flex-direction: column;
  flex-direction: column;
  gap: 0.875rem;
  -webkit-box-flex: 1;
  -webkit-flex: 1;
  flex: 1;
  min-height: 0;
}

/* gap fallback for older browsers that don't support gap with flexbox */
@supports not (gap: 0.875rem) {
  main > * + * {
    margin-top: 0.875rem;
  }
}

/* ── Gold Card Grid (Primary + Currency unified) ── */

.gold-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.75rem;
}

/* Alternating subtle tints so adjacent cards feel distinct */
.gold-card:nth-child(5n+2),
.gold-card:nth-child(5n+4) {
  background: #161e2e;
}

.gold-card {
  position: relative;
  overflow: hidden;
  background: #151d2b;
  background: var(--bg-card);
  border: 1px solid rgba(212, 180, 98, 0.2);
  border: 1px solid var(--gold-border);
  border-radius: 0.875rem;
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
  padding-top: 0.625rem;
  -webkit-transition: border-color 0.3s ease, box-shadow 0.3s ease;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.25);
}

/* Decorative gold accent bar at top */
.gold-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: 0.6;
  transition: opacity 0.3s ease;
}

/* Subtle radial shimmer in corner */
.gold-card::after {
  content: '';
  position: absolute;
  top: -40%;
  right: -30%;
  width: 70%;
  height: 120%;
  background: radial-gradient(ellipse at center, rgba(212, 180, 98, 0.04) 0%, transparent 70%);
  pointer-events: none;
}

.gold-card.dir-up {
  border-color: rgba(74, 222, 128, 0.35);
  box-shadow: 0 0.125rem 0.75rem rgba(74, 222, 128, 0.1),
              inset 0 0 1.5rem rgba(74, 222, 128, 0.03);
}

.gold-card.dir-up::before {
  background: linear-gradient(90deg, transparent, #4ade80, transparent);
  opacity: 0.5;
}

.gold-card.dir-down {
  border-color: rgba(248, 113, 113, 0.35);
  box-shadow: 0 0.125rem 0.75rem rgba(248, 113, 113, 0.1),
              inset 0 0 1.5rem rgba(248, 113, 113, 0.03);
}

.gold-card.dir-down::before {
  background: linear-gradient(90deg, transparent, #f87171, transparent);
  opacity: 0.5;
}

.gold-card:hover {
  border-color: var(--gold);
  box-shadow: 0 0.25rem 1rem rgba(212, 180, 98, 0.12);
}

.gold-card:hover::before {
  opacity: 1;
}

.gold-card-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.2rem;
}

.gold-card-icon {
  flex-shrink: 0;
  width: 1.35rem;
  height: 1.35rem;
  color: var(--gold);
  opacity: 0.65;
}

.gold-card-icon svg {
  width: 100%;
  height: 100%;
}

.gold-card-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: #d4b462;
  color: var(--gold);
  overflow-wrap: break-word;
  word-wrap: break-word;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.2;
}

.gold-card-value {
  display: block;
  font-size: 1.65rem;
  font-weight: 700;
  color: #eceae5;
  color: var(--text);
  -webkit-font-feature-settings: "tnum";
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  letter-spacing: -0.01em;
  text-shadow: 0 0.0625rem 0.25rem rgba(0, 0, 0, 0.3);
}

/* ── Secondary Gold Toggle ────────────────── */

.toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0.5rem 0;
  font-family: inherit;
  transition: color 0.2s;
  box-shadow: none;
}

.toggle-btn:hover {
  color: var(--gold);
  filter: none;
}

.toggle-btn .chevron {
  transition: transform 0.25s ease;
}

.toggle-btn.open .chevron {
  transform: rotate(180deg);
}

.secondary-wrapper {
  overflow: hidden;
  transition: max-height 0.35s ease, opacity 0.3s ease;
  max-height: 50rem;
  opacity: 1;
}

.secondary-wrapper.collapsed {
  max-height: 0;
  opacity: 0;
}

/* ── Currency Card Accent (inside gold-grid) ── */

.gold-card.currency-card {
  border-color: rgba(100, 160, 255, 0.2);
}

.gold-card.currency-card::before {
  background: linear-gradient(90deg, transparent, #64a0ff, transparent);
  opacity: 0.5;
}

.gold-card.currency-card::after {
  background: radial-gradient(ellipse at center, rgba(100, 160, 255, 0.04) 0%, transparent 70%);
}

.gold-card.currency-card:hover {
  border-color: #64a0ff;
  box-shadow: 0 0.25rem 1rem rgba(100, 160, 255, 0.12);
}

.gold-card.currency-card:hover::before {
  opacity: 1;
}

.gold-card.currency-card.dir-up {
  border-color: rgba(74, 222, 128, 0.35);
}

.gold-card.currency-card.dir-up::before {
  background: linear-gradient(90deg, transparent, #4ade80, transparent);
}

.gold-card.currency-card.dir-down {
  border-color: rgba(248, 113, 113, 0.35);
}

.gold-card.currency-card.dir-down::before {
  background: linear-gradient(90deg, transparent, #f87171, transparent);
}

.currency-flag {
  width: 1.625rem;
  height: 1.19rem;
  -o-object-fit: cover;
  object-fit: cover;
  border-radius: 0.19rem;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1);
  -webkit-flex-shrink: 0;
  flex-shrink: 0;
}

.currency-card .gold-card-name {
  color: #a0c4ff;
}

/* ── İAB Card Accent (green tint) ── */

.gold-card.iab-card {
  border-color: rgba(74, 222, 128, 0.25);
}

.gold-card.iab-card::before {
  background: linear-gradient(90deg, transparent, #4ade80, transparent);
  opacity: 0.5;
}

.gold-card.iab-card::after {
  background: radial-gradient(ellipse at center, rgba(74, 222, 128, 0.05) 0%, transparent 70%);
}

.gold-card.iab-card:hover {
  border-color: #4ade80;
  box-shadow: 0 0.25rem 1rem rgba(74, 222, 128, 0.12);
}

.gold-card.iab-card:hover::before {
  opacity: 1;
}

.gold-card.iab-card.dir-up {
  border-color: rgba(74, 222, 128, 0.4);
}

.gold-card.iab-card.dir-up::before {
  background: linear-gradient(90deg, transparent, #4ade80, transparent);
}

.gold-card.iab-card.dir-down {
  border-color: rgba(248, 113, 113, 0.35);
}

.gold-card.iab-card.dir-down::before {
  background: linear-gradient(90deg, transparent, #f87171, transparent);
}

.iab-card .gold-card-name {
  color: #6ee7a0;
}

.iab-card .gold-card-icon {
  color: #4ade80;
}

/* ── Data Tables ──────────────────────────── */

.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.price-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1.05rem;
}

.price-table.compact {
  font-size: 0.95rem;
}

.price-table th,
.price-table td {
  padding: 0.625rem 1rem;
  text-align: right;
}

.price-table th:first-child,
.price-table td:first-child {
  text-align: left;
}

.price-table thead th {
  font-size: 0.82rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}

.price-table tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.025);
  transition: background 0.15s;
}

.price-table tbody tr:last-child {
  border-bottom: none;
}

.price-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.price-table td {
  font-variant-numeric: tabular-nums;
}

.price-table td:first-child {
  font-weight: 500;
}

/* ── Loading State ────────────────────────── */

.loading {
  font-size: 1rem;
  color: var(--text-dim);
  padding: 1.5rem 0;
}

/* ── Ads Carousel ────────────────────────── */

.showcase-section {
  -webkit-box-flex: 1;
  -webkit-flex: 1;
  flex: 1;
  min-height: 0;
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -webkit-flex-direction: column;
  flex-direction: column;
}

/* Outer panel — clips the 4th card */
.showcase-panel {
  flex: 1;
  min-height: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

/* Sliding track — holds 4 cards, only 3 visible */
.carousel-track {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  height: 100%;
  -webkit-transition: -webkit-transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
  transition: -webkit-transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
  transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
  transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1), -webkit-transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Individual carousel card ──────────── */

.carousel-card {
  -webkit-box-flex: 0;
  -webkit-flex: 0 0 calc(100% / 3);
  flex: 0 0 calc(100% / 3);
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: stretch;
  -webkit-align-items: stretch;
  align-items: stretch;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  text-align: center;
  padding: 0;
  min-width: 0;
  position: relative;
  border: 2px solid transparent;
  border-radius: 0.625rem;
  border-radius: var(--radius-sm);
  background: #151d2b;
  background: var(--bg-card);
  /* Transition ALL visual properties so class swaps animate smoothly */
  -webkit-transition: opacity    0.7s ease,
              filter     0.7s ease,
              -webkit-transform  0.7s cubic-bezier(0.4, 0, 0.2, 1),
              transform  0.7s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.7s ease,
              box-shadow 0.7s ease;
  transition: opacity    0.7s ease,
              filter     0.7s ease,
              -webkit-transform  0.7s cubic-bezier(0.4, 0, 0.2, 1),
              transform  0.7s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.7s ease,
              box-shadow 0.7s ease;
}

/* Shimmer overlay — present on every card, only visible on .main */
.carousel-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  border-radius: 0.625rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  background: linear-gradient(135deg,
    rgba(212, 180, 98, 0.35),
    transparent 40%,
    transparent 60%,
    rgba(212, 180, 98, 0.35)
  ) border-box;
  -webkit-mask:
    linear-gradient(#fff 0 0) padding-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  background-size: 250% 250%;
  -webkit-animation: adBorderShimmer 4s ease-in-out infinite;
  animation: adBorderShimmer 4s ease-in-out infinite;
  pointer-events: none;
  opacity: 0;
  -webkit-transition: opacity 0.7s ease;
  transition: opacity 0.7s ease;
}

@-webkit-keyframes adBorderShimmer {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}
@keyframes adBorderShimmer {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}

/* Active (center) card — highlighted */
.carousel-card.main {
  border-color: var(--gold-border);
  box-shadow: 0 0 1.875rem rgba(0, 0, 0, 0.6);
  z-index: 2;
}

.carousel-card.main::before {
  opacity: 1;
}

/* Side cards — muted */
.carousel-card.side {
  opacity: 0.5;
  filter: brightness(0.6);
  -webkit-filter: brightness(0.6);
  -webkit-transform: scale(0.88);
  transform: scale(0.88);
}

/* Incoming card — hidden (sits behind overflow: hidden) */
.carousel-card.incoming {
  opacity: 0;
}

/* Fading-out card (higher specificity to beat .side) */
.carousel-card.side.fading-out {
  opacity: 0;
  filter: brightness(0);
}

/* ── Card content ──────────────────────── */

.showcase-content {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -webkit-flex-direction: column;
  flex-direction: column;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  justify-content: center;
  -webkit-box-flex: 1;
  -webkit-flex: 1;
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.showcase-text {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.01em;
  line-height: 1.4;
  padding: 0.75rem;
}

.showcase-link {
  color: var(--gold);
  text-decoration: none;
  font-weight: 600;
  font-size: 1.3rem;
}

.showcase-link:hover {
  text-decoration: underline;
}

.showcase-img {
  display: block;
  max-width: 100%;
  min-height: 0;
  border-radius: var(--radius-sm);
  object-fit: contain;
}

/* When an image ad also has caption text, make it subtle */
.showcase-content .showcase-img + .showcase-text {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-dim);
  margin-top: 0.125rem;
}

/* ── Disclaimer Footer ───────────────────── */

.disclaimer {
  margin-top: 0.75rem;
  padding-top: 0.625rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.disclaimer p {
  font-size: 0.88rem;
  color: #6e7590;
  color: var(--text-dim);
  line-height: 1.5;
  text-align: center;
  max-width: 700px;
  margin: 0 auto;
}

@supports (font-size: max(9px, 0.88rem)) {
  .disclaimer p { font-size: max(9px, 0.88rem); }
}

.disclaimer a {
  color: var(--text-secondary);
  text-decoration: none;
  border-bottom: 1px solid rgba(85, 91, 110, 0.4);
  transition: color 0.2s, border-color 0.2s;
}

.disclaimer a:hover {
  color: var(--gold);
  border-color: var(--gold);
}

/* ── Price Change Indicators ──────────────── */

.change-arrow {
  display: inline-block;
  font-size: 0.6em;
  margin-left: 0.125rem;
  vertical-align: middle;
}

.change-arrow.hidden {
  visibility: hidden;
}

.change-arrow.up {
  color: #4ade80;
}

.change-arrow.down {
  color: #f87171;
}

.change-arrow.new {
  -webkit-animation: arrowAppear 0.35s ease-out;
  animation: arrowAppear 0.35s ease-out;
}

/* ── Animations ───────────────────────────── */

@-webkit-keyframes fadeIn {
  from { opacity: 0; -webkit-transform: translateY(0.25rem); transform: translateY(0.25rem); }
  to   { opacity: 1; -webkit-transform: translateY(0); transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; -webkit-transform: translateY(0.25rem); transform: translateY(0.25rem); }
  to   { opacity: 1; -webkit-transform: translateY(0); transform: translateY(0); }
}

@-webkit-keyframes arrowAppear {
  from { opacity: 0; -webkit-transform: scale(0.5); transform: scale(0.5); }
  to   { opacity: 1; -webkit-transform: scale(1); transform: scale(1); }
}
@keyframes arrowAppear {
  from { opacity: 0; -webkit-transform: scale(0.5); transform: scale(0.5); }
  to   { opacity: 1; -webkit-transform: scale(1); transform: scale(1); }
}

/* ── Admin Page ──────────────────────────── */

.page.admin-page {
  height: auto;
  min-height: 100vh;
  overflow: auto;
}

.admin-page .header {
  margin-bottom: 1rem;
}

/* ── Login Screen ────────────────────────── */

.login-screen {
  display: flex;
  justify-content: center;
  align-items: center;
  flex: 1;
  min-height: 18.75rem;
}

.login-card {
  width: 100%;
  max-width: 23.75rem;
  padding: 2rem 1.75rem;
}

.login-card h2 {
  text-align: center;
  margin-bottom: 1.25rem;
  color: var(--gold);
  font-size: 1.2rem;
}

.login-card .form-row {
  flex-direction: column;
  align-items: stretch;
}

.login-card .form-row label {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.login-card .form-row input {
  margin-left: 0;
  width: 100%;
}

.login-card button[type="submit"] {
  width: 100%;
  padding: 0.625rem 1rem;
  margin-top: 0.25rem;
}

.login-error {
  color: var(--danger);
  font-size: 0.85rem;
  text-align: center;
  margin-bottom: 0.625rem;
}

.form-message {
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
}

.form-message.success {
  color: var(--success);
  background: rgba(0, 200, 83, 0.08);
}

.form-message.error {
  color: var(--danger);
  background: rgba(255, 77, 79, 0.08);
}

/* ── Sortable List (Display Config) ──────── */

.card-hint {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.sort-list {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  max-height: 32rem;
  overflow-y: auto;
  padding-right: 0.25rem;
}

/* Header row for sortable lists (used for gold) */
.sort-list-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.625rem 0.35rem;
  font-size: 0.78rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sort-head-code {
  min-width: 4rem;
}

.sort-head-name {
  flex: 1;
  min-width: 0;
}

.sort-head-mult {
  text-align: right;
  min-width: 5rem;
}

.sort-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.625rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  cursor: grab;
  user-select: none;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}

.sort-item:active {
  cursor: grabbing;
}

/* Items ABOVE the divider — highlighted */
.sort-item.above {
  background: var(--gold-soft);
  border-color: var(--gold-border);
}

.sort-item.above:hover {
  background: rgba(212, 180, 98, 0.12);
}

/* Items BELOW the divider — dimmed (gold: subtle, currency: greyed out) */
.sort-item.below {
  border-color: var(--border);
}

.sort-item.below:hover {
  background: rgba(255, 255, 255, 0.03);
}

.sort-item.below.greyed {
  opacity: 0.4;
}

.sort-item.below.greyed:hover {
  opacity: 0.6;
}

/* Drag state */
.sort-item.dragging {
  opacity: 0.25;
}

/* Drop indicators */
.sort-item.drop-before {
  box-shadow: 0 -2px 0 0 var(--gold);
}

.sort-item.drop-after {
  box-shadow: 0 2px 0 0 var(--gold);
}

/* Drag handle */
.drag-handle {
  color: var(--text-dim);
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
  cursor: grab;
  opacity: 0.5;
  transition: opacity 0.15s;
}

.sort-item:hover .drag-handle {
  opacity: 1;
}

/* Code + Name */
.sort-code {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--gold);
  min-width: 4rem;
}

.sort-name {
  font-size: 0.85rem;
  color: var(--text-secondary);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sort-name-input {
  flex: 1;
  min-width: 0;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.sort-item.above .sort-name-input {
  border-color: rgba(212, 180, 98, 0.25);
  background: rgba(212, 180, 98, 0.04);
  color: var(--text);
}

/* Per-gold multiplier (HAS-based) */
.sort-multiplier-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.sort-multiplier-input {
  width: 6rem;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(10, 15, 30, 0.9);
  color: var(--text);
  font-size: 0.8rem;
  text-align: right;
}

.sort-item.above .sort-multiplier-input {
  background: rgba(212, 180, 98, 0.06);
}

/* Per-item HAS lock button */
.has-lock-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  margin-left: 0.25rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(10, 15, 30, 0.9);
  color: var(--text-dim);
  cursor: pointer;
  box-shadow: none;
}

.has-lock-btn .has-lock-icon {
  width: 0.9rem;
  height: 0.9rem;
  position: relative;
}

.has-lock-btn .has-lock-icon::before,
.has-lock-btn .has-lock-icon::after {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-dim);
  border-radius: 1px;
}

/* Shackle */
.has-lock-btn .has-lock-icon::before {
  width: 0.55rem;
  height: 0.4rem;
  top: -0.18rem;
  border-radius: 999px 999px 0 0;
  border: 1px solid var(--text-dim);
  border-bottom: none;
  background: transparent;
}

/* Body */
.has-lock-btn .has-lock-icon::after {
  width: 0.5rem;
  height: 0.35rem;
  bottom: 0.1rem;
}

.has-lock-btn.active {
  border-color: rgba(212, 180, 98, 0.6);
  background: rgba(212, 180, 98, 0.12);
  color: var(--gold);
}

.has-lock-btn.active .has-lock-icon::before,
.has-lock-btn.active .has-lock-icon::after {
  border-color: var(--gold);
  background: var(--gold);
}

/* Divider line */
.sort-divider {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0;
  margin: 0.25rem 0;
  color: var(--text-dim);
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  pointer-events: none;
}

.sort-divider::before,
.sort-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--gold-border);
}

/* Drop indicator on divider */
.sort-divider.drop-target {
  background: rgba(212, 180, 98, 0.08);
  border-radius: var(--radius-sm);
}

.display-actions {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.display-actions .form-message {
  margin-bottom: 0;
  flex: 1;
}

/* ── Icon Action Buttons (ads table) ─────── */

.action-icons {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  cursor: pointer;
  box-shadow: none;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.icon-btn:hover {
  filter: none;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.icon-btn.active-toggle {
  color: var(--success);
  border-color: rgba(0, 200, 83, 0.25);
}

.icon-btn.active-toggle:hover {
  background: rgba(0, 200, 83, 0.12);
}

.icon-btn.inactive-toggle {
  color: var(--text-dim);
  opacity: 0.6;
}

.icon-btn.inactive-toggle:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.08);
}

.icon-btn.delete-btn:hover {
  color: var(--danger);
  border-color: rgba(255, 77, 79, 0.3);
  background: rgba(255, 77, 79, 0.1);
}

/* ── Image Source Toggle ────────────────── */

.image-source-section {
  margin-bottom: 0.75rem;
}

.image-source-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.625rem;
}

.section-label {
  display: inline-block;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 0;
  white-space: nowrap;
}

.image-source-toggle {
  display: inline-flex;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  margin: 0;
}

.toggle-option {
  padding: 0.375rem 0.875rem;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--text-dim);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: none;
  transition: background 0.2s, color 0.2s;
}

.toggle-option:hover {
  filter: none;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
}

.toggle-option.active {
  background: rgba(212, 180, 98, 0.12);
  color: var(--gold);
}

.image-source-input {
  margin-bottom: 0.25rem;
}

/* ── Dual Submit Buttons ────────────────── */

.ad-submit-actions {
  display: flex;
  gap: 0.625rem;
  margin-top: 0.25rem;
}

.btn-publish {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: linear-gradient(135deg, #00c853, #00a844);
  color: #fff;
  font-weight: 600;
}

.btn-draft {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: linear-gradient(135deg, #e2b93b, #c9a235);
  color: #1a1400;
  font-weight: 600;
}

/* ── Logo Settings ───────────────────────── */

.logo-current-preview {
  margin-bottom: 0.75rem;
}

.logo-current-preview .section-label {
  display: block;
  margin-bottom: 0.375rem;
}

.logo-preview-box {
  background: rgba(10, 15, 30, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  text-align: center;
}

.logo-preview-box img {
  max-width: 100%;
  object-fit: contain;
  transition: height 0.25s ease;
}

.logo-height-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.logo-height-btn {
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: none;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.logo-height-btn:hover {
  filter: none;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
}

.logo-height-btn.active {
  background: rgba(212, 180, 98, 0.12);
  color: var(--gold);
  border-color: rgba(212, 180, 98, 0.4);
}

/* ── Image Preview ───────────────────────── */

.image-preview {
  margin-top: 0.5rem;
  margin-bottom: 0;
  text-align: center;
}

.image-preview img {
  max-width: 100%;
  max-height: 10rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* ── Admin Tabs ──────────────────────────── */

.admin-tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
  padding-bottom: 0;
}

.admin-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  border: 1px solid transparent;
  border-bottom: none;
  background: transparent;
  color: var(--text-dim);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: none;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
  position: relative;
  top: 1px;
}

.admin-tab:hover {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.03);
  filter: none;
}

.admin-tab.active {
  color: var(--gold);
  background: var(--bg-card);
  border-color: var(--border);
  filter: none;
}

.admin-tab svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.admin-tab.active svg {
  opacity: 1;
}

/* ── Admin Tab Content ──────────────────── */

.admin-tab-content {
  display: none;
}

.admin-tab-content.active {
  display: block;
}

/* ── Admin Section Grid ─────────────────── */

.admin-section-grid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 1rem;
}

.admin-section-grid.single {
  grid-template-columns: minmax(0, 1fr);
  max-width: 30rem;
}

/* ── Admin Main Layout ───────────────────── */

.admin-main {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.table-wrap {
  overflow-x: auto;
}

.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.125rem 1.25rem 1.25rem;
  border: 1px solid var(--border);
}

.card h2 {
  font-size: 1.05rem;
  margin-bottom: 0.875rem;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.table.small {
  font-size: 0.85rem;
}

.table th,
.table td {
  padding: 0.5rem 0.625rem;
  text-align: right;
}

.table th:first-child,
.table td:first-child {
  text-align: left;
}

.table thead th {
  font-weight: 500;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}

.table tbody tr:nth-child(even) {
  background-color: rgba(255, 255, 255, 0.02);
}

.table tbody tr.row-inactive {
  opacity: 0.45;
}

.table tbody tr.row-inactive:hover {
  opacity: 0.7;
}

.form-row {
  margin-bottom: 0.75rem;
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.sort-count-row input {
  width: 4rem;
}

label {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

input,
button {
  font-family: inherit;
}

input {
  margin-left: 0.25rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(10, 15, 30, 0.9);
  color: var(--text);
  font-size: 0.92rem;
  min-width: 0;
}

/* Remove default spin buttons from numeric inputs (Chrome, Edge, Safari) */
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Firefox */
input[type=number] {
  -moz-appearance: textfield;
}

input:focus {
  outline: 1px solid var(--gold);
  border-color: var(--gold);
}

button {
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #d4af5a, #b8964e);
  color: #1a1400;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  box-shadow: 0 0.25rem 0.875rem rgba(0, 0, 0, 0.35);
}

button:hover {
  filter: brightness(1.08);
}

button.danger {
  background: linear-gradient(135deg, #ff6b6b, #ff3b30);
  color: #fff;
}

button.secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.badge {
  display: inline-block;
  padding: 0.19rem 0.625rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 500;
}

.badge.active {
  background: rgba(0, 200, 83, 0.1);
  color: var(--success);
}

.badge.inactive {
  background: rgba(255, 77, 79, 0.1);
  color: var(--danger);
}

/* ── Responsive (width-based layout changes only) ── */

@media (max-width: 1100px) {
  .gold-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Hide the right-side logo on tablet & phone */
  .header-top > .header-logo:last-child {
    display: none;
  }

  .header-logo {
    height: 10rem !important;
  }

  /* ── Tablet: scrollable page, 2-card carousel ── */

  html {
    font-size: 14px; /* Safe fallback for older WebViews */
  }

  .page {
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }

  .showcase-section {
    flex: none;
    min-height: 14rem;
  }

  .showcase-panel {
    min-height: 12rem;
  }

  /* 2 visible cards instead of 3 */
  .carousel-card {
    flex: 0 0 calc(100% / 2);
  }

  /* Side cards: slightly less dimmed than desktop */
  .carousel-card.side {
    opacity: 0.4;
    filter: brightness(0.65);
    transform: scale(0.92);
  }
}

@media (max-width: 900px) {
  .admin-section-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .page {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .header-top {
    gap: 0.5rem;
  }

  .site-title {
    font-size: 1.6rem;
  }

  .header-info {
    gap: 0.375rem;
  }

  .contact-link {
    font-size: 0.8rem;
  }

  .contact-link span {
    display: none;
  }

  /* ── Small tablet: single-ad cross-fade (same as mobile) ── */

  .showcase-section {
    min-height: 40vh;
  }

  .showcase-panel {
    position: relative;
    min-height: 35vh;
  }

  /* Track fills panel via absolute positioning (avoids broken height:100% in flex) */
  .carousel-track {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: block;
    -webkit-transition: none;
    transition: none;
    -webkit-transform: none !important;
    transform: none !important;
  }

  .carousel-card {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    -webkit-filter: none;
    filter: none;
    -webkit-transform: none;
    transform: none;
    border-color: transparent;
    box-shadow: none;
    -webkit-transition: opacity 0.8s ease;
    transition: opacity 0.8s ease;
    pointer-events: none;
  }

  .carousel-card::before {
    display: none;
  }

  .carousel-card.main {
    opacity: 1;
    border-color: rgba(212, 180, 98, 0.2);
    border-color: var(--gold-border);
    box-shadow: 0 0 1.875rem rgba(0, 0, 0, 0.6);
    pointer-events: auto;
    z-index: 2;
  }

  .carousel-card.side,
  .carousel-card.incoming,
  .carousel-card.side.fading-out {
    opacity: 0;
    -webkit-filter: none;
    filter: none;
    -webkit-transform: none;
    transform: none;
    pointer-events: none;
  }

  /* Ensure ad images fill the card properly */
  .showcase-content {
    height: 100%;
    width: 100%;
  }

  .showcase-img {
    max-height: 100%;
    width: auto;
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  /* On small screens: fixed font-size and tighter padding */
  html {
    font-size: 18px;
  }

  .page {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    padding-bottom: 0.75rem;
  }

  /* Compact header */
  .header {
    padding-bottom: 0.35rem;
    margin-bottom: 0.4rem;
  }

  .header-top {
    gap: 0.35rem;
  }

  .site-title {
    font-size: 1.2rem;
  }

  .site-subtitle {
    font-size: 0.8rem;
  }

  .header-info {
    margin-top: 0.2rem;
    gap: 0.25rem;
  }

  .last-update {
    font-size: 0.75rem;
  }

  /* Smaller gold/currency cards */
  .gold-grid {
    gap: 0.4rem;
  }

  .gold-card {
    padding: 0.3rem 0.55rem;
    padding-top: 0.4rem;
    border-radius: 0.625rem;
  }

  .gold-card-header {
    gap: 0.25rem;
    margin-bottom: 0.1rem;
  }

  .gold-card-icon {
    width: 1rem;
    height: 1rem;
  }

  .gold-card-name {
    font-size: 0.8rem;
  }

  .gold-card-value {
    font-size: 1.15rem;
  }

  .currency-flag {
    width: 1.25rem;
    height: 0.9rem;
  }

  /* Ads area — generous on mobile since page scrolls */
  .showcase-section {
    min-height: 35vh;
  }

  .showcase-panel {
    min-height: 30vh;
  }

  .showcase-text {
    font-size: 0.95rem;
    padding: 0.5rem;
  }

  .showcase-link {
    font-size: 0.95rem;
  }

  /* Compact footer */
  .disclaimer {
    margin-top: 0.4rem;
    padding-top: 0.4rem;
  }

  .disclaimer p {
    font-size: 0.72rem;
  }

  /* Tighter main gap */
  main {
    gap: 0.5rem;
  }
}

/* ── Legacy fallbacks for very old WebViews ───────────────── */

/* Basic colors for browsers that ignore CSS variables */
body {
  background: #0b0f19;
  color: #eceae5;
}

/* Flexbox fallback when CSS Grid is not supported.
   We set flex as the BASE display and let grid override it.
   This avoids relying on @supports (unavailable in Chrome <28). */
.gold-grid {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-flex-wrap: wrap;
  flex-wrap: wrap;
}

.gold-grid > .gold-card {
  -webkit-box-flex: 0;
  -webkit-flex: 0 0 18%;
  flex: 0 0 18%;
  margin: 0.375rem;
}

/* If grid IS supported, override the flex fallback */
@supports (display: grid) {
  .gold-grid {
    display: grid;
  }

  .gold-grid > .gold-card {
    -webkit-flex: none;
    flex: none;
    margin: 0;
  }
}

/* Fallback for the HTML5 hidden attribute */
[hidden] {
  display: none !important;
}

/* Webkit flex prefix for gold-card-header */
.gold-card-header {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
}

/* Webkit flex prefix for header-top */
.header-top {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
}

/* Webkit flex prefix for header-info */
.header-info {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
}