/* ========================================
   SKRIPSEEK - Status simpan data & cadangan (js/sync-status.js)
   ======================================== */

.sync-chip {
    --tone: var(--gray-400);
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    height: 32px;
    padding: 0 0.75rem;
    border: 1px solid var(--gray-200);
    border-radius: 999px;
    background: var(--white);
    color: var(--gray-600);
    font: 500 0.78rem/1 var(--font);
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
}
.sync-chip:hover { border-color: var(--gray-300); color: var(--black); }
.sync-chip:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }

.sync-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--tone);
    flex-shrink: 0;
}

.tone-ok    { --tone: var(--ok-fg, #059669); }
.tone-warn  { --tone: var(--warn-fg, #D97706); }
.tone-err   { --tone: var(--err-fg, #DC2626); }
.tone-muted { --tone: var(--gray-400); }

.sync-chip.tone-err {
    border-color: var(--err-border, #FCA5A5);
    background: var(--err-bg, #FEF2F2);
    color: var(--err-fg, #B91C1C);
}
.sync-chip.tone-warn { border-color: var(--warn-border, #FCD34D); }
.sync-chip.tone-muted .sync-dot { animation: sync-pulse 1.4s ease-in-out infinite; }
@keyframes sync-pulse { 50% { opacity: 0.35; } }

@media (max-width: 640px) {
    .sync-chip { padding: 0 0.6rem; }
    .sync-chip:not(.tone-err) .sync-label { display: none; }
}

/* ---------- Pemberitahuan ---------- */
.sync-toast {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 320;
    max-width: min(420px, calc(100vw - 2rem));
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    background: var(--gray-900);
    color: var(--white);
    font-size: 0.8125rem;
    line-height: 1.45;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}
.sync-toast.hidden { display: none; }
.sync-toast-msg { flex: 1; }
.sync-toast-btn {
    border: none;
    background: none;
    color: var(--orange);
    font: 600 0.8125rem var(--font);
    cursor: pointer;
    white-space: nowrap;
}
.sync-toast-close {
    border: none;
    background: none;
    color: inherit;
    opacity: 0.6;
    cursor: pointer;
}
@media (max-width: 768px) {
    .sync-toast { bottom: 5rem; left: 1rem; right: 1rem; max-width: none; }
}

/* ---------- Jendela Data & Cadangan ---------- */
.sync-overlay {
    position: fixed;
    inset: 0;
    z-index: 310;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.5);
}
.sync-overlay.hidden { display: none; }

.sync-box {
    width: 100%;
    max-width: 560px;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    padding: 1.5rem;
    border-radius: 16px;
    background: var(--white);
    color: var(--black);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}
.sync-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.sync-head h3 { font-size: 1.125rem; font-weight: 700; }
.sync-x {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: var(--gray-100);
    color: var(--gray-700);
    cursor: pointer;
}
.sync-x:hover { background: var(--gray-200); }

.sync-box h4 {
    margin: 1.25rem 0 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--gray-500);
}

.sync-status-block {
    padding: 0.9rem 1rem;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--gray-700);
}
.sync-status-block p { margin-top: 0.35rem; }
.sync-status-block .btn-sm { margin-top: 0.6rem; }
.sync-status-line { display: flex; align-items: center; gap: 0.5rem; color: var(--black); font-size: 0.875rem; }
.sync-muted { color: var(--gray-500); }
.sync-warn { color: var(--warn-fg, #B45309); }

.sync-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.9rem; }
.sync-file-btn { display: inline-flex; align-items: center; }

.sync-confirm {
    margin-top: 1rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--warn-border, #FCD34D);
    border-radius: 12px;
    background: var(--warn-bg, #FFFBEB);
    font-size: 0.8125rem;
    line-height: 1.5;
}
.sync-confirm.hidden { display: none; }
.sync-confirm .sync-actions { margin-top: 0.6rem; justify-content: flex-end; }

.sync-list { display: flex; flex-direction: column; gap: 0.5rem; }
.sync-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--gray-200);
    border-radius: 10px;
}
.sync-item-main { flex: 1; min-width: 0; }
.sync-item-title { font-size: 0.8125rem; font-weight: 600; }
.sync-item-sub { font-size: 0.75rem; color: var(--gray-500); margin-top: 0.15rem; }
.sync-empty { font-size: 0.8125rem; color: var(--gray-500); line-height: 1.5; }
