/* ============================================
   MCFrom — Reusable Components
   ============================================ */

/* ---------- ICONS ---------- */
.icon{
  width: var(--icon-md);
  height: var(--icon-md);
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.icon-sm{ width: var(--icon-sm); height: var(--icon-sm); }
.icon-lg{ width: var(--icon-lg); height: var(--icon-lg); }

/* ---------- BUTTONS (blocky, Minecraft-inspired) ---------- */
.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  height: var(--btn-h-md);
  padding: 0 var(--sp-5);
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  font-family: var(--font-ui);
  font-size: var(--fs-sm);
  font-weight: var(--fw-bold);
  text-transform: uppercase;
  letter-spacing: .4px;
  cursor: pointer;
  transition: transform .08s ease, background-color .12s ease, border-color .12s ease, box-shadow .12s ease;
  white-space: nowrap;
  user-select: none;
  position: relative;
}
.btn:focus-visible{ outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled{ opacity: .4; cursor: not-allowed; box-shadow: none !important; transform: none !important; }

.btn-sm{ height: var(--btn-h-sm); padding: 0 var(--sp-3); font-size: var(--fs-xs); }
.btn-lg{ height: var(--btn-h-lg); padding: 0 var(--sp-6); font-size: var(--fs-md); }

/* Primary — gold, blocky depth */
.btn-primary{
  background: var(--accent); border-color: var(--accent-active); color: var(--accent-text);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover:not(:disabled){ background: var(--accent-hover); }
.btn-primary:active:not(:disabled){ background: var(--accent-active); transform: translateY(2px); box-shadow: none; }

/* Secondary — dark surface, strong border (used for Telegram / alt actions) */
.btn-secondary{
  background: var(--surface-3); border-color: var(--border-strong); color: var(--text-1);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover:not(:disabled){ border-color: var(--accent); color: var(--accent); }
.btn-secondary:active:not(:disabled){ transform: translateY(2px); box-shadow: none; }

/* Telegram variant — blue-ish tint on hover to signal external app */
.btn-telegram{
  background: var(--surface-3); border-color: #29a9eb; color: #29a9eb;
  box-shadow: var(--shadow-sm);
}
.btn-telegram:hover:not(:disabled){ background: #29a9eb; color: #fff; }
.btn-telegram:active:not(:disabled){ transform: translateY(2px); box-shadow: none; }

/* Ghost */
.btn-ghost{ background: transparent; border-color: transparent; color: var(--text-2); text-transform: none; letter-spacing: normal; font-weight: var(--fw-semibold); }
.btn-ghost:hover:not(:disabled){ background: var(--surface-2); color: var(--text-1); }

/* Icon-only */
.btn-icon{ width: var(--btn-h-md); padding: 0; background: var(--surface-2); border-color: var(--border); color: var(--text-2); box-shadow: none; }
.btn-icon:hover:not(:disabled){ border-color: var(--border-strong); color: var(--text-1); }
.btn-icon:active:not(:disabled){ transform: translateY(1px); }

/* Danger — red, for warnings/destructive actions */
.btn-danger{ background: transparent; border-color: var(--red); color: var(--red); }
.btn-danger:hover:not(:disabled){ background: var(--red); color: #fff; }
.btn-danger:active:not(:disabled){ transform: translateY(2px); }

/* Loading state */
.btn-loading{ position: relative; color: transparent !important; pointer-events: none; }
.btn-loading::after{
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  color: var(--text-1);
  animation: btn-spin .6s linear infinite;
}
@keyframes btn-spin{ to{ transform: rotate(360deg); } }

/* ---------- BADGES / TAGS ---------- */
.tag{
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 3px var(--sp-2);
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text-2);
}
.tag-vip{ background: rgba(245,185,61,.12); border-color: var(--tag-vip); color: var(--tag-vip); }
.tag-new{ background: rgba(91,185,116,.12); border-color: var(--tag-new); color: var(--tag-new); }
.tag-jenny{ background: rgba(176,111,224,.12); border-color: var(--tag-jenny); color: var(--tag-jenny); }
.tag-featured{ background: rgba(245,185,61,.15); border-color: var(--accent); color: var(--accent); }

/* ---------- CARDS ---------- */
.card{
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color .15s ease, transform .1s ease;
}
.card:hover{ border-color: var(--accent); }

/* Mod Card (grid style) — real data only: image, name, category, version */
.mod-card{ display: flex; flex-direction: column; }
.mod-card-thumb{ width: 100%; aspect-ratio: 16/10; object-fit: cover; background: var(--surface-3); }
.mod-card-body{ padding: var(--sp-3); display: flex; flex-direction: column; gap: var(--sp-2); flex: 1; }
.mod-card-name{ font-size: var(--fs-md); font-weight: var(--fw-bold); color: var(--text-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mod-card-desc{ font-size: var(--fs-xs); color: var(--text-3); line-height: var(--lh-normal);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; flex: 1; }
.mod-card-meta{ display: flex; align-items: center; gap: var(--sp-1); flex-wrap: wrap; }
.mod-card-actions{ display: flex; gap: var(--sp-2); margin-top: var(--sp-1); }
.mod-card-actions .btn{ flex: 1; padding: 0 var(--sp-2); }

/* List Card (compact row, used in listing page) — real data only */
.list-card{ display: flex; gap: var(--sp-3); padding: var(--sp-3); align-items: flex-start; cursor: pointer; }
.list-card-thumb{ width: 72px; height: 72px; border-radius: var(--radius-md); object-fit: cover; flex-shrink: 0; background: var(--surface-3); border: 1px solid var(--border); }
.list-card-info{ flex: 1; min-width: 0; }
.list-card-name{ font-size: var(--fs-md); font-weight: var(--fw-bold); margin-bottom: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-card-desc{ font-size: var(--fs-xs); color: var(--text-3); line-height: var(--lh-normal);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: var(--sp-2); }
.list-card-tags{ display: flex; gap: var(--sp-1); flex-wrap: wrap; }

/* Tool Card */
.tool-card{ padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-3); }
.tool-card-icon{ width: 40px; height: 40px; border-radius: var(--radius-md); background: var(--surface-3);
  display: flex; align-items: center; justify-content: center; color: var(--accent); }
.tool-card-title{ font-size: var(--fs-md); font-weight: var(--fw-semibold); }
.tool-card-desc{ font-size: var(--fs-xs); color: var(--text-3); line-height: var(--lh-normal); }

/* News Card */
.news-card{ display: flex; flex-direction: column; }
.news-card-img{ width: 100%; aspect-ratio: 16/9; object-fit: cover; background: var(--surface-3); }
.news-card-body{ padding: var(--sp-3); display: flex; flex-direction: column; gap: var(--sp-1); }
.news-card-cat{ font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--accent); text-transform: uppercase; letter-spacing: .3px; }
.news-card-title{ font-size: var(--fs-sm); font-weight: var(--fw-semibold); line-height: var(--lh-tight); }
.news-card-date{ font-size: var(--fs-xs); color: var(--text-3); }

/* Creator Card */
.creator-card{ padding: var(--sp-4); display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--sp-2); }
.creator-card-avatar{ width: 56px; height: 56px; border-radius: var(--radius-full); object-fit: cover; background: var(--surface-3); }
.creator-card-name{ font-size: var(--fs-sm); font-weight: var(--fw-semibold); display: flex; align-items: center; gap: 4px; }
.creator-card-stats{ font-size: var(--fs-xs); color: var(--text-3); }

/* Player Rating Card */
.player-card{ background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
  padding: var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-4); }
.player-card-head{ display: flex; align-items: center; justify-content: space-between; }
.player-card-name{ font-size: var(--fs-lg); font-weight: var(--fw-bold); letter-spacing: .5px; }
.player-card-ovr{ font-size: var(--fs-3xl); font-weight: var(--fw-bold); color: var(--accent); line-height: 1; }
.player-card-ovr-label{ font-size: var(--fs-xs); color: var(--text-3); text-align: center; margin-top: 2px; }
.player-card-stats{ display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-2) var(--sp-4); }
.player-stat-row{ display: flex; justify-content: space-between; font-size: var(--fs-sm); }
.player-stat-row span:last-child{ font-weight: var(--fw-semibold); color: var(--text-1); }
.player-card-footer{ display: flex; align-items: center; justify-content: space-between;
  padding-top: var(--sp-3); border-top: 1px solid var(--border); font-size: var(--fs-xs); color: var(--text-3); }
.tier-badge{ padding: 2px var(--sp-2); border-radius: var(--radius-sm); font-weight: var(--fw-bold); font-size: var(--fs-xs); }
.tier-elite{ background: rgba(245,185,61,.15); color: var(--accent); border: 1px solid var(--accent); }

/* Collection Card */
.collection-card{ position: relative; aspect-ratio: 16/9; overflow: hidden; }
.collection-card img{ width: 100%; height: 100%; object-fit: cover; }
.collection-card-overlay{ position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,.85) 100%);
  display: flex; align-items: flex-end; padding: var(--sp-3); }
.collection-card-title{ font-size: var(--fs-sm); font-weight: var(--fw-semibold); color: #fff; }

/* ---------- INPUTS ---------- */
.input{
  width: 100%;
  height: var(--btn-h-md);
  padding: 0 var(--sp-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-1);
  font-size: var(--fs-sm);
  font-family: var(--font-ui);
  outline: none;
  transition: border-color .15s ease;
}
.input::placeholder{ color: var(--text-3); }
.input:focus{ border-color: var(--accent); }
.input.error{ border-color: var(--danger); }
.input:disabled{ opacity: .5; cursor: not-allowed; }

.search-input-wrap{ position: relative; display: flex; align-items: center; }
.search-input-wrap .icon{ position: absolute; left: var(--sp-3); color: var(--text-3); pointer-events: none; }
.search-input-wrap .input{ padding-left: var(--sp-10); }

.select{
  height: var(--btn-h-md);
  padding: 0 var(--sp-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-1);
  font-size: var(--fs-sm);
  font-family: var(--font-ui);
  cursor: pointer;
}
.select:focus{ border-color: var(--accent); outline: none; }

.checkbox-row{ display: flex; align-items: center; gap: var(--sp-2); cursor: pointer; font-size: var(--fs-sm); color: var(--text-2); }
.checkbox-row input[type=checkbox]{ width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }

.toggle{ position: relative; width: 38px; height: 22px; }
.toggle input{ opacity: 0; width: 0; height: 0; }
.toggle-track{ position: absolute; inset: 0; background: var(--surface-3); border: 1px solid var(--border); border-radius: var(--radius-full); transition: background .15s ease; cursor: pointer; }
.toggle-track::before{ content: ''; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; background: var(--text-2); border-radius: 50%; transition: transform .15s ease, background .15s ease; }
.toggle input:checked + .toggle-track{ background: var(--accent); border-color: var(--accent); }
.toggle input:checked + .toggle-track::before{ transform: translateX(16px); background: var(--accent-text); }

/* Filter dropdown chip */
.filter-chip{
  display: inline-flex; align-items: center; gap: var(--sp-1);
  height: var(--btn-h-sm); padding: 0 var(--sp-3);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-full);
  font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--text-2);
  cursor: pointer; white-space: nowrap; transition: all .15s ease;
}
.filter-chip.on{ background: rgba(245,185,61,.12); border-color: var(--accent); color: var(--accent); }

/* Upload field */
.upload-zone{
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  text-align: center;
  cursor: pointer;
  color: var(--text-3);
  transition: border-color .15s ease;
}
.upload-zone:hover{ border-color: var(--accent); color: var(--text-2); }

/* ---------- MAIN NAV BUTTON (glowing, rotating icon — bottom nav "Mods") ---------- */
.nb-main-wrap{ display:flex; flex-direction:column; align-items:center; gap:4px; flex:1; cursor:pointer; }
.nb-main-icon{
  width:52px; height:52px;
  background:#262626; border-radius:0;
  margin-top:-16px;
  border:3px solid var(--surface-1);
  box-shadow:0 4px 20px rgba(245,185,61,.4);
  display:flex; align-items:center; justify-content:center;
}
@keyframes navMainFloat{
  0%,100%{ transform:translateY(0); box-shadow:0 0 20px rgba(245,185,61,.3); }
  50%{ transform:translateY(-6px); box-shadow:0 0 30px rgba(245,185,61,.5); }
}
.nb-main-icon img{
  width:28px; height:28px;
  image-rendering:pixelated;
}
@keyframes navMainSpin{ 0%{ transform:rotate(0deg); } 100%{ transform:rotate(360deg); } }
.nb-main-label{ font-size:10px; font-weight:700; color:var(--accent); text-transform:uppercase; letter-spacing:.3px; }

/* ---------- DOWNLOAD BUTTON (stone texture, Minecraft pixel font — mod card / detail) ---------- */
.mc-download-btn{
  display:flex; align-items:center; justify-content:center;
  width:100%; height:38px;
  background-image:url('../assets/download_button.png');
  background-size:100% 100%;
  background-repeat:no-repeat;
  image-rendering:pixelated;
  border:0; padding:0; cursor:pointer;
  transition:transform .1s ease;
}
.mc-download-btn:active{ transform:scale(.96); }
.mc-download-btn .mc-dl-text{
  font-family:'Press Start 2P', monospace;
  font-size:11px;
  color:#fff;
  letter-spacing:1px;
}
.mc-download-btn.mc-download-btn-lg{ height:48px; }
.mc-download-btn.mc-download-btn-lg .mc-dl-text{ font-size:13px; }

/* ---------- SCREENSHOT GALLERY (mod detail page) ---------- */
.gallery{ display: flex; flex-direction: column; gap: var(--sp-2); }
.gallery-main{
  width: 100%; aspect-ratio: 16/9; border-radius: var(--radius-lg);
  overflow: hidden; background: var(--surface-3); border: 1px solid var(--border-strong);
  position: relative; cursor: zoom-in;
}
.gallery-main img, .gallery-main iframe{ width: 100%; height: 100%; object-fit: cover; border: 0; display: block; }
.gallery-main .gallery-play-badge{
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.35);
}
.gallery-play-badge svg{ width: 56px; height: 56px; color: #fff; filter: drop-shadow(0 2px 6px rgba(0,0,0,.6)); }

.gallery-thumbs{ display: flex; gap: var(--sp-2); overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.gallery-thumb{
  flex-shrink: 0; width: 84px; height: 56px; border-radius: var(--radius-sm);
  overflow: hidden; border: 2px solid var(--border); cursor: pointer;
  background: var(--surface-3); position: relative; transition: border-color .12s ease;
}
.gallery-thumb img{ width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-thumb.active{ border-color: var(--accent); }
.gallery-thumb:hover{ border-color: var(--border-strong); }
.gallery-thumb .thumb-play{
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.4);
}
.gallery-thumb .thumb-play svg{ width: 20px; height: 20px; color: #fff; }

/* Lightbox */
.lightbox{ position: fixed; inset: 0; z-index: 300; display: none; align-items: center; justify-content: center;
  background: rgba(0,0,0,.92); padding: var(--sp-4); }
.lightbox.open{ display: flex; }
.lightbox img{ max-width: 100%; max-height: 85vh; border-radius: var(--radius-md); }
.lightbox-close{ position: absolute; top: var(--sp-4); right: var(--sp-4); width: 40px; height: 40px;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center; color: var(--text-1); cursor: pointer; }
.lightbox-nav{ position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center; color: var(--text-1); cursor: pointer; }
.lightbox-nav.prev{ left: var(--sp-4); }
.lightbox-nav.next{ right: var(--sp-4); }

/* ---------- EMPTY STATE ---------- */
.empty-state{
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--sp-16) var(--sp-4);
  color: var(--text-3);
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
}
.empty-state-icon{ width: 48px; height: 48px; margin: 0 auto var(--sp-3); color: var(--text-3); }
.empty-state-title{ font-size: var(--fs-md); font-weight: var(--fw-bold); color: var(--text-2); margin-bottom: var(--sp-1); }
.empty-state-desc{ font-size: var(--fs-sm); color: var(--text-3); }
.section{ padding: var(--sp-6) 0; }
.section-head{ display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-4); }
.section-title{ font-size: var(--fs-lg); font-weight: var(--fw-bold); }
.section-link{ font-size: var(--fs-xs); font-weight: var(--fw-semibold); color: var(--accent); display: flex; align-items: center; gap: 2px; }

.container{ max-width: var(--container-max); margin: 0 auto; padding: 0 var(--sp-4); }

.grid-4{ display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-3); }
.grid-3{ display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-3); }
.grid-2{ display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-3); }

@media (max-width: 1024px){
  .grid-4{ grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px){
  .grid-4, .grid-3{ grid-template-columns: repeat(2, 1fr); }
  .grid-2{ grid-template-columns: 1fr; }
}
@media (max-width: 480px){
  .grid-4, .grid-3, .grid-2{ grid-template-columns: repeat(2, 1fr); }
}
