/* Mobile-first, CSS variables untuk tema dinamis */

:root {
  --primary: #0d6efd;
  --accent: #198754;
  --bg: #f8f9fa;
  --text: #212529;
  --card-bg: #ffffff;
  --border: #dee2e6;
  --sidebar-width: 260px;
  --bottom-nav-height: 64px;
  --header-height: 56px;
  --radius: 10px;
  --shadow: 0 2px 8px rgba(0,0,0,.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; }

/* ========== UTILITY ========== */
.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .1s;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}
.btn-danger { background: #dc3545; color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.btn-block { width: 100%; }

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 0.9rem;
}
.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  background: #fff;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent);
}

.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.95rem;
}
.alert-success { background: #d1e7dd; color: #0f5132; }
.alert-error { background: #f8d7da; color: #842029; }
.alert-info { background: #cff4fc; color: #055160; }

.table-responsive { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
th { background: #f1f3f5; font-weight: 600; }
tr:hover td { background: #f8f9fa; }

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-primary { background: color-mix(in srgb, var(--primary) 20%, white); color: var(--primary); }

/* ========== PUBLIC LAYOUT ========== */
.public-header {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}
.public-header .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.public-header .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
}
.public-header .brand img { height: 36px; width: auto; }

.public-hero {
  padding: 48px 0 32px;
  text-align: center;
}
.public-hero h1 {
  font-size: 1.9rem;
  margin-bottom: 12px;
  color: var(--text);
}
.public-hero p {
  font-size: 1.05rem;
  color: #495057;
  max-width: 560px;
  margin: 0 auto 24px;
}

.section { padding: 32px 0; }
.section h2 {
  font-size: 1.4rem;
  margin-bottom: 16px;
  text-align: center;
}
.feature-list {
  display: grid;
  gap: 12px;
  max-width: 500px;
  margin: 0 auto;
}
.feature-item {
  background: var(--card-bg);
  padding: 14px 18px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.feature-item::before {
  content: "✓";
  color: var(--accent);
  font-weight: 700;
  flex-shrink: 0;
}

/* Footer sticky */
.public-footer {
  background: #212529;
  color: #adb5bd;
  text-align: center;
  padding: 16px;
  font-size: 0.85rem;
  position: sticky;
  bottom: 0;
  width: 100%;
  z-index: 50;
}

/* ========== APP LAYOUT (sidebar + bottom nav) ========== */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* Sidebar — hanya desktop */
.app-sidebar {
  display: none;
  width: var(--sidebar-width);
  background: #1e293b;
  color: #e2e8f0;
  flex-shrink: 0;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 200;
}
.app-sidebar .brand {
  padding: 20px 16px;
  font-weight: 700;
  font-size: 1.1rem;
  border-bottom: 1px solid #334155;
  display: flex;
  align-items: center;
  gap: 10px;
}
.app-sidebar .brand img { height: 32px; }
.app-sidebar nav { flex: 1; padding: 12px 0; }
.app-sidebar a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  color: #94a3b8;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.app-sidebar a:hover,
.app-sidebar a.active {
  background: #334155;
  color: #fff;
  text-decoration: none;
}
.app-sidebar .logout {
  border-top: 1px solid #334155;
  padding: 12px 0;
}

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-bottom: var(--bottom-nav-height); /* ruang bottom nav di mobile */
}

.app-topbar {
  height: var(--header-height);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.app-topbar .title { font-weight: 700; font-size: 1.05rem; }
.app-content {
  flex: 1;
  padding: 16px;
  max-width: 1000px;
  width: 100%;
  margin: 0 auto;
}

/* Bottom navigation — hanya mobile/tablet */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 150;
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 0.7rem;
  color: #64748b;
  font-weight: 500;
  padding: 6px 8px;
  min-width: 60px;
}
.bottom-nav a.active {
  color: var(--primary);
}
.bottom-nav a span.icon {
  font-size: 1.35rem;
  line-height: 1;
}

/* ========== ADMIN LAYOUT ========== */
.admin-wrapper { min-height: 100vh; background: #f1f5f9; }
.admin-header {
  background: #0f172a;
  color: #fff;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.admin-header a { color: #94a3b8; }
.admin-header a:hover { color: #fff; }
.admin-content { padding: 24px 16px; max-width: 1100px; margin: 0 auto; }

/* Color picker row */
.color-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.color-row .form-group { flex: 1; min-width: 140px; }

/* ========== RESPONSIVE ========== */
@media (min-width: 768px) {
  .app-sidebar { display: flex; }
  .app-main { margin-left: var(--sidebar-width); padding-bottom: 0; }
  .bottom-nav { display: none; }
  .public-hero h1 { font-size: 2.4rem; }
  .app-content { padding: 24px; }
}

@media (min-width: 1024px) {
  .feature-list { grid-template-columns: 1fr 1fr; max-width: 700px; }
}

/* Print rapor */
@media print {
  .app-sidebar, .app-topbar, .bottom-nav, .no-print { display: none !important; }
  .app-main { margin: 0; padding: 0; }
  .app-content { padding: 0; max-width: 100%; }
  body { background: #fff; }
}
