/* Halaman Kiosk OSBA: Top Bar Memanjang ke Kanan + Full Iframe Kasir Kopontren */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
    background: #022C22;
}

.kiosk-body {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* Top Bar Status Absensi */
.kiosk-bar {
    height: 68px;
    flex-shrink: 0;
    background: linear-gradient(90deg, #022C22 0%, #064E3B 45%, #0F172A 100%);
    color: #FFFFFF;
    border-bottom: 2px solid #F59E0B;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 16px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.28);
    z-index: 20;
    overflow: hidden;
}

.kb-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-right: 14px;
    border-right: 1px solid rgba(255, 255, 255, 0.16);
    flex-shrink: 0;
}
.kb-logo {
    background: linear-gradient(135deg, #10B981, #047857);
    color: #fff;
    font-weight: 900;
    font-size: 0.92rem;
    letter-spacing: 0.08em;
    padding: 7px 11px;
    border-radius: 9px;
    border: 1px solid rgba(167, 243, 208, 0.4);
}
.kb-conn {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 800;
    color: #6EE7B7;
    letter-spacing: 0.06em;
}
.kb-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #34D399;
    box-shadow: 0 0 8px #34D399;
    animation: kbPulse 1.6s infinite;
}
.kb-conn.offline .kb-dot { background: #EF4444; box-shadow: 0 0 8px #EF4444; animation: none; }
.kb-conn.offline { color: #FCA5A5; }
@keyframes kbPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.45; transform: scale(0.85); }
}

.kb-label {
    display: block;
    font-size: 0.64rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    color: #FDE68A;
    margin-bottom: 2px;
}

/* Kegiatan Aktif */
.kb-activity {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    max-width: 460px;
    padding-right: 16px;
    border-right: 1px solid rgba(255, 255, 255, 0.16);
    flex-shrink: 1;
    overflow: hidden;
}
.kb-activity-info {
    min-width: 0;
    flex: 1;
    overflow: hidden;
}
.kb-activity-row {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}
.kb-activity-row strong {
    font-size: 1.02rem;
    font-weight: 800;
    color: #FFFFFF;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.kb-schedule {
    font-size: 0.76rem;
    color: #A7F3D0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.kb-switch-btn {
    flex-shrink: 0;
    background: linear-gradient(135deg, #FBBF24, #D97706);
    color: #1E1B08;
    border: 1px solid rgba(254, 243, 199, 0.6);
    border-radius: 9px;
    padding: 7px 11px;
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.28);
    transition: transform .15s, filter .15s;
}
.kb-switch-btn:hover {
    filter: brightness(1.06);
    transform: translateY(-1px);
}
.kb-switch-btn:active {
    transform: translateY(0);
}

/* Status Tap Terakhir + Mode USB RFID Reader */
.kb-last-tap {
    position: relative;
    flex: 1;
    min-width: 240px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    padding: 5px 12px;
    overflow: hidden;
    cursor: pointer;
    user-select: none;
    transition: background .25s, border-color .25s, box-shadow .25s;
}
.kb-last-tap:hover {
    background: rgba(255, 255, 255, 0.13);
    border-color: rgba(167, 243, 208, 0.45);
}
.kb-last-tap.scan-active {
    background: rgba(6, 95, 70, 0.72);
    border: 1.5px solid #34D399;
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.25);
}
.kb-hidden-rfid-input {
    position: absolute;
    left: -9999px;
    top: 0;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}
.kb-tap-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 2px;
}
.kb-tap-head .kb-label {
    margin-bottom: 0;
}
.kb-last-tap.scan-active .kb-label {
    color: #6EE7B7;
}
.kb-scan-hint {
    font-size: 0.65rem;
    font-weight: 700;
    color: #A7F3D0;
    background: rgba(16, 185, 129, 0.18);
    border: 1px solid rgba(110, 231, 183, 0.3);
    padding: 1px 7px;
    border-radius: 999px;
    white-space: nowrap;
}
.kb-scan-stop {
    background: rgba(239, 68, 68, 0.24);
    color: #FECACA;
    border: 1px solid rgba(248, 113, 113, 0.5);
    border-radius: 999px;
    padding: 1px 8px;
    font-size: 0.65rem;
    font-weight: 800;
    cursor: pointer;
    line-height: 1.3;
}
.kb-scan-stop:hover {
    background: #EF4444;
    color: #FFFFFF;
}
.kb-scan-stop[hidden],
.kb-scan-hint[hidden] {
    display: none !important;
}
.kb-last-tap.flash-ontime {
    background: rgba(16, 185, 129, 0.38);
    border-color: #34D399;
}
.kb-last-tap.flash-late {
    background: rgba(239, 68, 68, 0.38);
    border-color: #F87171;
}
.kb-last-tap.flash-error {
    background: rgba(245, 158, 11, 0.38);
    border-color: #FBBF24;
}

.kb-tap-row {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    overflow: hidden;
}
.kb-tap-badge {
    font-size: 0.68rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 999px;
    flex-shrink: 0;
}
.kb-tap-badge.ontime { background: #10B981; color: #022C22; }
.kb-tap-badge.late { background: #EF4444; color: #FFFFFF; }
.kb-tap-badge.error { background: #F59E0B; color: #1E1B08; }
.kb-tap-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: #FFFFFF;
    overflow: hidden;
    text-overflow: ellipsis;
}
.kb-tap-meta { font-size: 0.78rem; color: #CBD5E1; flex-shrink: 0; }
.kb-tap-idle { font-size: 0.84rem; color: #94A3B8; font-style: italic; }

/* Counters */
.kb-counters {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.kb-count {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 9px;
    padding: 4px 10px;
    text-align: center;
    min-width: 54px;
    line-height: 1.15;
}
.kb-count small { display: block; font-size: 0.64rem; color: #CBD5E1; text-transform: uppercase; font-weight: 700; }
.kb-count strong { font-size: 1rem; font-weight: 800; }
.kb-count.ontime strong { color: #34D399; }
.kb-count.late strong { color: #FCA5A5; }

/* Clock & Tools */
.kb-right {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-left: 12px;
    border-left: 1px solid rgba(255, 255, 255, 0.16);
    flex-shrink: 0;
}
.kb-clock-box { text-align: right; line-height: 1.15; }
.kb-clock-box strong { display: block; font-size: 1.05rem; font-variant-numeric: tabular-nums; color: #FDE68A; }
.kb-clock-box small { font-size: 0.68rem; color: #CBD5E1; }

.kb-tools { display: flex; align-items: center; gap: 6px; }
.kb-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-decoration: none;
    transition: background .18s;
}
.kb-btn:hover { background: rgba(255, 255, 255, 0.24); }

/* Main Iframe Area */
.kiosk-frame-wrap {
    flex: 1;
    width: 100%;
    position: relative;
    background: #FFFFFF;
}
.kiosk-iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

/* Modal Ganti Kegiatan Kiosk */
.km-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(2, 44, 34, 0.72);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
}
.km-backdrop[hidden] {
    display: none !important;
}
.km-dialog {
    width: 100%;
    max-width: 440px;
    background: #FFFFFF;
    color: #0F172A;
    border-radius: 18px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45);
    overflow: hidden;
    border: 1px solid #A7F3D0;
    animation: kmPop .16s ease-out;
}
@keyframes kmPop {
    from { opacity: 0; transform: scale(0.95) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
.km-header {
    background: linear-gradient(135deg, #064E3B, #022C22);
    color: #FFFFFF;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}
.km-eyebrow {
    display: block;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    color: #FDE68A;
}
.km-header h2 {
    font-size: 1.15rem;
    font-weight: 800;
    margin-top: 2px;
}
.km-close {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #FFFFFF;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
}
.km-close:hover { background: rgba(255, 255, 255, 0.24); }

.km-body { padding: 18px 20px; }
.km-current-info {
    background: #ECFDF5;
    border: 1px solid #A7F3D0;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 14px;
    font-size: 0.85rem;
    color: #065F46;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.km-current-info strong { color: #022C22; font-weight: 800; text-align: right; }

.km-field { margin-bottom: 14px; }
.km-field label {
    display: block;
    font-size: 0.82rem;
    font-weight: 700;
    color: #334155;
    margin-bottom: 6px;
}
.km-field select,
.km-field input[type="password"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #CBD5E1;
    border-radius: 10px;
    font-size: 0.94rem;
    font-family: inherit;
    color: #0F172A;
    background: #FFFFFF;
}
.km-field select:focus,
.km-field input[type="password"]:focus {
    outline: none;
    border-color: #059669;
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.16);
}

.km-feedback {
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 700;
    margin-top: 4px;
}
.km-feedback.error {
    background: #FEF2F2;
    color: #991B1B;
    border: 1px solid #FECACA;
}
.km-feedback.success {
    background: #ECFDF5;
    color: #065F46;
    border: 1px solid #A7F3D0;
}

.km-footer {
    padding: 12px 20px 18px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
.km-btn {
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid transparent;
    font-family: inherit;
}
.km-btn-cancel {
    background: #F1F5F9;
    color: #334155;
    border-color: #CBD5E1;
}
.km-btn-cancel:hover { background: #E2E8F0; }
.km-btn-submit {
    background: #047857;
    color: #FFFFFF;
}
.km-btn-submit:hover { background: #065F46; }
.km-btn-submit:disabled { opacity: 0.65; cursor: not-allowed; }

@media (max-width: 1024px) {
    .kb-counters { display: none; }
    .kb-clock-box small { display: none; }
}
@media (max-width: 720px) {
    .kiosk-bar { height: auto; flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
    .kb-activity, .kb-last-tap { border-right: 0; padding-right: 0; max-width: none; }
}
