/* photobooth.css — trang chọn mẫu (/photobooth) + trang chụp (/photobooth/:layout).
   Theo style.md: pastel peach, Nunito heading / Comfortaa body, card 24px, nút pill, shadow pastel, mobile-first.
   Biến do view đặt: --slot-w/--slot-h (tỉ lệ ô ảnh), --canvas-w/--canvas-h (tỉ lệ cả frame). */

.pb { width: 100%; max-width: 1000px; margin: 0 auto; padding: 0 16px 40px; }

/* ---------- Đầu trang ---------- */
.pb-head { text-align: center; margin: 0 0 18px; }
.pb-eyebrow {
    display: inline-block; font: 800 .74rem/1 var(--font-display); letter-spacing: .1em; text-transform: uppercase;
    color: var(--accent); background: var(--peach-light); border: 1px solid var(--border-soft); border-radius: 999px; padding: 7px 14px;
}
.pb-title { font: 800 1.6rem/1.25 var(--font-display); color: var(--accent-soft); margin: 12px 0 8px; }
.pb-sub { color: var(--text-muted); font-size: .95rem; line-height: 1.65; max-width: 600px; margin: 0 auto; }
.pb-sub a { font-weight: 700; }
.pb-back {
    display: inline-flex; align-items: center; gap: 6px; font: 700 .82rem var(--font-display); color: var(--text-muted);
    text-decoration: none; margin-bottom: 10px;
}
.pb-back:hover { color: var(--accent); }
.pb-ic { width: 1.1em; height: 1.1em; flex: 0 0 auto; }

/* ---------- Thẻ chọn mẫu ---------- */
.pb-layouts { display: grid; grid-template-columns: repeat(auto-fill, minmax(172px, 1fr)); gap: 16px; margin-top: 22px; }
.pb-layout {
    display: flex; flex-direction: column; background: #fff; border: 1px solid var(--border-soft); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card); padding: 14px; text-decoration: none; color: var(--text-main);
    transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.pb-layout:hover { transform: translateY(-4px); box-shadow: var(--shadow-pop); border-color: var(--border-peach); color: var(--text-main); }
.pb-layout-art {
    height: 236px; display: flex; align-items: center; justify-content: center;
    background: var(--peach-light); border-radius: var(--radius-md); overflow: hidden; padding: 12px;
}
.pb-layout-art img { max-height: 100%; max-width: 100%; object-fit: contain; filter: drop-shadow(0 8px 14px rgba(250, 208, 196, .7)); transition: transform .3s; }
.pb-layout:hover .pb-layout-art img { transform: scale(1.04); }
.pb-layout-name { font: 800 1rem/1.3 var(--font-display); margin: 12px 0 4px; }
.pb-layout-desc { font-size: .8rem; color: var(--text-muted); line-height: 1.55; flex: 1; }
.pb-layout-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
.pb-badge { font: 800 .72rem/1 var(--font-display); background: var(--pastel-pink); color: #b34a6b; border-radius: 999px; padding: 6px 10px; white-space: nowrap; }
.pb-badge.mint { background: var(--pastel-mint); color: #1e6b42; }
.pb-badge.yellow { background: var(--pastel-yellow); color: #9a6b1e; }
.pb-layout-go { font: 800 .82rem var(--font-display); color: var(--accent); display: inline-flex; align-items: center; gap: 4px; }

/* ---------- Thanh bước ---------- */
.pb-steps { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; list-style: none; margin: 0 0 16px; padding: 0; }
.pb-step {
    display: inline-flex; align-items: center; gap: 8px; padding: 5px 13px 5px 5px; border-radius: 999px; background: #fff;
    border: 1px solid var(--border-soft); font: 700 .8rem var(--font-display); color: var(--text-muted); transition: .25s;
}
.pb-step i {
    width: 24px; height: 24px; border-radius: 50%; background: var(--peach-light); color: var(--accent);
    display: grid; place-items: center; font: 800 .74rem var(--font-display); font-style: normal;
}
.pb-step.active { background: linear-gradient(135deg, var(--primary-peach), var(--primary-peach-hover)); border-color: transparent; color: var(--text-main); box-shadow: var(--shadow-btn); }
.pb-step.active i { background: #fff; }
.pb-step.done { color: var(--text-main); }
.pb-step.done i { background: var(--pastel-mint); color: #1e6b42; }

/* ---------- Panel ---------- */
.pb-panel { background: #fff; border: 1px solid var(--border-soft); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: 18px; margin-bottom: 14px; }
.pb-panel h2 {
    font: 800 1.05rem var(--font-display); color: var(--accent); margin: 0 0 12px; padding-bottom: 10px;
    border-bottom: 1px dashed var(--border-soft); display: flex; align-items: center; gap: 8px;
}
.pb-panel h2 .pb-badge { margin-left: auto; }
.pb-note { font-size: .8rem; color: var(--text-muted); line-height: 1.55; margin: 10px 0 0; text-align: center; }

/* ---------- Chip chủ đề ---------- */
.pb-chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.pb-chips::-webkit-scrollbar { display: none; }
.pb-chip {
    flex: 0 0 auto; padding: 8px 14px; border-radius: 999px; border: 2px solid var(--border-soft); background: #fff;
    font: 700 .8rem var(--font-display); color: var(--text-muted); cursor: pointer; transition: .2s; white-space: nowrap;
}
.pb-chip:hover { border-color: var(--border-peach); color: var(--accent); }
.pb-chip.active { background: var(--pastel-pink); color: #b34a6b; border-color: transparent; }

/* ---------- Lưới khung ---------- */
.pb-frames { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; }
.pb-frame {
    position: relative; border: 2px solid var(--border-soft); border-radius: var(--radius-sm); background: var(--cream);
    padding: 6px; cursor: pointer; transition: .2s; text-align: center; font-family: inherit;
}
.pb-frame:hover { border-color: var(--border-peach); transform: translateY(-2px); }
.pb-frame img { width: 100%; aspect-ratio: var(--canvas-w) / var(--canvas-h); object-fit: contain; display: block; border-radius: 8px; background: #fff; }
.pb-frame span { display: block; font: 700 .7rem var(--font-display); color: var(--text-muted); margin-top: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pb-frame.selected { border-color: var(--accent); box-shadow: var(--shadow-btn); }
.pb-frame.selected span { color: var(--accent); }
.pb-frame.selected::after {
    content: ''; position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; border-radius: 50%;
    background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E") center/13px no-repeat;
    box-shadow: 0 2px 6px rgba(214, 125, 99, .4);
}
.pb-frame[hidden] { display: none; }

/* ---------- Camera ---------- */
.pb-cam {
    position: relative; margin: 0 auto; width: 100%; max-width: 560px; aspect-ratio: var(--slot-w) / var(--slot-h);
    border-radius: var(--radius-lg); overflow: hidden; background: #5c4b47; box-shadow: var(--shadow-soft);
}
.is-portrait .pb-cam { max-width: 340px; }
.pb-cam video { width: 100%; height: 100%; object-fit: cover; display: block; }
.pb-cam.flipped video { transform: scaleX(-1); }
.pb-cam-progress {
    position: absolute; top: 12px; left: 12px; z-index: 3; font: 800 .8rem var(--font-display); color: var(--text-main);
    background: rgba(255, 255, 255, .85); border-radius: 999px; padding: 6px 12px; backdrop-filter: blur(6px);
}
.pb-cam-msg {
    position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; padding: 20px; text-align: center;
    background: var(--peach-light); color: var(--text-main); font-size: .9rem; line-height: 1.6;
}
.pb-cam-msg[hidden], .pb-cam-progress[hidden], .pb-stage[hidden] { display: none; }
.pb-countdown { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; pointer-events: none; }
.pb-count {
    width: 120px; height: 120px; border-radius: 50%; background: rgba(255, 255, 255, .62); color: var(--accent);
    font: 800 64px/1 var(--font-display); display: grid; place-items: center; animation: pbPulse 1s ease-out both;
}
@keyframes pbPulse { 0% { transform: scale(.55); opacity: 1; } 100% { transform: scale(1.35); opacity: 0; } }
.pb-flash { position: absolute; inset: 0; z-index: 5; background: #fff; opacity: 0; pointer-events: none; }
.pb-flash.on { animation: pbFlash .3s ease-out; }
@keyframes pbFlash { 0% { opacity: 1; } 100% { opacity: 0; } }

.pb-controls { display: flex; align-items: flex-start; justify-content: center; gap: 18px; margin: 18px 0 4px; }
.pb-icon-btn {
    display: flex; flex-direction: column; align-items: center; gap: 5px; background: none; border: none; padding: 0;
    font: 700 .7rem var(--font-display); color: var(--text-muted); width: 64px; cursor: pointer;
}
.pb-icon-btn .ic {
    width: 46px; height: 46px; border-radius: 50%; background: #fff; border: 2px solid var(--border-soft);
    display: grid; place-items: center; color: var(--accent); transition: .2s;
}
.pb-icon-btn .ic svg { width: 22px; height: 22px; }
.pb-icon-btn:hover .ic { background: var(--peach-light); border-color: var(--border-peach); transform: translateY(-2px); }
.pb-icon-btn:disabled { opacity: .45; cursor: not-allowed; }
.pb-shutter {
    width: 82px; height: 82px; border-radius: 50%; border: none; position: relative; margin-top: 2px;
    background: linear-gradient(135deg, var(--primary-peach), var(--primary-peach-hover)); box-shadow: var(--shadow-pop);
    display: grid; place-items: center; color: var(--text-main); cursor: pointer; transition: transform .2s;
}
.pb-shutter::before { content: ''; position: absolute; inset: -7px; border-radius: 50%; border: 3px solid var(--border-soft); }
.pb-shutter svg { width: 34px; height: 34px; }
.pb-shutter:hover:not(:disabled) { transform: scale(1.06); }
.pb-shutter:disabled { opacity: .55; cursor: not-allowed; }

.pb-settings { display: flex; flex-wrap: wrap; gap: 10px 22px; justify-content: center; margin-top: 14px; }
.pb-setting { display: flex; align-items: center; gap: 8px; font: 700 .78rem var(--font-display); color: var(--text-muted); }
.pb-seg { display: inline-flex; background: var(--peach-light); border-radius: 999px; padding: 3px; }
.pb-seg button {
    border: none; background: transparent; border-radius: 999px; padding: 6px 12px; cursor: pointer;
    font: 800 .78rem var(--font-display); color: var(--text-muted); transition: .2s;
}
.pb-seg button.active { background: #fff; color: var(--accent); box-shadow: 0 2px 8px rgba(250, 208, 196, .7); }
.pb-seg button:disabled { cursor: not-allowed; opacity: .6; }

/* ---------- Ảnh đã chụp ---------- */
.pb-shots { display: flex; gap: 10px; overflow-x: auto; padding: 6px 2px 10px; min-height: 100px; -webkit-overflow-scrolling: touch; }
.pb-shot {
    position: relative; flex: 0 0 auto; height: 88px; aspect-ratio: var(--slot-w) / var(--slot-h); border-radius: 12px; overflow: hidden;
    border: 3px solid transparent; background: var(--cream); cursor: pointer; opacity: .55; transition: .2s; padding: 0;
}
.is-portrait .pb-shot { height: 128px; }
.pb-shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pb-shot.selected { border-color: var(--accent); opacity: 1; box-shadow: var(--shadow-btn); }
.pb-shot .n {
    position: absolute; top: 4px; left: 4px; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #fff;
    font: 800 .68rem var(--font-display); display: grid; place-items: center;
}
.pb-shot .up { position: absolute; bottom: 4px; right: 4px; font: 800 .58rem var(--font-display); background: var(--pastel-yellow); color: #9a6b1e; border-radius: 999px; padding: 2px 6px; }
.pb-shots-empty { width: 100%; color: var(--text-muted); font-size: .84rem; text-align: center; padding: 22px 10px; line-height: 1.6; margin: 0; }

/* ---------- Thanh hành động dính đáy ---------- */
.pb-bar {
    position: sticky; bottom: 12px; z-index: 6; display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap;
    padding: 12px 14px; border-radius: var(--radius-md); background: rgba(255, 255, 255, .88);
    backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); border: var(--border-glass); box-shadow: var(--shadow-soft);
}
.pb-bar .hint { width: 100%; text-align: center; font: 700 .78rem var(--font-display); color: var(--text-muted); }
.pb-bar .hint b { color: var(--accent); }
.btn.sm { padding: 10px 20px; font-size: .88rem; }
.btn .pb-ic { width: 1.15em; height: 1.15em; }

/* ---------- Kết quả ---------- */
.pb-result { display: flex; justify-content: center; }
.pb-result canvas { max-width: 100%; max-height: 72vh; width: auto; height: auto; border-radius: 12px; box-shadow: var(--shadow-soft); background: #fff; }
.pb-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 16px; }
.pb-actions.sub { margin-top: 10px; }
.pb-price { font: 800 .72rem/1 var(--font-display); background: var(--pastel-yellow); color: #9a6b1e; border-radius: 999px; padding: 5px 9px; margin-left: 2px; }

/* ---------- Loading / modal / toast ---------- */
.pb-loading { position: fixed; inset: 0; z-index: 9999; display: none; place-items: center; background: rgba(255, 247, 245, .8); backdrop-filter: blur(6px); }
.pb-loading.on { display: grid; }
.pb-loading .box { background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-soft); padding: 24px 30px; text-align: center; font: 700 .9rem var(--font-display); color: var(--text-main); }
.pb-spin { width: 44px; height: 44px; border-radius: 50%; border: 4px solid var(--border-soft); border-top-color: var(--accent); animation: pbSpin .9s linear infinite; margin: 0 auto 12px; }
@keyframes pbSpin { to { transform: rotate(360deg); } }

.pb-modal { position: fixed; inset: 0; z-index: 9000; display: none; place-items: center; background: rgba(92, 75, 71, .35); padding: 16px; }
.pb-modal.on { display: grid; }
.pb-modal .box {
    background: rgba(255, 255, 255, .94); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
    border-radius: var(--radius-xl); box-shadow: var(--shadow-soft); padding: 22px; max-width: 440px; width: 100%; text-align: center;
}
.pb-modal h3 { font: 800 1.15rem var(--font-display); color: var(--accent); margin: 0 0 10px; }
.pb-modal p { font-size: .9rem; line-height: 1.6; margin: 0 0 6px; }
.pb-modal .warn { color: var(--error-fg); background: var(--error-bg); border-radius: 12px; padding: 8px 12px; font-size: .82rem; }
.pb-tier { display: inline-block; border-radius: 999px; padding: 2px 9px; font: 800 .74rem var(--font-display); vertical-align: middle; }

.pb-toast {
    position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); z-index: 9500; opacity: 0; pointer-events: none;
    max-width: min(92vw, 420px); padding: 12px 18px; border-radius: 16px; font: 700 .85rem var(--font-display);
    background: var(--error-bg); color: var(--error-fg); border: 1px dashed #d9534f; box-shadow: var(--shadow-soft); transition: .25s;
}
.pb-toast.ok { background: var(--success-bg); color: var(--success-fg); border-color: #4caf89; }
.pb-toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Mobile ---------- */
@media (max-width: 1000px) {
    .pb { padding: 0 10px 30px; }
    .pb-title { font-size: 1.35rem; }
    .pb-layouts { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .pb-layout { padding: 10px; }
    .pb-layout-art { height: 196px; }
    .pb-frames { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .pb-panel { padding: 14px; }
    .pb-controls { gap: 12px; }
    .pb-step { font-size: .74rem; padding-right: 10px; }
}

/* ---------- Nội dung SEO dưới công cụ (dùng chung trang chọn mẫu + trang chụp) ---------- */
.pb-seo { max-width: 780px; margin: 40px auto 0; text-align: left; }
.pb-seo-panel { background: #fff; border: 1px solid var(--border-soft); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: 20px 22px; margin-bottom: 16px; }
.pb-seo-panel h2 { font: 800 1.15rem var(--font-display); color: var(--accent); margin: 0 0 12px; padding-bottom: 10px; border-bottom: 1px dashed var(--border-soft); }
.pb-seo-panel p { line-height: 1.75; margin: 0 0 10px; color: var(--text-main); }
.pb-faq { border: 1px solid var(--border-soft); border-radius: var(--radius-sm); background: var(--peach-light); margin-bottom: 8px; overflow: hidden; }
.pb-faq summary { cursor: pointer; font: 700 .95rem var(--font-display); color: var(--accent); padding: 12px 36px 12px 14px; list-style: none; position: relative; }
.pb-faq summary::-webkit-details-marker { display: none; }
.pb-faq summary::after { content: '▾'; position: absolute; right: 14px; top: 50%; transform: translateY(-50%); transition: transform .2s; color: var(--accent-soft); }
.pb-faq[open] summary::after { transform: translateY(-50%) rotate(180deg); }
.pb-faq p { padding: 10px 14px 12px; margin: 0; background: #fff; border-top: 1px dashed var(--border-soft); line-height: 1.75; }
.pb-links { padding-left: 20px; margin: 0; color: var(--text-main); }
.pb-links li { line-height: 1.8; margin-bottom: 4px; }
.pb-links a { color: var(--accent); font-weight: 700; }
.pb-themes { display: flex; flex-wrap: wrap; gap: 8px; }
.pb-themes span { font: 700 .78rem var(--font-display); background: var(--peach-light); border: 1px solid var(--border-soft); color: var(--text-muted); border-radius: 999px; padding: 6px 12px; }
