/*
 * Buku Tamu Desa — responsive layout patch (desktop, tablet, ponsel).
 * Dimuat SETELAH style.css dan screen.css; tidak mengubah style admin/website publik.
 * Hindari tinggi formulir yang dikunci berdasarkan vh dan ukuran kolom dinamis saat JS.
 */
html { -webkit-text-size-adjust: 100%; }
*, *::before, *::after { box-sizing: border-box; }
body { font-size: 16px !important; line-height: 1.5; overflow-x: hidden; }
.full-container {
    position: relative;
    inset: auto;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    height: auto;
    padding-bottom: 36px;
}
.bg-image { height: min(80vh, 720px); pointer-events: none; }
.margin-master {
    width: calc(100% - 48px);
    max-width: 1440px;
    margin-left: auto !important;
    margin-right: auto !important;
}
.headpage { position: relative; z-index: 30; padding: 18px 0 16px; }
.headpage > .margin-master.difle-l {
    min-height: 104px;
    margin: 0 auto !important;
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}
.logo, .logo.difle-l {
    min-height: 0;
    height: auto;
    display: flex !important;
    flex: 1 1 470px;
    justify-content: flex-start;
    align-items: center;
    gap: 14px;
    margin: 0;
    padding: 0;
    border: 0;
    min-width: 0;
}
.logo > div { min-width: 0; }
.logo img {
    display: block;
    flex: none;
    width: 76px;
    max-width: 76px;
    height: 76px;
    object-fit: contain;
    margin: 0;
}
.logo h1 {
    font-size: clamp(1.15rem, 2.1vw, 1.95rem);
    line-height: 1.17;
    letter-spacing: -.35px;
    overflow-wrap: anywhere;
}
.logo p {
    font-size: clamp(.8rem, 1.1vw, 1.03rem);
    line-height: 1.35;
    overflow-wrap: anywhere;
}
.headright, .headright.difle-r {
    display: flex !important;
    flex: 0 0 auto;
    width: auto;
    justify-content: flex-end;
    margin: 0 0 0 auto;
    text-align: right;
}
.datetime { font-size: .93rem; line-height: 1.4; white-space: normal; margin: 0; }
#thistime { display: inline-block; margin-left: 10px; font-variant-numeric: tabular-nums; }

/* Dua panel: sambutan dan formulir. Grid tidak memaksa konten melebar. */
.mainmargin {
    display: grid;
    grid-template-columns: minmax(235px, 285px) minmax(0, 1fr);
    gap: 18px;
    align-items: stretch;
    margin: 0 !important;
}
.area-title, .area-content {
    position: relative;
    width: auto;
    min-width: 0;
    flex: none;
    margin: 0;
}
.area-title::before, .area-content::before { margin: 10px; }
.area-title-inner {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 18px;
    margin: 10px;
    height: calc(100% - 20px);
    min-height: 565px;
    padding: 20px 14px 18px;
}
.area-title-inner h2 {
    margin: 0;
    font-size: 1.12rem;
    font-weight: 600;
    line-height: 1.3;
    white-space: normal;
}
.area-title-center { display: flex !important; flex: 1 1 auto; min-height: 255px; }
.bukutamu-title { padding: 0 7%; }
.bukutamu-title svg { display: block; max-height: 300px; }
.intro { width: 100%; }
.intro h3 { margin: 0 auto 17px; font-size: clamp(1.35rem, 2.25vw, 2rem); }
.intro img { max-width: 170px; width: 72%; height: auto; }
.area-title-bottom, .area-title-bottom.difle-c {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    margin: 0;
    padding: 0;
    gap: 8px;
    align-items: stretch;
    align-self: auto !important;
}
.area-title-bottom .knob {
    min-width: 0;
    width: 100%;
    min-height: 45px;
    height: auto;
    margin: 0 !important;
    padding: 10px 8px !important;
    font-size: .82rem;
    line-height: 1.2;
    white-space: normal;
    overflow-wrap: break-word;
}
.area-content-inner {
    margin: 10px;
    padding: clamp(16px, 2vw, 30px);
    min-width: 0;
}
.head-content {
    height: auto;
    min-height: 46px;
    margin-bottom: 22px;
    gap: 10px;
}
.head-content h1 { font-size: clamp(1.15rem, 1.65vw, 1.45rem); }
.head-content-icon {
    width: 43px;
    height: 43px;
    flex: 0 0 43px;
    margin: 0;
    border-radius: 6px;
}
.head-content-icon svg { width: 29px; height: 29px; }

/* Registrasi: 2 kolom isian plus kamera di desktop. */
#mainform { width: 100%; min-width: 0; }
#mainform > .grider {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(190px, 18vw, 250px);
    gap: clamp(14px, 2vw, 26px);
    align-items: start;
}
.content-form {
    display: block;
    width: 100%;
    min-width: 0;
    height: auto;
    margin: 0;
}
.content-form > .grider {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 17px 18px;
    margin: 0;
}
.col-input { width: auto; min-width: 0; margin: 0; }
#alamat, #lainnya { grid-column: 1 / -1; width: 100% !important; }
.content-form .form-group { margin: 0 !important; min-width: 0; }
.content-form label { display: block; margin: 0 0 7px; font-size: .96rem; font-weight: 600; line-height: 1.3; }
.content-form .form-control, .content-form .form-select {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 44px;
    height: 44px;
    border-radius: 6px;
    padding: 9px 12px;
    font-size: 1rem;
    line-height: 1.35;
}
.content-form textarea.form-control {
    height: auto !important;
    min-height: 96px !important;
    max-height: 240px;
    resize: vertical;
}
.capture {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
    margin: 0;
    gap: 10px;
    padding: 14px;
    border-radius: 12px;
    background: rgba(0, 115, 150, 0.05);
    border: 1px solid rgba(0, 115, 150, 0.12);
}
.capture-panel-title {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    margin: 0;
    text-align: center;
    font-size: .92rem;
    font-weight: 700;
    line-height: 1.3;
    color: #0d6f89;
}
.capture-box {
    position: relative;
    display: block;
    width: min(100%, 220px);
    height: auto;
    max-height: none;
    aspect-ratio: 4 / 5;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 12px;
    background: linear-gradient(160deg, rgba(0, 155, 128, .96), rgba(0, 129, 179, .96));
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
}
.capture-frame,
.capture-live {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.capture-frame {
    padding: 8px;
    z-index: 1;
}
.capture-frame::before {
    content: '';
    position: absolute;
    inset: 8px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,.18);
    background: rgba(0,0,0,.05);
}
.capture-live {
    z-index: 2;
    padding: 8px;
}
.capture-live > div,
.capture-live video,
.capture-live canvas,
.capture-box > img.guest-photo-preview,
.capture-frame > img,
.capture-frame > canvas,
.capture-frame > video {
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-width: 100%;
    object-fit: cover;
    object-position: center center;
    border-radius: 10px;
}
.capture-box > img.guest-photo-preview {
    position: absolute;
    inset: 8px;
    z-index: 5;
}
.capture-image { display: none !important; }
#capture {
    width: min(100%, 220px);
    margin: 0 auto;
}
.get-image {
    display: flex;
    width: 100%;
    min-height: 44px;
    height: auto;
    margin: 0;
    padding: 9px 12px;
    border: 0;
    border-radius: 8px;
    font-size: .95rem;
    line-height: 1.2;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0,0,0,.08);
}
.get-image svg { height: 24px; flex: 0 0 24px; }
.capture-help {
    width: min(100%, 220px);
    margin: 0 auto;
    text-align: center;
    font-size: .78rem;
    line-height: 1.35;
    color: #4f5d73;
}
.capture-bottom {
    width: min(100%, 220px);
    margin: 2px auto 0;
    align-self: auto !important;
}
.capture-bottom .d-grid { display: grid !important; grid-template-columns: 1fr; gap: 9px; }
.capture-bottom .knob {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 44px;
    height: auto;
    margin: 0 !important;
    padding: 9px 12px !important;
    font-size: .97rem;
    line-height: 1.2;
}
.capture-bottom .knob svg { width: 20px; height: 20px; margin-right: 6px; }
.capture-bottom #simpan:disabled { opacity: .6; cursor: not-allowed; }
.capture-disabled {
    display: flex;
    width: min(100%, 220px);
    min-height: 220px;
    margin: 0 auto;
    padding: 18px 12px;
    border-radius: 12px;
    text-align: center;
    color: #fff;
    background: linear-gradient(160deg, #009b80, #0081b3);
}
.capture-disabled svg { display: block; height: 48px; width: 48px; margin: 0 auto 10px; fill: currentColor; }
.capture-disabled strong { display: block; font-size: .9rem; line-height: 1.35; }
.capture-disabled span { display: block; margin-top: 6px; font-size: .78rem; line-height: 1.3; }
/* Indeks kepuasan memakai container yang sama dengan registrasi. */
.guest-survey .card { min-width: 0; }
.guest-survey .card-body { overflow-wrap: anywhere; }
.guest-survey .row > div { min-width: 0; }
.guest-survey .theme-light-show { max-width: 100%; object-fit: contain; }
.guest-survey .row .card { height: 100%; }

/* Tablet: sambutan menjadi bar navigasi dan formulir tetap 2 kolom. */
@media (max-width: 1100px) {
    .margin-master { width: calc(100% - 36px); }
    .headpage { padding: 12px 0 14px; }
.headpage > .margin-master.difle-l { min-height: 85px; }
    .logo img { width: 68px; max-width: 68px; height: 68px; }
    .mainmargin { grid-template-columns: minmax(0, 1fr); gap: 14px; }
    .area-title-inner {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 18px;
        height: auto;
        min-height: 0;
        margin: 9px;
        padding: 13px 20px;
    }
    .area-title-inner h2 { max-width: 220px; text-align: left; margin: 0; font-size: 1rem; }
    .area-title-center { display: none !important; }
    .area-title-bottom, .area-title-bottom.difle-c { width: min(395px, 60%); flex: 0 0 auto; }
    .area-title::before, .area-content::before { margin: 9px; }
    .area-content-inner { margin: 9px; padding: 22px; }
    #mainform > .grider { grid-template-columns: minmax(0, 1fr) 220px; gap: 20px; }
}

/* Ponsel dan tablet portrait sempit: semua input satu kolom. */
@media (max-width: 740px) {
    body { font-size: 15px !important; }
    .margin-master { width: calc(100% - 24px); }
    .headpage { padding: 12px 0; background: linear-gradient(to bottom, rgba(0, 0, 0, .45), rgba(0, 0, 0, .12)); }
    .headpage > .margin-master.difle-l {
        min-height: 0;
        display: flex !important;
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        padding: 0;
    }
    .logo, .logo.difle-l {
        flex: 0 0 auto;
        width: 100%;
        min-height: 0;
        margin: 0;
        padding: 0;
        gap: 10px;
    }
    .logo img { width: 56px; max-width: 56px; height: 56px; }
    .logo h1 { font-size: clamp(.99rem, 3.1vw, 1.22rem); }
    .logo p { font-size: clamp(.73rem, 2.3vw, .85rem); }
    .headright, .headright.difle-r {
        margin: 0 0 0 66px;
        padding: 0;
        width: auto;
        justify-content: flex-start;
        text-align: left;
    }
    .datetime { font-size: .79rem; }
    #thistime { margin-left: 7px; }
    .mainmargin { gap: 12px; }
    .area-title-inner {
        display: block;
        min-height: 0;
        padding: 14px;
        text-align: center;
    }
    .area-title-inner h2 { max-width: none; margin: 0 0 12px; text-align: center; }
    .area-title-bottom, .area-title-bottom.difle-c { width: 100%; }
    .area-title-bottom .knob { min-height: 43px; }
    .area-content-inner { padding: 18px; }
    .head-content { margin-bottom: 18px; }
    .head-content h1 { font-size: 1.2rem; }
    #mainform > .grider { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
    .content-form > .grider { grid-template-columns: minmax(0, 1fr); gap: 15px; }
    #alamat, #lainnya { grid-column: 1 / -1; }
    .capture { width: 100%; gap: 11px; padding: 13px; }
    .capture-box, #capture, .capture-help, .capture-bottom, .capture-disabled { width: min(100%, 280px); }
    .capture-bottom { margin: 5px auto 0; }
    .capture-bottom .d-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .content-form .form-control, .content-form .form-select { min-height: 46px; height: 46px; }
}
@media (max-width: 420px) {
    .margin-master { width: calc(100% - 18px); }
    .logo img { width: 48px; max-width: 48px; height: 48px; }
    .headright, .headright.difle-r { margin-left: 58px; }
    .area-title-inner { padding: 12px 10px; }
    .area-title-bottom .knob { font-size: .76rem; padding: 8px 6px !important; }
    .area-content-inner { padding: 14px; }
    .capture-box, #capture, .capture-help, .capture-bottom, .capture-disabled { width: min(100%, 100%); }
    .head-content-icon { width: 38px; height: 38px; flex-basis: 38px; }
    .head-content-icon svg { width: 26px; height: 26px; }
    .head-content h1 { font-size: 1.12rem; }
    .content-form .form-control, .content-form .form-select { font-size: 16px; }
    .content-form textarea.form-control { min-height: 100px !important; }
}
@media (max-width: 340px) {
    .area-title-bottom, .area-title-bottom.difle-c { grid-template-columns: minmax(0,1fr); }
    .capture-bottom .d-grid { grid-template-columns: minmax(0,1fr); }
}
@media (max-height: 560px) and (min-width: 741px) {
    .headpage { padding-top: 9px; padding-bottom: 9px; }
.headpage > .margin-master.difle-l { min-height: 62px; }
    .logo img { width: 58px; height: 58px; }
    .area-title-inner { min-height: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .bgload { animation: none; }
    .logo h1 { animation: none; }
}
