/* ===== Warung Mbok Ratna — decoy + dashboard ===== */
:root {
  --bg: #fdf6ec;
  --bg-soft: #f7ecdd;
  --card: #ffffff;
  --text: #3d2b1f;
  --muted: #8a7561;
  --accent: #c2410c;
  --accent-2: #9a3412;
  --border: #e8dcc8;
  --green: #16a34a;
  --danger: #dc2626;
  --shadow: 0 12px 40px rgba(0,0,0,.12);
  --radius: 16px;
}
[data-theme="dark"] {
  --bg: #1c1917;
  --bg-soft: #231f1d;
  --card: #292524;
  --text: #f5f5f4;
  --muted: #a8a29e;
  --accent: #fb923c;
  --accent-2: #ea580c;
  --border: #44403c;
  --shadow: 0 12px 40px rgba(0,0,0,.4);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text);
  min-height: 100vh; transition: background .3s, color .3s;
  -webkit-tap-highlight-color: transparent;
}

/* ===== Login ===== */
.login-page { display: flex; align-items: center; justify-content: center; padding: 20px; min-height: 100vh; position: relative; overflow: hidden; }
.login-bg {
  position: fixed; inset: 0; z-index: 0; opacity: .12;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60'%3E%3Cpath d='M30 5L55 55H5z' fill='none' stroke='%23c2410c' stroke-width='1'/%3E%3C/svg%3E");
}
.float-items { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.float-items span {
  position: absolute; font-size: 28px; opacity: .18; animation: floaty 9s ease-in-out infinite;
}
.float-items span:nth-child(1) { top: 12%; left: 8%; animation-delay: 0s; }
.float-items span:nth-child(2) { top: 70%; left: 6%; animation-delay: 1.4s; font-size: 34px; }
.float-items span:nth-child(3) { top: 18%; right: 9%; animation-delay: 2.2s; font-size: 30px; }
.float-items span:nth-child(4) { top: 76%; right: 7%; animation-delay: .6s; }
.float-items span:nth-child(5) { top: 45%; left: 3%; animation-delay: 3s; font-size: 22px; }
.float-items span:nth-child(6) { top: 42%; right: 3%; animation-delay: 1.9s; font-size: 26px; }
@keyframes floaty {
  0%,100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-14px) rotate(6deg); }
}
.login-card {
  position: relative; z-index: 1; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius);
  max-width: 420px; width: 100%; padding: 32px 28px;
  box-shadow: var(--shadow); animation: cardIn .5s ease;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.login-header { text-align: center; margin-bottom: 22px; }
.logo-circle {
  width: 68px; height: 68px; margin: 0 auto 12px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex; align-items: center; justify-content: center;
  font-size: 34px; box-shadow: 0 6px 18px rgba(194,65,12,.35);
  animation: logoPop .6s ease;
}
@keyframes logoPop { 0% { transform: scale(.6); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.login-header h1 { font-size: 22px; margin-bottom: 4px; }
.login-header p { color: var(--muted); font-size: 13px; }
.badge-aktif {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 10px;
  background: #dcfce7; color: #166534; font-size: 12px; font-weight: 600;
  padding: 5px 12px; border-radius: 999px;
}
[data-theme="dark"] .badge-aktif { background: #14532d; color: #bbf7d0; }
.badge-aktif .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }
.menu-preview { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 18px; }
.menu-preview span {
  background: var(--bg); border: 1px solid var(--border);
  padding: 4px 10px; border-radius: 999px; font-size: 12px; color: var(--muted);
}
.menu-preview b { color: var(--accent); }
form label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 5px; }
form input, form textarea {
  width: 100%; padding: 11px 13px; border: 1px solid var(--border);
  border-radius: 10px; font-size: 15px; background: var(--bg); color: var(--text);
  outline: none; transition: border .2s, box-shadow .2s;
}
form input:focus, form textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(194,65,12,.15); }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 44px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: none; font-size: 17px; cursor: pointer; opacity: .6; padding: 6px;
}
.pw-toggle:hover { opacity: 1; }
.btn-login {
  width: 100%; margin-top: 18px; padding: 13px; border: none; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-size: 15px; font-weight: 700; cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.btn-login:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(194,65,12,.4); }
.btn-login:active { transform: translateY(0); }
.btn-login .arrow { display: inline-block; transition: transform .2s; }
.btn-login:hover .arrow { transform: translateX(3px); }
.login-error { margin-top: 12px; color: var(--danger); font-size: 13px; text-align: center; animation: shake .4s; }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.login-footer { margin-top: 18px; text-align: center; color: var(--muted); font-size: 12px; line-height: 1.7; }
.login-footer a { color: var(--accent); text-decoration: none; }

/* ===== Dashboard ===== */
.topbar {
  position: sticky; top: 0; z-index: 50; background: var(--card);
  border-bottom: 1px solid var(--border); padding: 12px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.topbar .brand .logo-circle { width: 38px; height: 38px; font-size: 20px; margin: 0; }
.topbar .actions { display: flex; gap: 8px; align-items: center; }
.icon-btn {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  width: 38px; height: 38px; border-radius: 10px; cursor: pointer; font-size: 17px;
  display: flex; align-items: center; justify-content: center; transition: background .2s;
}
.icon-btn:hover { background: var(--border); }
.container { max-width: 860px; margin: 0 auto; padding: 20px 16px 80px; }
.tabs { display: flex; gap: 6px; margin-bottom: 20px; overflow-x: auto; }
.tab {
  flex: 1; min-width: 110px; padding: 11px 10px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); border-radius: 12px; cursor: pointer;
  font-size: 14px; font-weight: 600; transition: all .2s; white-space: nowrap;
}
.tab.active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border-color: transparent; }
.panel { display: none; }
.panel.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Toolbar */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar-hint { font-size: 13px; color: var(--muted); }
.search-input {
  flex: 1; min-width: 160px; padding: 9px 13px; border: 1px solid var(--border);
  border-radius: 10px; font-size: 14px; background: var(--bg); color: var(--text);
  outline: none; transition: border .2s;
}
.search-input:focus { border-color: var(--accent); }
.upload-btn { position: relative; overflow: hidden; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.upload-btn input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* Gallery */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.gallery .photo {
  position: relative; border-radius: 12px; overflow: hidden; cursor: pointer;
  aspect-ratio: 3/4; background: var(--border); border: 1px solid var(--border);
  animation: fade .3s ease;
}
.gallery .photo img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.gallery .photo:hover img { transform: scale(1.04); }
.gallery .photo .cap {
  position: absolute; bottom: 0; left: 0; right: 0; padding: 18px 8px 7px;
  background: linear-gradient(transparent, rgba(0,0,0,.75)); color: #fff;
  font-size: 11px; font-weight: 600;
}
.gallery .photo .del {
  position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff; border: none; cursor: pointer; font-size: 14px;
  display: none; align-items: center; justify-content: center;
}
.gallery .photo:hover .del { display: flex; }

/* Timeline stories */
.timeline { position: relative; padding-left: 22px; }
.timeline::before {
  content: ""; position: absolute; left: 7px; top: 4px; bottom: 4px; width: 2px;
  background: var(--border);
}
.story { position: relative; margin-bottom: 18px; }
.story::before {
  content: ""; position: absolute; left: -21px; top: 6px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--accent); border: 2px solid var(--card);
}
.story .date { font-size: 12px; color: var(--accent); font-weight: 700; }
.story .title { font-weight: 700; font-size: 15px; margin: 3px 0 6px; }
.story .meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 6px; }
.story .meta span {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600;
  background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px;
}
.story .meta .loc { color: var(--accent); }
.story .meta .dur { color: var(--green); }
.story .body { color: var(--muted); font-size: 14px; line-height: 1.65; white-space: pre-line; }
.story .body.censored { filter: blur(6px); cursor: pointer; transition: filter .2s; }
.story .body.censored:hover { filter: none; }
.story .actions { display: flex; gap: 8px; margin-top: 8px; }
.story .actions button {
  background: none; border: none; color: var(--muted); font-size: 12px; cursor: pointer; padding: 2px 6px; border-radius: 6px;
}
.story .actions button:hover { background: var(--bg); color: var(--danger); }
.story .actions .edit-story:hover { color: var(--accent); }
.story .actions .view-story:hover { color: var(--green); }
.story-tags { display: flex; gap: 4px; margin: 3px 0; }
.story-tags span { font-size: 15px; }
.story-thumbs { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.story-thumbs img {
  width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); cursor: pointer;
}
.story-thumbs .more {
  width: 64px; height: 64px; border-radius: 8px; background: var(--bg); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; font-size: 13px; color: var(--muted); font-weight: 700;
}

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 18px 14px; text-align: center;
}
.stat-num { font-size: 26px; font-weight: 800; color: var(--accent); }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* Filter chips */
.filter-bar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.chip {
  background: var(--card); border: 1px solid var(--border); color: var(--text);
  padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all .2s;
}
.chip:hover { border-color: var(--accent); }
.chip.active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border-color: transparent; }

/* Ranking lokasi */
.rank-list { display: flex; flex-direction: column; gap: 12px; }
.rank-item .rank-name { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.rank-badge {
  width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-size: 11px; font-weight: 800;
}
.rank-count { margin-left: auto; color: var(--muted); font-weight: 500; font-size: 12px; }
.rank-bar { height: 8px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.rank-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 999px; transition: width .5s ease; }

/* Bar chart */
.bar-chart { display: flex; align-items: flex-end; gap: 8px; min-height: 140px; padding-top: 10px; overflow-x: auto; }
.bar-col { flex: 1; min-width: 44px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bar-track {
  width: 100%; max-width: 46px; height: 90px; background: var(--bg);
  border-radius: 8px; overflow: hidden; display: flex; align-items: flex-end;
}
.bar-fill {
  width: 100%; background: linear-gradient(180deg, var(--accent), var(--accent-2));
  border-radius: 8px 8px 0 0; min-height: 4px; transition: height .5s ease;
}
.bar-label { font-size: 11px; color: var(--muted); font-weight: 600; }
.bar-val { font-size: 12px; color: var(--accent); font-weight: 800; }

/* Export / settings */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 18px; margin-bottom: 14px;
}
.card h3 { font-size: 15px; margin-bottom: 8px; }
.card p { font-size: 13px; color: var(--muted); line-height: 1.6; }
.row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.btn {
  padding: 10px 16px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg); color: var(--text); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: background .2s;
}
.btn:hover { background: var(--border); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border-color: transparent; }
.btn.danger { color: var(--danger); border-color: var(--danger); }

/* Lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.92);
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.lightbox.open { display: flex; animation: fade .2s; }
.lightbox img { max-width: 100%; max-height: 90vh; border-radius: 8px; }
.lightbox .close {
  position: absolute; top: 16px; right: 20px; background: none; border: none;
  color: #fff; font-size: 32px; cursor: pointer;
}
.lightbox .cap { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; color: #ddd; font-size: 13px; }

/* Modal */
.modal {
  position: fixed; inset: 0; z-index: 110; background: rgba(0,0,0,.55);
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal.open { display: flex; animation: fade .2s; }
.modal-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  width: 100%; max-width: 520px; padding: 24px; position: relative;
  box-shadow: var(--shadow); max-height: 90vh; overflow-y: auto;
}
.modal-card h3 { margin-bottom: 14px; }
.modal-card label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 5px; }
.modal-card input, .modal-card textarea {
  width: 100%; padding: 11px 13px; border: 1px solid var(--border);
  border-radius: 10px; font-size: 15px; background: var(--bg); color: var(--text);
  outline: none; font-family: inherit; transition: border .2s, box-shadow .2s;
}
.modal-card input:focus, .modal-card textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(194,65,12,.15); }
.modal-card textarea { resize: vertical; }
.modal-card .check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.modal-card .check input { width: auto; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 480px) { .form-row { grid-template-columns: 1fr; } }
.modal-close {
  position: absolute; top: 12px; right: 16px; background: none; border: none;
  font-size: 24px; color: var(--muted); cursor: pointer;
}
.modal-close:hover { color: var(--danger); }

/* Tag picker */
.tag-picker { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 2px; }
.tag-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg); font-size: 19px; cursor: pointer; transition: all .15s;
}
.tag-btn:hover { border-color: var(--accent); }
.tag-btn.sel { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; }

/* Story foto preview */
.story-foto-prev { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.prev-item { position: relative; width: 72px; height: 72px; }
.prev-item img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.prev-item .del {
  position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(0,0,0,.65); color: #fff; border: none; cursor: pointer; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.story-foto-note { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* Detail */
.detail-date { font-size: 12px; color: var(--accent); font-weight: 700; }
.detail-title { font-size: 20px; margin: 6px 0 8px; }
.detail-text { font-size: 15px; line-height: 1.7; color: var(--text); white-space: normal; margin-top: 10px; }
.detail-fotos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.detail-fotos img {
  width: 90px; height: 90px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); cursor: pointer;
}

/* PIN card */
.pin-card { max-width: 320px; text-align: center; }
.pin-msg { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.pin-err { color: var(--danger); font-size: 13px; margin-top: 8px; }
.pin-card input { text-align: center; font-size: 22px; letter-spacing: 10px; }

/* Rekap bulanan */
.rekap-list { display: flex; flex-direction: column; gap: 10px; }
.rekap-item { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.rekap-head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.rekap-head strong { color: var(--accent); }
.rekap-head span { color: var(--muted); font-weight: 600; }
.rekap-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* Kalender */
.kal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.kal-month { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 8px; }
.kal-title { font-size: 12px; font-weight: 800; color: var(--accent); margin-bottom: 4px; text-align: center; }
.kal-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-bottom: 2px; }
.kal-week span { font-size: 9px; text-align: center; color: var(--muted); font-weight: 600; }
.kal-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.kal-days .day {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  font-size: 10px; border-radius: 4px; color: var(--muted); background: transparent;
}
.kal-days .day.on { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-weight: 700; }
.kal-days .empty { aspect-ratio: 1; }

/* Toast */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg); padding: 11px 20px; border-radius: 999px;
  font-size: 13px; font-weight: 600; z-index: 200; opacity: 0; pointer-events: none;
  transition: opacity .3s, transform .3s; box-shadow: 0 6px 20px rgba(0,0,0,.3);
  white-space: nowrap; max-width: 90vw; overflow: hidden; text-overflow: ellipsis;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 480px) {
  .login-card { padding: 24px 18px; }
  .gallery { grid-template-columns: repeat(2, 1fr); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
