* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background: #f4f6f9; color: #1a1a1a; }

/* LOGIN */
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #3d1c00, #8B4513);
}
.login-box {
  background: #fff; border-radius: 20px; padding: 48px 40px;
  width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  text-align: center;
}
.login-box h1 { font-size: 2rem; font-weight: 900; letter-spacing: 4px; color: #8B4513; }
.login-box > p { color: #999; margin-bottom: 32px; font-size: .9rem; }
.field { margin-bottom: 18px; text-align: left; }
.field label { display: block; font-size: .8rem; font-weight: 700; color: #555; margin-bottom: 6px; letter-spacing: .5px; }
.field input {
  width: 100%; padding: 12px 16px; border: 1.5px solid #e0e0e0;
  border-radius: 10px; font-size: 1rem; transition: border-color .2s;
  outline: none;
}
.field input:focus { border-color: #8B4513; }
.btn-login {
  width: 100%; padding: 14px; background: #8B4513; color: #fff;
  border: none; border-radius: 10px; font-size: 1rem; font-weight: 700;
  cursor: pointer; transition: background .2s; margin-top: 8px;
}
.btn-login:hover { background: #D2691E; }
.error-msg { color: #e53e3e; font-size: .85rem; margin: 8px 0; }
.back-link { display: block; margin-top: 20px; color: #999; font-size: .85rem; text-decoration: none; }
.back-link:hover { color: #8B4513; }

/* LAYOUT */
#adminPanel { display: flex; min-height: 100vh; }

/* SIDEBAR */
.sidebar {
  width: 240px; background: #1a1a1a; color: #fff;
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; height: 100vh;
  transition: transform .3s;
  z-index: 100;
}
.sidebar.hidden { transform: translateX(-240px); }
.sidebar-logo {
  padding: 28px 24px; font-size: 1.3rem; font-weight: 900;
  letter-spacing: 3px; color: #F4A460; border-bottom: 1px solid #333;
  line-height: 1.3;
}
.sidebar-logo small { font-size: .7rem; font-weight: 400; color: #888; letter-spacing: 2px; }
.sidebar-nav { flex: 1; padding: 16px 0; overflow-y: auto; }
.nav-item {
  display: block; padding: 12px 24px; color: #aaa; text-decoration: none;
  font-size: .9rem; transition: background .2s, color .2s; border-left: 3px solid transparent;
}
.nav-item:hover { background: #2a2a2a; color: #fff; }
.nav-item.active { background: #2a2a2a; color: #F4A460; border-left-color: #F4A460; }
.sidebar-footer { padding: 20px; border-top: 1px solid #333; display: flex; flex-direction: column; gap: 10px; }
.btn-preview {
  display: block; text-align: center; padding: 10px;
  background: #2a2a2a; color: #F4A460; text-decoration: none;
  border-radius: 8px; font-size: .85rem; font-weight: 600; transition: background .2s;
}
.btn-preview:hover { background: #3a3a3a; }
.btn-logout {
  width: 100%; padding: 10px; background: #8B4513; color: #fff;
  border: none; border-radius: 8px; font-size: .85rem; font-weight: 600; cursor: pointer;
}
.btn-logout:hover { background: #D2691E; }

/* MAIN */
.main-content {
  margin-left: 240px; flex: 1; display: flex; flex-direction: column;
  min-height: 100vh; transition: margin-left .3s;
}
.main-content.expanded { margin-left: 0; }
.topbar {
  background: #fff; padding: 16px 28px; border-bottom: 1px solid #e8e8e8;
  display: flex; align-items: center; gap: 16px; position: sticky; top: 0; z-index: 50;
}
.topbar h2 { font-size: 1.1rem; font-weight: 700; flex: 1; }
.menu-toggle { background: none; border: none; font-size: 1.3rem; cursor: pointer; color: #555; }
.save-indicator { font-size: .8rem; color: #48bb78; font-weight: 600; opacity: 0; transition: opacity .3s; }
.save-indicator.show { opacity: 1; }

/* TABS */
.tab-content { display: none; padding: 28px; }
.tab-content.active { display: block; }

/* PANEL */
.panel {
  background: #fff; border-radius: 16px; padding: 32px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06); max-width: 700px;
}
.panel h3 { font-size: 1.1rem; color: #8B4513; margin-bottom: 24px; padding-bottom: 12px; border-bottom: 1px solid #f0e8df; }
.field-row { margin-bottom: 20px; }
.field-row label { display: block; font-size: .8rem; font-weight: 700; color: #555; margin-bottom: 6px; letter-spacing: .5px; text-transform: uppercase; }
.field-row input, .field-row textarea {
  width: 100%; padding: 11px 14px; border: 1.5px solid #e0e0e0;
  border-radius: 10px; font-size: .95rem; outline: none;
  font-family: inherit; resize: vertical; transition: border-color .2s;
}
.field-row input:focus, .field-row textarea:focus { border-color: #8B4513; }

/* BG PICKER */
.bg-options { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.bg-opt {
  width: 56px; height: 40px; border-radius: 8px; cursor: pointer;
  border: 3px solid transparent; transition: border-color .2s, transform .2s;
}
.bg-opt:hover { transform: scale(1.05); }
.bg-opt.selected { border-color: #fff; box-shadow: 0 0 0 2px #8B4513; }

/* COLOR PICKER */
.color-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.color-row { display: flex; gap: 10px; align-items: center; }
.color-row input[type="color"] { width: 48px; height: 40px; border: none; border-radius: 8px; cursor: pointer; padding: 2px; }
.color-row input[type="text"] { flex: 1; }

.btn-save {
  padding: 12px 28px; background: #8B4513; color: #fff;
  border: none; border-radius: 10px; font-size: .95rem; font-weight: 700;
  cursor: pointer; transition: background .2s; margin-top: 8px;
}
.btn-save:hover { background: #D2691E; }

.divider { border: none; border-top: 1px solid #f0e8df; margin: 28px 0; }
.danger-zone { background: #fff5f5; border: 1px solid #fed7d7; border-radius: 12px; padding: 20px; }
.danger-zone h4 { color: #c53030; margin-bottom: 6px; }
.danger-zone p { font-size: .85rem; color: #888; margin-bottom: 14px; }
.btn-danger {
  padding: 10px 22px; background: #e53e3e; color: #fff;
  border: none; border-radius: 8px; font-weight: 700; cursor: pointer;
}
.btn-danger:hover { background: #c53030; }

/* TYPO ROWS */
.panel-hint { font-size: .85rem; color: #888; margin-bottom: 24px; }
.typo-row {
  display: grid; grid-template-columns: 160px 1fr 1fr 1fr auto;
  align-items: start; gap: 14px;
  padding: 14px 0; border-bottom: 1px solid #f0e8df;
}
.typo-row:last-child { border-bottom: none; }
.typo-label { font-size: .82rem; font-weight: 700; color: #444; }
.typo-control { display: flex; flex-direction: column; gap: 4px; }
.typo-control label { font-size: .72rem; color: #888; font-weight: 600; letter-spacing: .5px; text-transform: uppercase; }
.typo-control select, .typo-control input[type="text"] {
  padding: 8px 10px; border: 1.5px solid #e0e0e0; border-radius: 8px;
  font-size: .88rem; outline: none;
}
.typo-control select:focus, .typo-control input:focus { border-color: #8B4513; }
.align-btns { display: flex; gap: 4px; }
.align-btn {
  width: 34px; height: 34px; border: 1.5px solid #e0e0e0; border-radius: 6px;
  background: #fff; cursor: pointer; font-size: .95rem; transition: all .15s;
  display: flex; align-items: center; justify-content: center;
}
.align-btn.active, .align-btn:hover { background: #8B4513; color: #fff; border-color: #8B4513; }
/* ── Background color picker ── */
.bg-inline {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}

/* Tombol toggle bulat — klik untuk buka/tutup picker */
.bg-pick-toggle {
  width: 32px; height: 32px; border-radius: 6px; border: 1.5px solid #ddd;
  padding: 2px; cursor: pointer; background: #fff; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .15s;
}
.bg-pick-toggle:hover { border-color: #8B4513; }

/* Dot warna di dalam toggle */
.color-dot {
  display: block; width: 20px; height: 20px; border-radius: 4px; flex-shrink: 0;
}

/* Checkerboard = transparan */
.checker {
  display: inline-block; width: 20px; height: 20px; border-radius: 4px; flex-shrink: 0;
  background-image:
    linear-gradient(45deg,#bbb 25%,transparent 25%),
    linear-gradient(-45deg,#bbb 25%,transparent 25%),
    linear-gradient(45deg,transparent 75%,#bbb 75%),
    linear-gradient(-45deg,transparent 75%,#bbb 75%);
  background-size: 8px 8px;
  background-position: 0 0, 0 4px, 4px -4px, -4px 0;
  background-color: #fff;
}

/* Color input kecil */
.bg-color-swatch {
  width: 32px; height: 32px; border: 1.5px solid #ddd; border-radius: 6px;
  cursor: pointer; padding: 2px; flex-shrink: 0;
}
.bg-text-input {
  width: 88px; padding: 6px 8px; border: 1.5px solid #e0e0e0; border-radius: 6px;
  font-size: .8rem; outline: none;
}
.bg-text-input:focus { border-color: #8B4513; }

/* Tombol transparan (muncul menggantikan picker saat transparan aktif) */
.bg-transparent-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border: 1.5px solid #ddd; border-radius: 6px;
  background: #fafafa; cursor: pointer; font-size: .78rem; font-weight: 600; color: #777;
  transition: all .15s; white-space: nowrap;
}
.bg-transparent-btn:hover  { border-color: #8B4513; color: #8B4513; }
.bg-transparent-btn.active { border-color: #8B4513; color: #8B4513; background: #fff5ed; }

.btn-typo-default {
  padding: 7px 12px; background: #f5f5f5; color: #666;
  border: 1px solid #ddd; border-radius: 6px; font-size: .78rem;
  font-weight: 600; cursor: pointer; white-space: nowrap; margin-top: 22px;
}
.btn-typo-default:hover { background: #ffe8d6; color: #8B4513; border-color: #8B4513; }

/* Section divider in panel */
.section-divider {
  font-size: .75rem; font-weight: 700; letter-spacing: 2px; text-transform: uppercase;
  color: #8B4513; padding: 12px 0 6px; border-top: 1px solid #f0e8df; margin-top: 8px;
}

/* btn row */
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; }
.btn-default {
  padding: 12px 22px; background: #f5f5f5; color: #555;
  border: 1px solid #ddd; border-radius: 10px; font-size: .9rem;
  font-weight: 600; cursor: pointer; transition: all .2s;
}
.btn-default:hover { background: #ffe8d6; color: #8B4513; border-color: #8B4513; }
.btn-preview-save {
  padding: 12px 22px; background: #2d6a4f; color: #fff;
  border: none; border-radius: 10px; font-size: .9rem;
  font-weight: 600; cursor: pointer; transition: background .2s;
}
.btn-preview-save:hover { background: #1b4332; }

/* RESPONSIVE */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-240px); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .color-grid { grid-template-columns: 1fr; }
  .typo-row { grid-template-columns: 1fr 1fr; }
  .typo-label { grid-column: 1/-1; }
  .btn-typo-default { margin-top: 0; grid-column: 1/-1; }
}
