/* =========================================================
   MONDE STOCK - Main Stylesheet
   Tema: Dark Chocolate & Gold — PT Monde Mahkota Biskuit
   ========================================================= */

:root {
  --gold: #d9a441;
  --gold-light: #f0c674;
  --gold-dark: #a97b1f;
  --brown-900: #1b1210;
  --brown-800: #241713;
  --brown-700: #2e1c17;
  --brown-600: #3c261e;
  --brown-500: #4a3128;
  --cream: #f5ead9;
  --text-muted: #c9b8a8;
  --danger: #e5534b;
  --success: #3fb37f;
  --warning: #e0a72e;
  --info: #4aa8d8;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --sidebar-w: 260px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Segoe UI', 'Poppins', system-ui, -apple-system, sans-serif;
  color: var(--cream);
  background:
    radial-gradient(circle at 15% 15%, rgba(217,164,65,.10), transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(217,164,65,.08), transparent 45%),
    linear-gradient(160deg, var(--brown-900) 0%, #150d0b 100%);
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--gold-dark); border-radius: 10px; }
::-webkit-scrollbar-track { background: transparent; }

/* =============== LAYOUT =============== */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--brown-800), var(--brown-900) 85%);
  border-right: 1px solid rgba(217,164,65,.18);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 40;
  transition: transform .25s ease;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px;
  border-bottom: 1px solid rgba(217,164,65,.15);
}
.sidebar-brand .crest {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--gold-light), var(--gold-dark));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: var(--brown-900); font-size: 18px;
  box-shadow: 0 0 0 3px rgba(217,164,65,.15);
}
.sidebar-brand .txt small { display:block; font-size: 10.5px; letter-spacing: .12em; color: var(--text-muted); }
.sidebar-brand .txt strong { display:block; font-size: 15px; color: var(--gold-light); letter-spacing:.03em; }

.sidebar-nav { padding: 16px 12px; overflow-y: auto; flex: 1; }
.nav-section-title {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em;
  color: var(--text-muted); padding: 14px 12px 6px;
}
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; margin: 2px 0;
  border-radius: 10px; color: var(--text-muted);
  font-size: 14px; font-weight: 500;
  transition: all .15s ease;
  position: relative;
}
.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .85; }
.nav-link:hover { background: rgba(217,164,65,.10); color: var(--cream); }
.nav-link.active {
  background: linear-gradient(90deg, rgba(217,164,65,.22), rgba(217,164,65,.05));
  color: var(--gold-light);
  box-shadow: inset 3px 0 0 var(--gold);
}
.sidebar-foot {
  padding: 16px 20px; border-top: 1px solid rgba(217,164,65,.15);
  font-size: 12.5px; color: var(--text-muted);
}
.sidebar-foot b { color: var(--gold-light); }

.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  display: flex; flex-direction: column;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px;
  background: rgba(36,23,19,.6);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(217,164,65,.15);
  position: sticky; top: 0; z-index: 30;
}
.topbar .page-title { font-size: 20px; font-weight: 700; color: var(--gold-light); }
.topbar .page-sub { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-date { font-size: 13px; color: var(--gold-light); text-align: right; }
.topbar-date small { display:block; color: var(--text-muted); font-size: 11px; }
.menu-toggle { display: none; background: none; border: none; color: var(--gold-light); font-size: 22px; cursor: pointer; }

.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px 6px 6px; border-radius: 30px;
  background: rgba(217,164,65,.10); border: 1px solid rgba(217,164,65,.2);
  cursor: pointer; position: relative;
}
.user-chip .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-light), var(--gold-dark));
  display: flex; align-items: center; justify-content: center;
  color: var(--brown-900); font-weight: 700; font-size: 13px;
}
.user-chip .name { font-size: 13px; font-weight: 600; }
.user-chip .role { font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; }
.user-dropdown {
  position: absolute; top: 46px; right: 0; min-width: 170px;
  background: var(--brown-700); border: 1px solid rgba(217,164,65,.2);
  border-radius: 10px; box-shadow: var(--shadow); overflow: hidden; display: none; z-index: 50;
}
.user-dropdown.show { display: block; }
.user-dropdown a { display: block; padding: 11px 16px; font-size: 13.5px; color: var(--cream); }
.user-dropdown a:hover { background: rgba(217,164,65,.12); }

.content { padding: 26px 28px 50px; flex: 1; }

/* =============== CARDS =============== */
.card {
  background: linear-gradient(160deg, var(--brown-700), var(--brown-800));
  border: 1px solid rgba(217,164,65,.14);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-body { padding: 22px; }
.card-header {
  padding: 18px 22px; border-bottom: 1px solid rgba(217,164,65,.12);
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
}
.card-header h3 { margin: 0; font-size: 16px; color: var(--gold-light); }
.card-header .sub { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

/* =============== STAT CARDS =============== */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 22px; }
@media (max-width: 1100px) { .stat-grid { grid-template-columns: repeat(2, 1fr);} }
@media (max-width: 620px) { .stat-grid { grid-template-columns: 1fr;} }

.stat-card {
  background: linear-gradient(160deg, var(--brown-700), var(--brown-800));
  border: 1px solid rgba(217,164,65,.15);
  border-radius: var(--radius); padding: 20px; position: relative; overflow: hidden;
}
.stat-card::after {
  content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px;
  background: radial-gradient(circle, rgba(217,164,65,.18), transparent 70%);
}
.stat-card .icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; margin-bottom: 14px;
  background: rgba(217,164,65,.14); color: var(--gold-light);
}
.stat-card .icon svg { width: 22px; height: 22px; }
.stat-card .value { font-size: 26px; font-weight: 800; color: var(--cream); }
.stat-card .label { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; }
.stat-card .trend { font-size: 11.5px; margin-top: 10px; display:inline-flex; align-items:center; gap:4px; padding: 3px 9px; border-radius: 20px; }
.trend.up { background: rgba(63,179,127,.15); color: var(--success); }
.trend.down { background: rgba(229,83,75,.15); color: var(--danger); }
.trend.flat { background: rgba(74,168,216,.15); color: var(--info); }

.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; }
@media (max-width: 1050px) { .grid-2 { grid-template-columns: 1fr; } }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 18px; }
@media (max-width: 900px) { .grid-3 { grid-template-columns: 1fr; } }

/* =============== BUTTONS =============== */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 10px; font-size: 13.5px; font-weight: 600;
  border: 1px solid transparent; cursor: pointer; transition: all .15s ease;
  line-height: 1.2;
}
.btn svg { width: 15px; height: 15px; }
.btn-gold { background: linear-gradient(135deg, var(--gold-light), var(--gold-dark)); color: var(--brown-900); }
.btn-gold:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-outline { background: transparent; border-color: rgba(217,164,65,.4); color: var(--gold-light); }
.btn-outline:hover { background: rgba(217,164,65,.1); }
.btn-ghost { background: rgba(255,255,255,.04); color: var(--cream); border-color: rgba(255,255,255,.08); }
.btn-ghost:hover { background: rgba(255,255,255,.08); }
.btn-danger { background: rgba(229,83,75,.15); color: #ff8a83; border-color: rgba(229,83,75,.3); }
.btn-danger:hover { background: rgba(229,83,75,.28); }
.btn-success { background: rgba(63,179,127,.15); color: #7ee0b1; border-color: rgba(63,179,127,.3); }
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 8px; }
.btn-block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.btn-icon {
  width: 34px; height: 34px; padding: 0; justify-content: center; border-radius: 9px;
}

/* =============== FORMS =============== */
label { font-size: 12.5px; font-weight: 600; color: var(--text-muted); display: block; margin-bottom: 6px; }
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 620px) { .form-row { grid-template-columns: 1fr; } }
@media (max-width: 700px) {
  .masuk-row { grid-template-columns: 1fr !important; }
}

/* =============== GROUP HEADER (tabel maintenance / peminjaman) =============== */
.group-header td {
  background: rgba(217,164,65,.08);
  color: var(--gold-light);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 9px 14px;
}

input[type=text], input[type=number], input[type=date], input[type=datetime-local],
input[type=password], input[type=email], input[type=file], select, textarea {
  width: 100%; padding: 11px 13px; border-radius: 10px;
  background: rgba(0,0,0,.22); border: 1px solid rgba(217,164,65,.22);
  color: var(--cream); font-size: 13.5px; font-family: inherit;
  outline: none; transition: border .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); }
textarea { resize: vertical; min-height: 80px; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23d9a441' stroke-width='2' fill='none'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 34px; }
input[type=file] { padding: 8px; }
.checkbox-row { display: flex; align-items: center; gap: 20px; }
.checkbox-row label { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--cream); margin: 0; }
.checkbox-row input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--gold); }
.form-hint { font-size: 11.5px; color: var(--text-muted); margin-top: 5px; }

/* =============== TABLES =============== */
.table-wrap { overflow-x: auto; border-radius: 12px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 700px; }
table.tbl thead th {
  text-align: left; padding: 12px 14px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--gold-light); background: rgba(217,164,65,.08); white-space: nowrap;
  border-bottom: 1px solid rgba(217,164,65,.18); position: sticky; top: 0;
}
table.tbl tbody td { padding: 12px 14px; border-bottom: 1px solid rgba(255,255,255,.05); vertical-align: middle; color: var(--cream); }
table.tbl tbody tr:hover { background: rgba(217,164,65,.05); }
table.tbl tbody tr:last-child td { border-bottom: none; }
.tbl-thumb { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; background: rgba(255,255,255,.06); cursor: zoom-in; transition: box-shadow .15s ease; }
.tbl-thumb:hover { box-shadow: 0 0 0 2px var(--gold); }

/* =============== IMAGE HOVER ZOOM PREVIEW =============== */
.img-zoom-preview {
  position: fixed;
  z-index: 200;
  display: none;
  padding: 6px;
  background: var(--brown-800);
  border: 1px solid rgba(217,164,65,.35);
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0,0,0,.55);
  pointer-events: none;
}
.img-zoom-preview.show { display: block; }
.img-zoom-preview img {
  display: block;
  width: 240px;
  height: 240px;
  object-fit: contain;
  border-radius: 8px;
  background: rgba(255,255,255,.04);
}
@media (max-width: 700px) {
  .img-zoom-preview { display: none !important; }
}
.tbl-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mono { font-family: 'Consolas', monospace; font-size: 12.5px; }

.table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; flex-wrap: wrap; }
.table-toolbar .left { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.search-box { position: relative; }
.search-box input { padding-left: 36px; min-width: 230px; }
.search-box svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text-muted); }

.badge { display: inline-block; padding: 4px 11px; border-radius: 20px; font-size: 11px; font-weight: 700; letter-spacing: .02em; }
.badge-gold { background: rgba(217,164,65,.18); color: var(--gold-light); }
.badge-info { background: rgba(74,168,216,.16); color: #7cc4ea; }
.badge-success { background: rgba(63,179,127,.16); color: #7ee0b1; }
.badge-warning { background: rgba(224,167,46,.18); color: #f0c369; }
.badge-danger { background: rgba(229,83,75,.16); color: #ff8a83; }

.pagination { display: flex; gap: 6px; padding: 16px 20px; justify-content: flex-end; flex-wrap: wrap; }
.pagination a, .pagination span {
  padding: 7px 12px; border-radius: 8px; font-size: 12.5px; background: rgba(255,255,255,.04); color: var(--cream);
  border: 1px solid rgba(217,164,65,.12);
}
.pagination a:hover { background: rgba(217,164,65,.15); }
.pagination .current { background: var(--gold); color: var(--brown-900); font-weight: 700; }

/* =============== MODAL =============== */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(10,6,5,.65); backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal-backdrop.show { display: flex; }
.modal {
  background: linear-gradient(160deg, var(--brown-700), var(--brown-800));
  border: 1px solid rgba(217,164,65,.22); border-radius: 16px;
  width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 30px 70px rgba(0,0,0,.6);
  animation: pop .18s ease;
}
.modal.modal-lg { max-width: 780px; }
@keyframes pop { from { transform: scale(.95); opacity:0;} to { transform: scale(1); opacity:1;} }
.modal-header { padding: 20px 24px; border-bottom: 1px solid rgba(217,164,65,.15); display:flex; align-items:center; justify-content:space-between; }
.modal-header h3 { margin: 0; font-size: 17px; color: var(--gold-light); }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 22px; cursor: pointer; line-height: 1;}
.modal-close:hover { color: var(--cream); }
.modal-body { padding: 22px 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid rgba(217,164,65,.12); display: flex; justify-content: flex-end; gap: 10px; }

/* =============== ALERT / FLASH =============== */
.alert { padding: 14px 18px; border-radius: 12px; font-size: 13.5px; margin-bottom: 18px; display: flex; align-items: center; gap: 10px; border: 1px solid transparent; }
.alert-success { background: rgba(63,179,127,.13); border-color: rgba(63,179,127,.3); color: #9be7c4; }
.alert-danger { background: rgba(229,83,75,.13); border-color: rgba(229,83,75,.3); color: #ffa39d; }
.alert-info { background: rgba(74,168,216,.13); border-color: rgba(74,168,216,.3); color: #9cd4f0; }

/* =============== LOGIN PAGE =============== */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(circle at 20% 20%, rgba(217,164,65,.15), transparent 45%),
    radial-gradient(circle at 80% 80%, rgba(217,164,65,.12), transparent 45%),
    linear-gradient(160deg, #150d0b, var(--brown-900));
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 400px; background: linear-gradient(160deg, var(--brown-700), var(--brown-800));
  border: 1px solid rgba(217,164,65,.2); border-radius: 20px; box-shadow: var(--shadow); padding: 40px 34px;
}
.login-crest {
  width: 68px; height: 68px; margin: 0 auto 16px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--gold-light), var(--gold-dark));
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 26px; color: var(--brown-900);
  box-shadow: 0 0 0 6px rgba(217,164,65,.12);
}
.login-title { text-align: center; font-size: 20px; font-weight: 700; color: var(--gold-light); margin: 4px 0 2px; }
.login-sub { text-align: center; font-size: 12.5px; color: var(--text-muted); margin-bottom: 26px; }

/* =============== DASHBOARD WIDGETS =============== */
.activity-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,.05); }
.activity-item:last-child { border-bottom: none; }
.activity-dot { width: 34px; height: 34px; border-radius: 10px; flex-shrink:0; display:flex; align-items:center; justify-content:center; }
.activity-dot svg { width: 16px; height: 16px; }
.activity-item .txt { font-size: 13px; }
.activity-item .txt b { color: var(--cream); }
.activity-item .time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.progress-bar { width: 100%; height: 8px; border-radius: 20px; background: rgba(255,255,255,.06); overflow: hidden; }
.progress-bar span { display: block; height: 100%; border-radius: 20px; background: linear-gradient(90deg, var(--gold), var(--gold-light)); }

/* =============== MISC =============== */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state svg { width: 54px; height: 54px; margin-bottom: 14px; opacity: .5; }
.chip { display:inline-flex; align-items:center; gap:6px; padding: 5px 12px; border-radius: 20px; background: rgba(217,164,65,.1); border:1px solid rgba(217,164,65,.2); font-size: 12px; color: var(--gold-light); }
.divider { height: 1px; background: rgba(217,164,65,.12); margin: 18px 0; }
.qr-box { background: #fff; padding: 14px; border-radius: 10px; display: inline-block; }
.tag-filter { display:flex; gap:8px; flex-wrap:wrap; }
.tag-filter a { padding: 7px 14px; border-radius: 20px; font-size: 12.5px; border: 1px solid rgba(217,164,65,.2); color: var(--text-muted); }
.tag-filter a.active { background: var(--gold); color: var(--brown-900); font-weight: 700; border-color: var(--gold); }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-toggle { display: block; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* =============== PRINT =============== */
@media print {
  .no-print { display: none !important; }
  body { background: #fff !important; color: #000 !important; }
}
