:root {
  color-scheme: light only;
}

html, body {
  background: #fff !important;
  color: #333 !important;
}

@media (prefers-color-scheme: dark) {
  html, body {
    background: #fff !important;
    color: #333 !important;
  }
}

* { box-sizing: border-box; }
body { font-family: Arial, sans-serif; margin: 0; background: #fff8f0; color: #333; padding-bottom: 20px; }
body.user { padding-top: 235px; }
body.admin { padding-top: 20px; }

.container { max-width: 500px; margin: auto; padding: 16px; }

/* HEADER INDEX.PHP */
.header-wrap { position: fixed; top: 0; left: 0; right: 0; z-index: 998; background: linear-gradient(135deg, #d9480f 0%, #f97316 100%); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.top-bar { background: rgba(0,0,0,0.15); color: #fff; padding: 6px 16px; font-size: 0.75rem; text-align: center; display: flex; justify-content: center; align-items: center; gap: 8px; height: 28px; }
.header-main { padding: 12px 16px; text-align: center; color: white; height: 82px; }
.header-main h1 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -0.5px; text-shadow: 0 2px 4px rgba(0,0,0,0.2); }
.header-main.tagline { margin: 4px 0 0; font-size: 12px; opacity: 0.95; font-weight: 500; }
.marquee { background: #fff3e0; color: #d9480f; padding: 8px 0; font-size: 0.8rem; font-weight: 600; overflow: hidden; white-space: nowrap; border-top: 2px solid #fed7aa; border-bottom: 2px solid #fed7aa; height: 40px; margin-top: 20px; }
.marquee span { display: inline-block; padding-left: 100%; animation: marquee 15s linear infinite; }
@keyframes marquee { 0% { transform: translate(0, 0); } 100% { transform: translate(-100%, 0); } }

/* CARD UMUM */
.card { background: white; border-radius: 12px; padding: 12px; margin-bottom: 16px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.card h3 { margin: 0 0 12px 0; color: #d9480f; font-size: 18px; display: flex; justify-content: space-between; align-items: center; }

/* ITEM MENU INDEX.PHP */
.item { display: flex; gap: 10px; margin: 12px 0; align-items: center; }
.item-img { width: 70px; height: 70px; border-radius: 8px; object-fit: cover; flex-shrink: 0; background: #f0f0f0; }
.item-body { flex: 1; min-width: 0; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.item-info { flex: 1; min-width: 0; }
.item-info label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 2px; line-height: 1.3; }
.item-info.harga { color: #666; font-size: 0.8em; }
.min-info { font-size: 0.75em; color: #f97316; margin-top: 3px; font-weight: 600; font-style: italic; display: block; }
.item.habis { opacity: 0.6; }
.item.habis.item-info label { text-decoration: line-through; color: #999; }
.item.habis.qty button { background: #e5e5e5; color: #999; cursor: not-allowed; }
.habis-badge { background: #dc2626; color: white; font-size: 0.65rem; padding: 2px 5px; border-radius: 4px; display: inline-block; margin-left: 4px; }

/* QTY BUTTON INDEX.PHP */
.qty { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.qty button { width: 30px; height: 30px; border-radius: 8px; border: 1px solid #ddd; background: #f7f7f7; font-size: 18px; cursor: pointer; }
.qty button:disabled { background: #e5e5e5; color: #999; cursor: not-allowed; }
.qty span { min-width: 20px; text-align: center; font-weight: bold; font-size: 0.9rem; }

/* FORM INPUT */
select, input[type="text"], input[type="number"], input[type="file"] { width: 100%; padding: 10px; margin: 6px 0; border: 1px solid #ddd; border-radius: 8px; font-size: 16px; }
.row { display: flex; gap: 8px; }
.row > div { flex: 1; }
label { display: block; margin-top: 8px; font-weight: 600; font-size: 14px; }

/* TOTAL INDEX.PHP */
.total-wrap { font-size: 0.95em; text-align: right; margin: 6px 0; }
.total { font-size: 1.4em; font-weight: bold; text-align: right; margin: 12px 0; color: #d9480f; }
.subtotal-asli { font-size: 0.8em; color: #999; text-decoration: line-through; }

/* BUTTON INDEX.PHP */
button.pesan { width: 100%; background: #25D366; color: white; border: none; padding: 16px; font-size: 1.1em; border-radius: 10px; cursor: pointer; margin-top: 8px; font-weight: bold; }
button.gps { width: 100%; background: #3b82f6; color: white; border: none; padding: 12px; font-size: 0.95em; border-radius: 8px; cursor: pointer; }
button.share-lokasi { width: 100%; background: #f59e0b; color: white; border: none; padding: 12px; font-size: 0.95em; border-radius: 8px; cursor: pointer; margin-top: 8px; }
button.gps:hover { background: #2563eb; }
button.share-lokasi:hover { background: #d97706; }
button.pesan:hover { background: #1da851; }

.note { font-size: 0.8em; color: #888; margin-top: 8px; text-align: center; }
.ongkir-info { background: #fff3e0; padding: 10px; border-radius: 8px; font-size: 0.85em; margin-top: 8px; line-height: 1.4; }
#statusGPS { font-size: 0.8em; color: #16a34a; margin-top: 4px; text-align: center; }

/* CART FLOATING INDEX.PHP */
.cart { position: fixed; top: 170px; left: 0; right: 0; background: #16a34a; color: white; padding: 12px 16px; box-shadow: 0 2px 10px rgba(0,0,0,0.2); transform: translateY(-100%); transition: 0.3s ease; max-width: 500px; margin: 0 auto; z-index: 997; border-radius: 0 0 16px 16px; height: 65px; }
.cart.show { transform: translateY(0); }
.cart-top { display: flex; justify-content: space-between; margin-bottom: 6px; font-weight: 700; font-size: 1.1rem; }
.cart-items { font-size: 0.85rem; color: #d1fae5; max-height: 50px; overflow-y: auto; }
.cart-items::-webkit-scrollbar { width: 3px; }
.cart-items::-webkit-scrollbar-thumb { background: #fff; border-radius: 3px; }

/* ADMIN.PHP KHUSUS */
h1.admin-title { text-align: center; color: #d9480f; margin-bottom: 20px; margin-top: 10px; padding: 15px; background: white; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.btn-primary { background: #d9480f; color: white; padding: 10px 16px; border: none; border-radius: 8px; cursor: pointer; font-weight: bold; font-size: 14px; text-decoration: none; display: inline-block; }
.btn-danger { background: #dc2626; color: white; padding: 10px 16px; border: none; border-radius: 8px; cursor: pointer; font-weight: bold; font-size: 14px; text-decoration: none; display: inline-block; }
.btn-success { background: #16a34a; color: white; padding: 10px 16px; border: none; border-radius: 8px; cursor: pointer; font-weight: bold; font-size: 14px; text-decoration: none; display: inline-block; }
.btn-updown { background: #3b82f6; color: white; font-size: 14px; padding: 4px 8px; margin: 0 2px; border: none; border-radius: 6px; cursor: pointer; text-decoration: none; display: inline-block; }
.btn-updown:disabled { background: #e5e5e5; color: #999; cursor: not-allowed; }

table { width: 100%; border-collapse: collapse; margin-top: 12px; }
th, td { padding: 10px; text-align: left; border-bottom: 1px solid #eee; font-size: 14px; vertical-align: middle; }
th { background: #fff3e0; color: #d9480f; }
/* FIX RP RA KEPECAH */
td:nth-child(3) { white-space: nowrap; }

.img-preview { width: 50px; height: 50px; object-fit: cover; border-radius: 6px; }
.badge-habis { background: #dc2626; color: white; font-size: 11px; padding: 2px 6px; border-radius: 4px; }
.actions { display: flex; gap: 4px; align-items: center; }

.modal { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 999; align-items: center; justify-content: center; }
.modal.show { display: flex; }
.modal-content { background: white; padding: 20px; border-radius: 12px; max-width: 500px; width: 90%; max-height: 90vh; overflow-y: auto; }
.checkbox-wrap { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.checkbox-wrap input { width: auto; margin: 0; }
.danger-zone { background: #fef2f2; border: 2px solid #fecaca; padding: 12px; border-radius: 8px; margin-top: 16px; }
.danger-zone h4 { margin: 0 0 8px 0; color: #dc2626; font-size: 14px; }
.empty-info { text-align: center; padding: 20px; color: #999; font-style: italic; }
.jarak-manual-wrap {
  margin: 12px 0;
  text-align: center;
}
.jarak-manual-wrap a {
  color: #2563eb;
  font-size: 14px;
  text-decoration: underline;
  cursor: pointer;
}
.jarak-manual-wrap a:hover {
  color: #1d4ed8;
}


/* STICKY DATA PENGIRIMAN DESKTOP */
@media(min-width:1024px){
  .container{
    position:relative;
  }
  /* Card Data Pengiriman = card ke-2 dari bawah, soale total-wrap ada 4 + button + note */
  .container > .card:nth-last-of-type(2){
    position:sticky;
    top:100px;
    align-self:flex-start;
  }
}