/* Trang xem thử demo/<slug> — trang độc lập, không nạp bộ CSS của theme */
html, body.demo-view {
    margin: 0;
    height: 100%;
    overflow: hidden;
    background: #fff;
}
body.demo-view {
    --demo-primary: #cc0000;
    --demo-bar-h: 52px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 14px;
    color: #1f2937;
}
.demo-view__frame {
    position: fixed;
    top: var(--demo-bar-h);
    left: 0;
    width: 100%;
    height: calc(100% - var(--demo-bar-h));
    border: 0;
}

/* ---- thanh trên cùng ---- */
.demo-bar {
    position: fixed;
    inset: 0 0 auto;
    z-index: 10;
    height: var(--demo-bar-h);
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 16px;
    background: #111827;
    color: #e5e7eb;
    box-shadow: 0 1px 0 rgba(255, 255, 255, .06);
}
.demo-bar__back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    color: #fff;
    font-weight: 600;
    text-decoration: none;
}
.demo-bar__back:hover .demo-bar__code { text-decoration: underline; }
.demo-bar__arrow { font-size: 18px; line-height: 1; }
.demo-bar__notice {
    flex: 1;
    min-width: 0;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}
.demo-bar__badge {
    flex-shrink: 0;
    padding: 3px 8px;
    border-radius: 4px;
    background: #f59e0b;
    color: #111827;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .02em;
}
.demo-bar__text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.demo-bar__text--short { display: none; }
.demo-bar__actions {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}
.demo-bar__phone {
    color: #fff;
    font-weight: 600;
    text-decoration: none;
}
.demo-bar__phone:hover { text-decoration: underline; }
.demo-bar__choose,
.demo-form__submit {
    border: 0;
    border-radius: 6px;
    background: var(--demo-primary);
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: filter .15s;
}
.demo-bar__choose { padding: 9px 16px; }
.demo-bar__choose:hover,
.demo-form__submit:hover { filter: brightness(1.1); }

@media (max-width: 991px) {
    .demo-bar__text--long { display: none; }
    .demo-bar__text--short { display: inline; }
    .demo-bar__phone { display: none; }
}
@media (max-width: 575px) {
    .demo-bar { gap: 10px; padding: 0 10px; }
    .demo-bar__code { display: none; }
    .demo-bar__badge { font-size: 11px; padding: 3px 6px; }
    .demo-bar__text { font-size: 12px; }
    .demo-bar__choose { padding: 8px 12px; font-size: 13px; }
}
@media (max-width: 380px) {
    .demo-bar__text { display: none !important; }
}

/* ---- popup chọn theme ---- */
.demo-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.demo-modal[hidden] { display: none; }
.demo-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, .6);
}
.demo-modal__box {
    position: relative;
    width: 100%;
    max-width: 440px;
    max-height: 100%;
    overflow-y: auto;
    box-sizing: border-box;
    padding: 28px 24px 24px;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
}
.demo-modal__close {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 36px;
    height: 36px;
    border: 0;
    background: none;
    color: #6b7280;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}
.demo-modal__close:hover { color: #111827; }
.demo-modal__title {
    margin: 0 0 4px;
    font-size: 20px;
    color: #111827;
}
.demo-modal__theme {
    margin: 0 0 10px;
    font-weight: 600;
    color: var(--demo-primary);
}
.demo-modal__lead {
    margin: 0 0 16px;
    color: #4b5563;
    line-height: 1.5;
}
.demo-modal__lead a { color: var(--demo-primary); font-weight: 700; }
.demo-modal__done { text-align: center; }
.demo-modal__check {
    width: 56px;
    height: 56px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: #16a34a;
    color: #fff;
    font-size: 30px;
    line-height: 56px;
}

.demo-form__field {
    display: block;
    margin-bottom: 12px;
}
.demo-form__field span {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
}
.demo-form__field b { color: var(--demo-primary); }
.demo-form__field input,
.demo-form__field textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font: inherit;
    color: inherit;
}
.demo-form__field textarea { resize: vertical; }
.demo-form__field input:focus,
.demo-form__field textarea:focus {
    outline: none;
    border-color: var(--demo-primary);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, .06);
}
.demo-form__error {
    margin: 0 0 12px;
    padding: 8px 12px;
    border-radius: 6px;
    background: #fef2f2;
    color: #b91c1c;
    line-height: 1.5;
}
.demo-form__error[hidden] { display: none; }
.demo-form__submit {
    width: 100%;
    padding: 12px 16px;
}
.demo-form__submit:disabled { opacity: .6; cursor: wait; }
