/* =====================================================================
   SIPERPUS - Perpustakaan SMKN 1 Jiwan
   ===================================================================== */

:root {
  --brand:        #14532d;
  --brand-600:    #166534;
  --brand-500:    #22803c;
  --brand-100:    #dcfce7;
  --accent:       #f59e0b;
  --ink:          #16211c;
  --muted:        #6b7c74;
  --line:         #e3e9e6;
  --bg:           #f4f7f5;
  --card:         #ffffff;
  --blue:         #1d4ed8;
  --red:          #b42318;
  --green:        #067647;
  --radius:       12px;
  --shadow:       0 1px 2px rgba(16,24,40,.06), 0 8px 24px rgba(16,24,40,.06);
  --sidebar-w:    252px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: "Segoe UI", Inter, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

h1,h2,h3,h4 { margin: 0 0 .5rem; line-height: 1.25; font-weight: 650; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p  { line-height: 1.6; }

/* ------------------------- Layout ------------------------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: linear-gradient(180deg, var(--brand) 0%, #0e3d22 100%);
  color: #e8f5ec;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.sidebar-brand .logo {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--accent); color: #3b2500;
  display: grid; place-items: center;
  font-weight: 800; font-size: 17px; flex: 0 0 40px;
}
.sidebar-brand b   { display: block; font-size: 15px; letter-spacing: .3px; color: #fff; }
.sidebar-brand span{ display: block; font-size: 11.5px; color: #a7d3b6; }

.nav { padding: 12px 10px; flex: 1; }
.nav-label {
  font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase;
  color: #7fb695; margin: 14px 10px 6px; font-weight: 700;
}
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; margin-bottom: 2px;
  border-radius: 9px; color: #d7ece0; font-size: 14px;
  text-decoration: none; transition: background .15s, color .15s;
}
.nav a:hover  { background: rgba(255,255,255,.09); color: #fff; text-decoration: none; }
.nav a.active { background: rgba(255,255,255,.16); color: #fff; font-weight: 600; }
.nav a .ic    { width: 18px; text-align: center; opacity: .95; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: #fff; border-bottom: 1px solid var(--line);
  padding: 12px 24px; display: flex; align-items: center; gap: 16px;
  position: sticky; top: 0; z-index: 20;
}
.topbar .page-title { font-weight: 650; font-size: 16px; }
.topbar .spacer { flex: 1; }
.topbar .user {
  display: flex; align-items: center; gap: 9px;
  font-size: 13.5px; color: var(--muted);
}
.topbar .user .av {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand-100); color: var(--brand);
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
}

.content { padding: 22px 24px 40px; flex: 1; }
.page-head {
  display: flex; align-items: flex-start; gap: 14px;
  flex-wrap: wrap; margin-bottom: 18px;
}
.page-head .sub { color: var(--muted); font-size: 13.5px; margin: 0; }
.page-head .spacer { flex: 1; }

/* ------------------------- Kartu ------------------------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.card-head {
  padding: 14px 18px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px;
}
.card-head h3 { margin: 0; font-size: 15px; }
.card-head .spacer { flex: 1; }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }

/* ------------------------- Statistik ------------------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 14px;
}
.stat .ico {
  width: 46px; height: 46px; border-radius: 12px; flex: 0 0 46px;
  display: grid; place-items: center; font-size: 21px;
}
.stat .num { font-size: 24px; font-weight: 700; line-height: 1.1; }
.stat .lbl { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.ico-green { background: #dcfce7; color: #166534; }
.ico-blue  { background: #dbeafe; color: #1d4ed8; }
.ico-amber { background: #fef3c7; color: #b45309; }
.ico-red   { background: #fee4e2; color: #b42318; }
.ico-violet{ background: #ede9fe; color: #6d28d9; }

/* ------------------------- Tabel ------------------------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th, table.tbl td { padding: 11px 14px; text-align: left; vertical-align: middle; }
table.tbl thead th {
  background: #f7faf8; border-bottom: 1px solid var(--line);
  font-size: 11.5px; letter-spacing: .05em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; white-space: nowrap;
}
table.tbl tbody tr { border-bottom: 1px solid #eef2f0; }
table.tbl tbody tr:last-child { border-bottom: none; }
table.tbl tbody tr:hover { background: #fafcfb; }
table.tbl td.num, table.tbl th.num { text-align: right; }
table.tbl td.ctr, table.tbl th.ctr { text-align: center; }
.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty .big { font-size: 34px; display: block; margin-bottom: 8px; opacity: .5; }

/* ------------------------- Tombol ------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: 9px; border: 1px solid transparent;
  font-size: 13.5px; font-weight: 600; cursor: pointer;
  background: var(--brand-600); color: #fff; text-decoration: none;
  transition: filter .15s, background .15s;
  font-family: inherit; line-height: 1.4;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; color: #fff; }
.btn-light  { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-light:hover { background: #f5f7f6; color: var(--ink); }
.btn-danger { background: var(--red); }
.btn-warn   { background: var(--accent); color: #402a03; }
.btn-warn:hover { color: #402a03; }
.btn-blue   { background: var(--blue); }
.btn-sm     { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn-block  { width: 100%; justify-content: center; }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }

/* ------------------------- Badge ------------------------- */
.badge {
  display: inline-block; padding: 3px 9px; border-radius: 20px;
  font-size: 11.5px; font-weight: 650; white-space: nowrap;
}
.badge-green { background: #dcfce7; color: #166534; }
.badge-blue  { background: #dbeafe; color: #1e40af; }
.badge-red   { background: #fee4e2; color: #b42318; }
.badge-amber { background: #fef3c7; color: #92400e; }
.badge-gray  { background: #eef2f0; color: #52645b; }

/* ------------------------- Form ------------------------- */
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block; font-size: 12.5px; font-weight: 650;
  margin-bottom: 5px; color: #3c4b44;
}
.form-group label .req { color: var(--red); }
.form-control {
  width: 100%; padding: 9px 12px; font-size: 14px; font-family: inherit;
  border: 1px solid #d5dedb; border-radius: 9px; background: #fff; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
  outline: none; border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(34,128,60,.13);
}
textarea.form-control { min-height: 92px; resize: vertical; }
select.form-control { appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' stroke='%236b7c74' stroke-width='1.6' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.form-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.form-actions { display: flex; gap: 10px; padding-top: 6px; flex-wrap: wrap; }

/* ------------------------- Alert ------------------------- */
.alert {
  padding: 12px 16px; border-radius: 10px; margin-bottom: 16px;
  font-size: 14px; border: 1px solid transparent;
  display: flex; gap: 10px; align-items: flex-start;
}
.alert-success { background: #ecfdf3; border-color: #abefc6; color: #05603a; }
.alert-danger  { background: #fef3f2; border-color: #fecdca; color: #912018; }
.alert-warning { background: #fffaeb; border-color: #fedf89; color: #93370d; }
.alert-info    { background: #eff8ff; border-color: #b2ddff; color: #175cd3; }

/* ------------------------- Filter bar ------------------------- */
.filter-bar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.filter-bar .form-control { width: auto; min-width: 170px; }
.filter-bar .grow { flex: 1; min-width: 200px; }

/* ------------------------- Paginasi ------------------------- */
.pagination { display: flex; gap: 5px; padding: 14px 18px; flex-wrap: wrap; align-items: center; }
.pagination a, .pagination span {
  padding: 6px 11px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 13px; color: var(--ink); background: #fff; text-decoration: none;
}
.pagination .active { background: var(--brand-600); color: #fff; border-color: var(--brand-600); }
.pagination .info { border: none; background: none; color: var(--muted); margin-right: auto; }

/* ------------------------- Banner mitra F15 ------------------------- */
.mitra-side { padding: 12px 14px 18px; }
.mitra-side a { display: block; border-radius: 11px; overflow: hidden;
  box-shadow: 0 4px 14px rgba(0,0,0,.25); transition: transform .18s, box-shadow .18s; }
.mitra-side a:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(0,0,0,.34); }
.mitra-side img { display: block; width: 100%; height: auto; }
.mitra-side .cap { font-size: 10.5px; color: #8fc4a5; text-align: center; margin-top: 7px; line-height: 1.4; }

.mitra-banner { display: block; margin-bottom: 18px; border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); transition: transform .18s, box-shadow .18s; }
.mitra-banner:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(16,24,40,.14); }
.mitra-banner img { display: block; width: 100%; height: auto; }

/* ------------------------- Login ------------------------- */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: linear-gradient(135deg, #0e3d22 0%, #14532d 45%, #1f7a45 100%);
}
.login-card {
  width: 100%; max-width: 420px; background: #fff;
  border-radius: 16px; box-shadow: 0 24px 60px rgba(0,0,0,.28); overflow: hidden;
}
.login-head { padding: 30px 30px 20px; text-align: center; }
.login-head .logo {
  width: 62px; height: 62px; margin: 0 auto 14px; border-radius: 16px;
  background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 28px;
}
.login-head h1 { font-size: 20px; margin-bottom: 4px; }
.login-head p  { margin: 0; color: var(--muted); font-size: 13.5px; }
.login-body { padding: 0 30px 26px; }
.login-foot { padding: 16px 30px 24px; border-top: 1px solid var(--line); text-align: center; }
.login-foot .demo { font-size: 12.5px; color: var(--muted); margin-bottom: 14px; }

/* ------------------------- Katalog publik ------------------------- */
.katalog-header {
  background: linear-gradient(135deg, var(--brand) 0%, #1f7a45 100%);
  color: #fff; padding: 26px 24px;
}
.katalog-header .inner { max-width: 1120px; margin: 0 auto; }
.katalog-header h1 { color: #fff; margin-bottom: 4px; }
.katalog-header p  { margin: 0; color: #c9e9d6; font-size: 14px; }
.container { max-width: 1120px; margin: 0 auto; padding: 22px 24px 50px; }

.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.book-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column;
  transition: transform .18s, box-shadow .18s;
}
.book-card:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(16,24,40,.12); }
.book-cover {
  height: 172px; background: linear-gradient(140deg, #1f7a45, #14532d);
  display: grid; place-items: center; color: #cdebd9; font-size: 40px; position: relative;
}
.book-cover img { width: 100%; height: 100%; object-fit: cover; }
.book-info { padding: 12px 13px 14px; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.book-info .jd { font-weight: 650; font-size: 14px; line-height: 1.35; }
.book-info .pg { font-size: 12.5px; color: var(--muted); }
.book-info .ft { margin-top: auto; padding-top: 8px; display: flex; align-items: center;
  gap: 6px; flex-wrap: wrap; }
.book-info .ft .badge { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

/* ------------------------- Cetak ------------------------- */
@media print {
  .sidebar, .topbar, .no-print, .filter-bar, .pagination, .form-actions { display: none !important; }
  .app, .main { display: block; }
  .content { padding: 0; }
  .card { box-shadow: none; border: none; }
  body { background: #fff; font-size: 12px; }
  .print-head { display: block !important; }
}
.print-head { display: none; text-align: center; border-bottom: 3px double #000; padding-bottom: 10px; margin-bottom: 16px; }
.print-head h2 { margin: 0; font-size: 16px; }
.print-head p  { margin: 2px 0 0; font-size: 12px; }

/* ------------------------- Responsif ------------------------- */
@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; flex: none; height: auto; position: relative; }
  .sidebar .nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .sidebar .nav a { flex: 0 0 auto; }
  .nav-label { width: 100%; }
  .mitra-side { max-width: 320px; }
  .content, .topbar { padding-left: 16px; padding-right: 16px; }
}
