﻿/* Global Theme */
:root {
  --bg: #f4f6f9;
  --text: #222;
  --muted: #666;
  --card: #fff;
  --border: #ddd;
  --accent: #524C41; /* base */
  --accent-strong: #433E35; /* darker hover */
  --header-grad-start: #3E392F; /* dark variant */
  --header-grad-end: #6A6253; /* light variant */
  --header-height: 140px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, Helvetica, sans-serif; background: var(--bg); color: var(--text); padding-top: var(--header-height); }

/* Login screen */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(255,255,255,.7), transparent 60%),
    linear-gradient(135deg, var(--header-grad-start), var(--header-grad-end));
  overflow: hidden;
}
.login-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url('../assets/Royal.jpg') center/cover;
  opacity: 0.12;
  filter: saturate(0.8) contrast(0.96);
  mask-image: radial-gradient(circle at 50% 45%, rgba(0,0,0,0.92) 40%, rgba(0,0,0,0.45) 62%, transparent 92%);
  -webkit-mask-image: radial-gradient(circle at 50% 45%, rgba(0,0,0,0.92) 40%, rgba(0,0,0,0.45) 62%, transparent 92%);
  pointer-events: none;
  z-index: 0;
}
.login-screen::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: clamp(300px, 58vmin, 820px);
  height: clamp(300px, 58vmin, 820px);
  transform: translate(-50%, -50%);
  background: url('../assets/jyh-logo.svg') no-repeat center / contain;
  opacity: 0.08;
  filter: saturate(1.05) contrast(1.03);
  pointer-events: none;
  z-index: 0;
  animation: loginLogoSpin 60s linear infinite;
}
.login-cca-logo {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 144px;
  height: auto;
  z-index: 2;
  opacity: 0.7;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,.35));
}
@keyframes loginLogoSpin { from { transform: translate(-50%, -50%) rotate(0turn); } to { transform: translate(-50%, -50%) rotate(1turn); } }
.login-card{
  position: relative;
  z-index: 1;
  width: 340px;
  padding: 28px 22px;
  border-radius: 14px;
  background: transparent;
  box-shadow: 0 12px 28px rgba(0,0,0,.18);
}
.login-logo {
  position: relative;
  width: 160px;
  height: 160px;
  margin: 0 auto 8px;
  overflow: hidden;
}
.login-logo img {
  position: relative;
  width: 96px;
  height: 96px;
  display: block;
  margin: 32px auto 0;
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(255,255,255,.35);
  border: 2px solid rgba(255,255,255,.3);
  background: rgba(255,255,255,.12);
  backdrop-filter: blur(2px);
  z-index: 2;
}

.login-logo::before {
  content: "";
  position: absolute;
  inset: -10% -20% -15% -20%;
  background: url('../assets/elk-antlers.svg') no-repeat center;
  background-size: contain;
  opacity: 0.35;
  filter: drop-shadow(0 6px 16px rgba(0,0,0,.35));
  z-index: 1;
  pointer-events: none;
}
.login-title{
  margin: 0 0 12px;
  text-align: center;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.3px;
  /* Mirror brass tones from logo */
  background: linear-gradient(180deg,
    #fff4cf 0%,
    #f2dda1 28%,
    #caa660 58%,
    #8b6a2f 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-stroke: 0.3px rgba(0,0,0,.45);
  text-shadow: 0 1px 0 rgba(255,255,255,.25), 0 3px 10px rgba(0,0,0,.35);
}
.login-card label{ display:block; margin: 10px 0 6px; color: #f5f2e9; font-weight: 600; font-size: 13px; }
.login-card input{ width:100%; height: 40px; padding: 8px 10px; border:1px solid #d1d5db; border-radius: 8px; background:#f9fafb; font-size:14px; }
.login-card input:focus{ outline:none; border-color: var(--accent); background:#fff; box-shadow: 0 0 0 2px rgba(82,76,65,.2); }
.login-card .btn{ width:100%; height: 40px; margin-top: 12px; }
.login-card .error{ color:#b91c1c; font-size:13px; margin: 8px 0; display:none; }
.login-card .success{ color:#047857; font-size:13px; margin: 8px 0; display:none; }

/* Shared Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 28px;
  height: var(--header-height);
  box-sizing: border-box;
  /* Mountain scene underneath with colored gradient overlay */
  background:
    linear-gradient(135deg, rgba(62,57,47,0.55), rgba(106,98,83,0.55)),
    url('../assets/header-mountains.svg?v=2') no-repeat;
  background-blend-mode: multiply, normal;
  background-position: center, bottom center;
  background-size: cover, 120% auto;
  color: #fff;
  box-shadow: 0 6px 20px rgba(0,0,0,.3);
  position: fixed;
  top: 0; left: 0; right: 0;
  width: 100%;
  z-index: 100;
}
.logo-title { display: flex; align-items: center; gap: 14px; }
.logo { height: 96px; width: 96px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 12px rgba(255,255,255,.4); border: 2px solid rgba(255,255,255,.35); }
.app-header h1 { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: 1.1px; font-family: Georgia, 'Times New Roman', serif; }
.header-title { display: inline-block; }
/* Put "The" on the same line as "James Yard Hornor" */
.header-title .header-kicker { display: inline; margin-right: 6px; text-align: left; }
.header-title .header-main { display: inline; text-align: left; }
.header-title .header-sub { display: block; text-align: left; }
.navbar { display: flex; gap: 12px; }
.navbar button { padding: 12px 20px; border: none; border-radius: 10px; background: rgba(255,255,255,.2); color: #fff; font-weight: 700; cursor: pointer; transition: all .3s ease-in-out; backdrop-filter: blur(4px); }
.navbar button:hover { background: rgba(255,255,255,.4); transform: scale(1.05); box-shadow: 0 0 10px rgba(255,255,255,.4); }

/* Generic Container */
.container { max-width: 1100px; margin: 20px auto; background: var(--card); padding: 20px; border-radius: 12px; box-shadow: 0 2px 10px rgba(0,0,0,.1); }

/* Buttons */
.btn { display: inline-block; padding: 8px 14px; background: var(--accent); color: #fff; border-radius: 8px; text-decoration: none; font-weight: 700; transition: background .2s ease; border: none; cursor: pointer; }
.btn:hover { background: var(--accent-strong); }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn.ghost:hover { background: rgba(82, 76, 65, 0.08); }

/* Dashboard grid (index) */
.dashboard-container {
  width: 100%;
  max-width: none;
  margin: 24px 0;
  padding: 20px;
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

@media (max-width: 640px) {
  .dashboard-container {
    grid-template-columns: 1fr;
    padding: 16px;
  }
}

/* Gun cards (index) */
.gun-card { position: relative; background: #fff; border-radius: 12px; box-shadow: 0 4px 16px rgba(0,0,0,.1); overflow: hidden; display: flex; flex-direction: column; cursor: pointer; transition: transform .25s ease, box-shadow .25s ease; }
.gun-card:hover { transform: translateY(-6px) scale(1.02); box-shadow: 0 6px 24px rgba(0,0,0,.2); }
.gun-card .card-mfg { position: absolute; right: 10px; bottom: 10px; width: 48px; height: 48px; border-radius: 12px; background: transparent; display:flex; align-items:center; justify-content:center; box-shadow: none; }
.gun-card .card-mfg img { max-width: 100%; max-height: 100%; object-fit: contain; display:block; background: transparent !important; background-color: transparent !important; }
.gun-card .card-stars { margin-top: 8px; font-size: 18px; letter-spacing: 1px; }
.gun-card .card-stars .fa-star,
.gun-card .card-stars .fa-star-half-stroke { color: #f3b21a; }
.gun-card .card-stars .fa-regular.fa-star { color: #c7c7c7; }
.gun-thumb { width: 100%; height: 200px; object-fit: cover; background: #e0e0e0; transition: transform .3s ease; display:block; }
.gun-card img { width: 100%; height: 200px; object-fit: cover; object-position: center; background-color: #e0e0e0; transition: transform .3s ease; display:block; }
/* Fallback logo inside gun card: smaller and translucent */
.gun-card img[src$="jyh-logo.svg"],
.gun-card img[src*="/assets/jyh-logo.svg"] {
  object-fit: contain !important;
  padding: 28px;
  opacity: 0.28;
  filter: saturate(0.9) contrast(0.95);
}
.gun-card:hover .gun-thumb, .gun-card:hover img { transform: scale(1.05); }
.gun-body { padding: 16px; }
.gun-title { margin: 0 0 10px; font-size: 18px; font-weight: 700; color: #222; }
.gun-sub { color: #555; font-size: 14px; margin-bottom: 8px; }
.gun-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; color: #666; font-size: 13px; margin-bottom: 12px; }
.gun-actions { display: flex; gap: 10px; }

/* Legacy dashboard card text structure */
.gun-info { padding: 16px; }
.gun-info h3 { margin: 0 0 10px; font-size: 18px; font-weight: 700; color: #222; }
.gun-info p { margin: 4px 0; color: #666; font-size: 14px; }
.gun-info strong { color: #222; }

/* Skeletons (index) */
.card.skeleton { background: #fff; border-radius: 12px; box-shadow: 0 4px 16px rgba(0,0,0,.08); height: 240px; animation: pulse 1.2s infinite ease-in-out; }
@keyframes pulse { 0%,100% { opacity: .6 } 50% { opacity: 1 } }

/* Collection gallery */
.page { max-width: 1400px; margin: 24px auto; padding: 0 20px 24px; }

/* Dashboard layout with left sidebar */
.layout { width: 100%; max-width: none; margin: 24px 0; padding: 0 20px 24px; display: grid; grid-template-columns: 280px 1fr; gap: 24px; align-items: start; }
.sidebar { position: sticky; top: calc(var(--header-height) + 10px); align-self: start; }
/* Value cards stack beneath the filters */
.sidebar .stats {
  position: static;
  top: auto;
  z-index: auto;
  background: none;
  padding: 0;
  margin: 24px 0 0;
  box-shadow: none;
}

/* Vertical filters */
.filters { display: grid; grid-template-columns: 1fr; gap: 14px; }
.filters .field { display: flex; flex-direction: column; }
.filters label { font-weight: 600; font-size: 13px; color: #374151; margin-bottom: 6px; }
.filters .control { width: 100%; height: 38px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.filters .btn { width: 100%; height: 38px; }
/* Subtle divider between filters and sort controls */
.filters hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, rgba(0,0,0,0.06), rgba(0,0,0,0.16), rgba(0,0,0,0.06));
  margin: 6px 0 2px;
}

/* Stats row */
.stats {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.stat-card {
  position: relative;
  border-radius:14px;
  padding:18px 16px;
  text-align:center;
  color:#fff;
  /* Midâ€‘tone metallic silver (base + brush + soft highlight) */
  background:
    /* brushed lines */ repeating-linear-gradient(0deg,
      rgba(255,255,255,0.10) 0px, rgba(255,255,255,0.10) 1px,
      rgba(255,255,255,0.04) 1px, rgba(255,255,255,0.04) 2px),
    /* silver plate (mid tone) */ linear-gradient(135deg, #d6d9de, #b7bec8 40%, #7b8592 60%, #c4cad2 100%),
    /* soft highlight */ radial-gradient(120% 100% at 50% -10%, rgba(255,255,255,0.25), transparent 60%);
  background-size: 200% 200%, 200% 200%, auto;
  animation: statPulse 8s ease-in-out infinite;
  box-shadow: 0 10px 22px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.20), inset 0 -1px 0 rgba(0,0,0,.22);
  border: 1px solid rgba(0,0,0,.10);
  overflow: hidden;
}
.stat-card::before{ /* inner bevel */
  content:""; position:absolute; inset:0;
  border-radius:14px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08), inset 0 8px 18px rgba(255,255,255,.06), inset 0 -10px 24px rgba(0,0,0,.25);
  pointer-events:none;
}
.stat-card::after{ /* subtle diagonal sheen */
  content:""; position:absolute; inset:-45% -45% auto -45%; height:120%;
  background: linear-gradient(115deg, rgba(255,255,255,.18), rgba(255,255,255,0) 35%);
  pointer-events:none;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 14px 28px rgba(0,0,0,.32); transition: transform .2s ease, box-shadow .2s ease; }
.stat-value {
  font-size:40px;
  font-weight:900;
  letter-spacing:.3px;
  /* lighter copper metallic gradient */
  background: linear-gradient(180deg,
    #fff7ef 0%,
    #ffe4c8 14%,
    #ffd2a3 28%,
    #ffbf7a 44%,
    #f3a963 58%,
    #d89048 72%,
    #ffcfa0 88%,
    #fff4e9 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-stroke: 0.3px rgba(110,70,35,.35);
  text-shadow:
    0 1px 0 rgba(0,0,0,.28),
    0 4px 12px rgba(0,0,0,.28),
    0 0 18px rgba(234, 140, 41, .22); /* soft warm glow */
}
.stat-label {
  font-size:12px;
  color: rgba(255,255,255,.85);
  text-transform:uppercase;
  letter-spacing:.6px;
  margin-top:6px;
}
@keyframes statPulse { 0%{ background-position: 0% 50%; } 50%{ background-position: 100% 50%; } 100%{ background-position: 0% 50%; } }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }

}
/* Subtle logo background on non-login pages */
body:not(.login-screen)::after{
  content: "";
  position: fixed;
  inset: 0;
  background: url('../assets/jyh-logo.svg') no-repeat center;
  background-size: clamp(320px, 50vmin, 820px);
  opacity: 0.06;
  filter: saturate(1.05) contrast(1.03);
  pointer-events: none;
  z-index: 0;
}
/* Ensure stacked content appears above the background emblem */
.layout, .container { position: relative; z-index: 1; }
.page h2 { margin: 0 0 16px; font-size: 24px; font-weight: 700; color: #1f2937; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px; }
.card { background: #fff; border-radius: 12px; box-shadow: 0 4px 16px rgba(0,0,0,.1); overflow: hidden; display: flex; flex-direction: column; transition: transform .25s ease, box-shadow .25s ease; }
.card:hover { transform: translateY(-6px) scale(1.02); box-shadow: 0 6px 24px rgba(0,0,0,.2); }
.card img { width: 100%; height: 200px; object-fit: cover; background-color: #e0e0e0; max-width: none !important; display: block; }
.card h3 { margin: 12px 16px 6px; font-size: 18px; font-weight: 700; color: #222; }
.card p { margin: 4px 16px; color: #666; font-size: 14px; }
.card a { margin: 12px 16px 16px; align-self: flex-start; }
.empty { grid-column: 1/-1; text-align: center; color: #555; }

/* Gun Details page */
.gallery-wrapper { display:flex; align-items:flex-start; gap:16px; }
.main-photo-container { position:relative; flex:1; max-width:740px; }
.main-photo { width:100%; height:460px; object-fit:cover; border-radius:10px; border:1px solid #ccc; background:#eee; }
.main-photo.is-logo { object-fit: contain; background: #fff; padding: 16px; }
.nav-btn { position:absolute; top:50%; transform:translateY(-50%); background:rgba(0,0,0,.4); color:#fff; border:none; width:42px; height:42px; border-radius:50%; cursor:pointer; font-size:20px; display:flex; align-items:center; justify-content:center; transition:background .2s ease; }
.nav-btn:hover { background:rgba(0,0,0,.7); }
#prevBtn { left:10px; } #nextBtn { right:10px; }
.thumbs { width:160px; max-height:460px; overflow:auto; display:flex; flex-direction:column; gap:10px; }
.thumb-cell { position:relative; }
.thumb { width:160px; height:110px; object-fit:cover; border-radius:6px; border:2px solid transparent; cursor:pointer; background:#eee; }
.thumb.active { border-color: var(--accent); }
.thumb:hover { filter:brightness(0.96); }
.thumb-delete { position:absolute; top:6px; right:6px; width:22px; height:22px; border:none; border-radius:50%; background:rgba(29,41,81,.85); color:white; font-weight:700; cursor:pointer; line-height:22px; padding:0; opacity:.2; }
.thumb-delete:hover { background: rgba(180,0,0,1); }
.upload-row { margin:14px 0 18px; }
.upload-btn { display:inline-block; padding:10px 16px; background:var(--accent); color:#fff; border:none; border-radius:8px; cursor:pointer; font-weight:700; }
.upload-btn:hover { background:var(--accent-strong); }
input[type="file"] { display:none; }
.details { position:relative; display:flex; flex-direction:column; gap:8px; font-size:16px; color:#333; padding-right: 240px; }
.details .condition-value {
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}
.condition-stars {
  display:inline-flex;
  gap:2px;
  font-size:18px;
}
.condition-stars .fa-star,
.condition-stars .fa-star-half-stroke {
  color:#f3b21a;
}
.condition-stars .fa-regular.fa-star {
  color:#c7c7c7;
}
.condition-text {
  font-size:14px;
  color:#555;
}
.label { font-weight:700; color:#000; }
.value { color:#444; }
.mfg-logo-wrap { position:absolute; right:36px; top:50%; transform: translateY(-50%); width: 180px; max-width: 28%; display:flex; align-items:center; justify-content:center; opacity: 0.95; }
.mfg-logo-wrap img { max-width: 100%; max-height: 180px; object-fit: contain; filter: drop-shadow(0 2px 6px rgba(0,0,0,.2)); }
.story-wrap { margin-top:22px; }
.story-wrap h3 { margin:0 0 8px; font-size:20px; }
#gunStory {
  font-family: Arial, Helvetica, sans-serif;
  font-size:16px;
  width:100%;
  border:none;
  outline:none;
  background: transparent;
  min-height:64px;
  padding:0;
  color:#222;
  line-height:1.4;
  resize: none;
  overflow:hidden; /* auto-resize via JS */
  white-space: pre-wrap; /* keep line breaks */
}
#gunStory ul, #gunStory ol { margin: 8px 0 8px 22px; }
#saveStoryBtn { margin-top:10px; }
.hint { font-size:12px; color:#666; margin-top:4px; }

/* Documents section */
.docs-wrap { margin-top: 24px; }
.docs-wrap h3 { margin:0 0 10px; font-size:20px; }
.docs-viewer { border:1px solid #ddd; border-radius:10px; background:#fff; padding:8px; display:flex; align-items:center; justify-content:center; min-height:240px; }
#docMainImg { max-width:100%; max-height:420px; object-fit:contain; }
#docMainFrame { width:100%; height:420px; border: none; background:#f8f9fb; }
.docs-viewer { position: relative; }
.doc-actions { position:absolute; top:8px; right:8px; display:flex; gap:8px; }
.doc-actions .btn.ghost { padding:6px 10px; }
.thumbs-docs { display:flex; flex-wrap:wrap; gap:10px; margin-top:10px; }
.thumbs-docs .doc-thumb { width:120px; height:80px; border:2px solid transparent; border-radius:6px; background:#eee; display:flex; flex-direction:column; cursor:pointer; position:relative; overflow:hidden; }
.thumbs-docs .doc-thumb.active { border-color: var(--accent); }
.thumbs-docs .doc-thumb img { width:100%; height:100%; object-fit:cover; }
.thumbs-docs .doc-thumb .doc-thumb-preview {
  flex:1;
  min-height:0;
  width:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  background:#fff;
  overflow:hidden;
}

.thumbs-docs .doc-label {
  display:block;
  padding:4px 6px;
  font-size:11px;
  line-height:1.1;
  color:#fff;
  background:rgba(29,41,81,.85);
  text-align:center;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.thumbs-docs .doc-thumb.active .doc-label {
  background: var(--accent);
}
.thumbs-docs .doc-thumb iframe,
.thumbs-docs .doc-thumb object,
.thumbs-docs .doc-thumb embed {
  width:100%;
  height:100%;
  border:0;
  pointer-events:none;
  background:#fff;
}
.thumbs-docs .doc-thumb iframe {
  transform:scale(1);
  transform-origin: top left;
}
.doc-badge { position:absolute; top:6px; right:6px; background:rgba(0,0,0,.6); color:#fff; font-size:11px; padding:2px 6px; border-radius:10px; }
.doc-delete { position:absolute; top:6px; right:6px; width:22px; height:22px; border:none; border-radius:50%; background:rgba(29,41,81,.85); color:white; font-weight:700; cursor:pointer; line-height:22px; padding:0; opacity:.6; }
.doc-delete:hover { background: rgba(180,0,0,1); opacity:1; }
/* Lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.85); display:flex; flex-direction:column; z-index: 1000; }
.lightbox-toolbar { display:flex; gap:10px; justify-content:flex-end; padding: 12px; }
.lightbox-stage { flex:1; display:flex; align-items:center; justify-content:center; overflow:hidden; cursor: grab; }
.lightbox-stage:active { cursor: grabbing; }
.lightbox-stage img { max-width:none; max-height:none; transform-origin: center center; user-select:none; pointer-events:none; }

/* Gun details main photo */
.main-photo { width:100%; height:460px; object-fit: contain; object-position:center; border-radius:10px; border:1px solid #ccc; background:#fff; cursor: zoom-in; }
.main-photo.is-logo { padding: 16px; }

.story-editor {
  position: relative;
  min-height: 180px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  overflow-y: auto;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.5;
  white-space: pre-wrap;
}
.story-editor:focus {
  outline: 2px solid rgba(82, 76, 65, 0.35);
  outline-offset: 2px;
}
.story-editor.is-empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
  opacity: 0.65;
  position: absolute;
  inset: 12px;
  pointer-events: none;
  display: block;
}
.story-editor.is-empty br {
  display: none;
}



