/* =========================
   assets/app.css (Dark, mobile-first, not oversized)
   Match index.css theme
   ========================= */

:root{
  --bg: #0b0f17;
  --bg2:#0f1726;
  --card: rgba(255,255,255,.035);
  --card2: rgba(255,255,255,.02);
  --text:#eef2ff;
  --muted:#95a3b8;
  --line: rgba(255,255,255,.09);
  --accent:#6ee7ff;
  --accent2:#a78bfa;
  --soft: rgba(255,255,255,.05);
  --shadow: 0 14px 34px rgba(0,0,0,.42);
  --radius: 16px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }

/* chống tràn ngang trên mobile */
html, body{ overflow-x:hidden; }

body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;

  background:
    radial-gradient(900px 500px at 20% -5%, rgba(110,231,255,.16), transparent 60%),
    radial-gradient(900px 500px at 90% 0%, rgba(167,139,250,.16), transparent 55%),
    linear-gradient(180deg, var(--bg), #070a11 70%);
}

a{ color:inherit; text-decoration:none; }
img{ display:block; }

.container{
  max-width: 1040px;
  margin: 0 auto;
  padding: 16px;
}
@media (min-width:768px){
  .container{ padding: 24px; }
}

/* breadcrumb: gọn trên mobile */
.breadcrumb{
  font-size: 13px;
  color: rgba(238,242,255,.62);
  margin: 6px 0 14px;
}
.breadcrumb a{
  color: var(--accent);
}

/* layout: mobile 1 cột, desktop 2 cột */
.layout{
  display:grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width:980px){
  .layout{ grid-template-columns: 1.35fr .65fr; }
}

/* panel: glass nhưng không dày quá */
.panel{
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--card), var(--card2));
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  padding: 14px;
  min-width:0;
}
@media (min-width:768px){
  .panel{ padding: 16px; }
}

/* header */
.head{
  display:flex;
  gap: 12px;
  align-items:center;
}

.icon{
  width: 72px;
  height: 72px;
  border-radius: 16px;
  object-fit: cover;
  flex: 0 0 auto;

  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.10);
}

.title{
  margin: 0;
  font-size: 20px;
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: .15px;
}

.slug{
  margin-top: 6px;
  font-size: 13px;
  color: rgba(238,242,255,.60);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 72vw;
}
@media (min-width:980px){
  .slug{ max-width: 560px; }
}

/* badges */
.badges{
  display:flex;
  flex-wrap:wrap;
  gap: 8px;
  margin-top: 10px;
}
.badge{
  font-size: 12px;
  color: rgba(238,242,255,.70);
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.18);
  padding: 6px 10px;
  border-radius: 999px;
}

/* desc */
.desc{
  margin-top: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  color: rgba(238,242,255,.82);

  /* FIX chống tràn ngang */
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* =========================
   Preview carousel (FIX: locked frame, no overflow)
   ========================= */

.preview-block{ margin-top: 16px; }
.preview-title{
  margin: 0 0 10px 0;
  font-size: 14px;
  font-weight: 900;
}

.preview-shell{
  position:relative;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 16px;
  background: rgba(0,0,0,.16);
  overflow:hidden;
}

/* track paging */
.preview-track{
  display:flex;
  overflow-x:auto;
  scroll-snap-type:x mandatory;
  -webkit-overflow-scrolling:touch;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
  scrollbar-width: thin;
}
.preview-track::-webkit-scrollbar{ height: 8px; }
.preview-track::-webkit-scrollbar-thumb{
  background: rgba(255,255,255,.16);
  border-radius: 999px;
}

.preview-slide{
  flex: 0 0 100%;
  scroll-snap-align: start;
  padding: 10px clamp(8px, 3vw, 14px);
}

/* FIX: khung preview cố định theo tỉ lệ screenshot */
/* ảnh ngang/dọc đều nằm gọn nhờ object-fit: contain */
.preview-card{
  width: 100%;
  aspect-ratio: var(--ar, 9 / 19.5);   /* mặc định, JS sẽ override theo ảnh */
  height: auto;
  min-height: 220px;                   /* tránh ảnh ngang bị quá thấp */
  max-height: min(640px, 72vh);

  border-radius: 14px;
  overflow:hidden;
  cursor: zoom-in;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.18);
  transition: border-color .12s ease, transform .12s ease;
}

@media (hover:hover){
  .preview-card:hover{
    border-color: rgba(110,231,255,.22);
    transform: translateY(-1px);
  }
}

.preview-img{
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: rgba(0,0,0,.14);
}

/* arrows: trên mobile làm nhẹ, không chiếm chỗ */
.pnav{
  position:absolute;
  top:50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  padding: 0 10px;
  font-size: 28px;
  line-height: 1;
  color: rgba(238,242,255,.65);
  cursor:pointer;
  user-select:none;
}
@media (hover:hover){
  .pnav:hover{ color: rgba(110,231,255,.95); }
}
.pnav:active{ transform: translateY(-50%) scale(.98); }
.pnav.left{ left: 6px; }
.pnav.right{ right: 6px; }

/* dots */
.dots{
  display:flex;
  gap: 6px;
  justify-content:center;
  padding: 10px 10px 12px;
  background: rgba(0,0,0,.12);
  border-top: 1px solid rgba(255,255,255,.08);
}
.dot{
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.22);
}
.dot.active{
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}

/* =========================
   Actions
   ========================= */

.side-title{
  margin: 0 0 10px 0;
  font-size: 14px;
  font-weight: 900;
}

.actions{
  display:flex;
  flex-direction: column;
  gap: 10px;
}

.action{
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 14px;
  padding: 12px;
  background: rgba(0,0,0,.16);

  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;

  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}

@media (hover:hover){
  .action:hover{
    border-color: rgba(110,231,255,.25);
    background: rgba(110,231,255,.06);
  }
}

.action:active{ transform: scale(.99); }

.action .left{ min-width:0; }
.action .k{
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* pill */
.pill{
  flex: 0 0 auto;
  font-size: 12px;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(110,231,255,.18);
  background: rgba(110,231,255,.08);
  color: rgba(238,242,255,.92);
  font-weight: 900;
}

/* =========================
   Lightbox
   ========================= */

.lightbox{
  position:fixed;
  inset:0;
  display:none;
  background: rgba(0,0,0,.86);
  z-index:9999;
  padding: 16px;
}
.lightbox.show{
  display:flex;
  align-items:center;
  justify-content:center;
}

.lightbox img{
  max-width: 96vw;
  max-height: 90vh;
  border-radius: 14px;
  background: rgba(0,0,0,.35);
  box-shadow: 0 20px 80px rgba(0,0,0,.55);
  border: 1px solid rgba(255,255,255,.12);
}

.lightbox .close{
  position:absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.12);
  color:#fff;
  font-size: 20px;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
}
