/* assets/css/style.css — SIDAS v2 */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&family=Cormorant+Garamond:wght@500;600&display=swap');

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

:root {
  --blue:   #0f2460;
  --blue2:  #1a3a8f;
  --blue3:  #132057;
  --orange: #e07010;
  --ora2:   #f59030;
  --ink:    #1a1f36;
  --muted:  #6b7280;
  --bg:     #f5f6fa;
  --card:   #ffffff;
  --border: #e5e7eb;
  --green:  #1e7a4a;
  --red:    #b03030;
  --shadow: rgba(26,58,143,0.10);
  --sb-w:   240px;
  --top-h:  54px;
  --foot-h: 42px;
}

body { font-family: 'DM Sans', sans-serif; background: var(--bg); color: var(--ink); }

/* ── APP LAYOUT ── */
#app-layout { display: flex; min-height: 100vh; }
.main-wrap { flex: 1; margin-left: var(--sb-w); display: flex; flex-direction: column; min-height: 100vh; }

/* ── SIDEBAR ── */
.sidebar { width: var(--sb-w); background: var(--blue); position: fixed; top: 0; left: 0; height: 100vh; display: flex; flex-direction: column; z-index: 50; overflow-y: auto; border-right: 1px solid rgba(255,255,255,0.06); }
.sb-brand { padding: 18px 16px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid rgba(255,255,255,0.08); flex-shrink: 0; }
.sb-brand img { width: 38px; height: 38px; object-fit: contain; border-radius: 8px; background: rgba(255,255,255,0.1); padding: 3px; }
.sb-title { font-family: 'Cormorant Garamond', serif; font-size: 1.05rem; font-weight: 600; color: white; line-height: 1.2; }
.sb-sub { font-size: 0.63rem; color: rgba(255,255,255,0.32); text-transform: uppercase; letter-spacing: 0.1em; }
.sb-nav { flex: 1; padding: 10px 0; }
.sb-section { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.12em; color: rgba(255,255,255,0.22); padding: 12px 16px 5px; }
.sb-link { display: flex; align-items: center; gap: 10px; padding: 9px 16px; font-size: 0.845rem; color: rgba(255,255,255,0.52); text-decoration: none; transition: all 0.17s; border-left: 3px solid transparent; cursor: pointer; }
.sb-link:hover { color: white; background: rgba(255,255,255,0.05); }
.sb-link.active { color: white; background: rgba(224,112,16,0.18); border-left-color: var(--orange); }
.sb-icon { font-size: 0.88rem; width: 18px; text-align: center; flex-shrink: 0; }
.sb-footer { padding: 12px 14px; border-top: 1px solid rgba(255,255,255,0.08); flex-shrink: 0; }
.sb-user { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.sb-avatar { width: 32px; height: 32px; background: var(--orange); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.85rem; color: white; flex-shrink: 0; }
.sb-uname { font-size: 0.8rem; color: white; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-urole { font-size: 0.68rem; color: rgba(255,255,255,0.32); }
.sb-logout { display: block; text-align: center; padding: 6px; background: rgba(176,48,48,0.18); color: #f87171; border-radius: 6px; font-size: 0.77rem; text-decoration: none; transition: background 0.2s; }
.sb-logout:hover { background: rgba(176,48,48,0.35); }

/* ── TOPBAR ── */
.topbar { background: var(--blue3); color: white; padding: 0 24px; height: var(--top-h); display: flex; align-items: center; justify-content: space-between; border-bottom: 2px solid var(--orange); box-shadow: 0 2px 14px rgba(0,0,0,0.18); position: sticky; top: 0; z-index: 40; flex-shrink: 0; }
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-title { font-family: 'Cormorant Garamond', serif; font-size: 1.18rem; font-weight: 600; color: white; }
.topbar-sub { font-size: 0.73rem; color: rgba(255,255,255,0.38); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-user { font-size: 0.82rem; color: rgba(255,255,255,0.65); }
.sb-toggle { display: none; background: none; border: none; color: white; font-size: 1.2rem; cursor: pointer; padding: 4px 8px; }

/* ── CONTENT ── */
.content { flex: 1; padding: 26px 28px; }
.page-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; height: 200px; color: var(--muted); }

/* ── FOOTER ── */
.app-footer { background: var(--card); border-top: 1px solid var(--border); padding: 0 28px; height: var(--foot-h); display: flex; align-items: center; justify-content: space-between; font-size: 0.76rem; color: var(--muted); flex-shrink: 0; }

/* ── PAGE HEADER ── */
.page-header { margin-bottom: 22px; }
.page-header h1 { font-family: 'Cormorant Garamond', serif; font-size: 1.65rem; font-weight: 600; color: var(--ink); }
.page-header p { font-size: 0.84rem; color: var(--muted); margin-top: 2px; }
.page-header-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-header-row .page-header { margin-bottom: 0; }

/* ── TWO COL ── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

/* ── STATS ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card { background: var(--card); border-radius: 10px; padding: 18px 20px; border: 1px solid var(--border); box-shadow: 0 1px 4px var(--shadow); display: flex; flex-direction: column; gap: 8px; }
.stat-icon { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 1rem; margin-bottom: 4px; }
.stat-icon.blue { background: rgba(15,36,96,0.08); }
.stat-icon.green { background: rgba(30,122,74,0.09); }
.stat-icon.orange { background: rgba(224,112,16,0.09); }
.stat-value { font-size: 1.75rem; font-weight: 700; color: var(--ink); line-height: 1; }
.stat-label { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }

/* ── CARD ── */
.card { background: var(--card); border-radius: 10px; border: 1px solid var(--border); box-shadow: 0 1px 4px var(--shadow); overflow: hidden; margin-bottom: 0; }
.card-head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 0.88rem; font-weight: 600; color: var(--ink); }
.card-body { padding: 18px; }

/* ── TABLE ── */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th { background: var(--blue); color: white; padding: 10px 14px; text-align: left; font-weight: 500; font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
td { padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--ink); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f9fafb; }
.td-no { width: 38px; text-align: center; color: var(--muted); font-size: 0.78rem; }
.td-trunc { display: block; max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.td-sub { font-size: 0.76rem; color: var(--muted); margin-top: 2px; }
.tbl-footer { padding: 10px 16px; font-size: 0.78rem; color: var(--muted); border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.text-muted-sm { font-size: 0.8rem; color: var(--muted); }
.code-sm { font-size: 0.8rem; background: #f3f4f6; padding: 2px 6px; border-radius: 4px; font-family: monospace; }

/* ── BADGE ── */
.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 0.72rem; font-weight: 600; white-space: nowrap; }
.badge-green  { background: #dcfce7; color: #166534; }
.badge-orange { background: #ffedd5; color: #9a3412; }
.badge-blue   { background: #dbeafe; color: #1e40af; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-gray   { background: #f3f4f6; color: #6b7280; }

/* ── BUTTONS ── */
.btn { display: inline-flex; align-items: center; gap: 5px; padding: 8px 15px; border-radius: 7px; font-size: 0.84rem; font-weight: 500; cursor: pointer; border: none; text-decoration: none; transition: all 0.16s; font-family: 'DM Sans', sans-serif; white-space: nowrap; }
.btn-pri   { background: var(--orange); color: white; }
.btn-pri:hover { background: #c86010; }
.btn-sec   { background: white; color: var(--ink); border: 1px solid var(--border); }
.btn-sec:hover { background: #f3f4f6; }
.btn-blue  { background: var(--blue); color: white; }
.btn-blue:hover { background: var(--blue2); }
.btn-sm    { padding: 5px 10px; font-size: 0.77rem; border-radius: 5px; }
.btn-grp   { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ── ACTION BUTTONS ── */
.act-btns { display: flex; gap: 4px; }
.abtn { width: 28px; height: 28px; border-radius: 5px; border: 1px solid var(--border); background: white; cursor: pointer; font-size: 0.8rem; display: flex; align-items: center; justify-content: center; transition: all 0.14s; text-decoration: none; }
.abtn.edit { background: #eff6ff; color: #2563eb; border-color: #bfdbfe; }
.abtn.del  { background: #fef2f2; color: #dc2626; border-color: #fecaca; }
.abtn.view { background: #f0fdf4; color: #16a34a; border-color: #bbf7d0; }
.abtn.dld  { background: #fffbeb; color: #d97706; border-color: #fde68a; }

/* ── FORM ── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 0.75rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.field input, .field select, .field textarea { padding: 9px 12px; border: 1px solid var(--border); border-radius: 7px; font-family: 'DM Sans', sans-serif; font-size: 0.88rem; color: var(--ink); outline: none; transition: border-color 0.18s; background: white; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--blue2); box-shadow: 0 0 0 3px rgba(26,58,143,0.07); }
.field textarea { resize: vertical; min-height: 78px; }
.form-actions { display: flex; gap: 10px; }

/* ── FILTER BAR ── */
.filter-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.search-wrap { position: relative; flex: 1; min-width: 180px; }
.search-wrap::before { content: '🔍'; position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 0.78rem; pointer-events: none; }
.search-wrap input { width: 100%; padding: 9px 12px 9px 34px; border: 1px solid var(--border); border-radius: 7px; font-family: 'DM Sans', sans-serif; font-size: 0.85rem; }
.search-wrap input:focus { outline: none; border-color: var(--blue2); }
.fsel { padding: 9px 12px; border: 1px solid var(--border); border-radius: 7px; font-family: 'DM Sans', sans-serif; font-size: 0.84rem; background: white; color: var(--ink); }

/* ── MODAL ── */
.modal-ov { display: none; position: fixed; inset: 0; background: rgba(11,25,65,0.6); z-index: 200; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(3px); }
.modal-ov.open { display: flex; }
.modal { background: white; border-radius: 12px; width: 100%; max-width: 580px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.22); }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: white; z-index: 1; }
.modal-head span { font-weight: 600; font-size: 0.96rem; }
.mcls { background: none; border: none; font-size: 1rem; cursor: pointer; color: var(--muted); padding: 2px 6px; border-radius: 4px; }
.mcls:hover { background: #f3f4f6; }
.modal-body { padding: 20px; }
.modal-foot { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ── DETAIL ROW ── */
.detail-row { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px solid #f0f0f0; }
.detail-lbl { font-size: 0.78rem; color: var(--muted); min-width: 130px; font-weight: 500; }
.detail-val { font-size: 0.87rem; color: var(--ink); font-weight: 600; flex: 1; }

/* ── LINK BUTTON ── */
.link-btn { display: inline-flex; align-items: center; gap: 3px; padding: 2px 9px; background: #eff6ff; color: #2563eb; border-radius: 5px; font-size: 0.76rem; text-decoration: none; font-weight: 500; }
.link-btn:hover { background: #dbeafe; }

/* ── CHART ── */
.chart-bar-wrap { display: flex; flex-direction: column; gap: 10px; }
.chart-bar-item { display: flex; align-items: center; gap: 10px; font-size: 0.8rem; }
.chart-bar-label { width: 85px; color: var(--muted); text-align: right; flex-shrink: 0; font-size: 0.77rem; }
.chart-bar-track { flex: 1; background: #f0f1f5; border-radius: 4px; height: 9px; overflow: hidden; }
.chart-bar-fill { height: 100%; border-radius: 4px; background: var(--blue2); transition: width 0.7s ease; }
.chart-bar-val { width: 28px; font-weight: 600; color: var(--ink); font-size: 0.8rem; }

/* ── RECENT LIST ── */
.recent-item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid #f3f4f6; }
.recent-item:last-child { border-bottom: none; }
.recent-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--orange); flex-shrink: 0; }
.recent-info { flex: 1; min-width: 0; }
.recent-title { font-size: 0.84rem; color: var(--ink); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-sub { font-size: 0.74rem; color: var(--muted); }
.recent-time { font-size: 0.72rem; color: var(--muted); flex-shrink: 0; }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty-state .es-icon { font-size: 2.2rem; margin-bottom: 10px; opacity: 0.4; }
.empty-state p { font-size: 0.88rem; }

/* ── PAGINATION ── */
.pagination { display: flex; gap: 3px; }
.pg-btn { width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 6px; font-size: 0.8rem; cursor: pointer; background: white; color: var(--ink); transition: all 0.14s; }
.pg-btn:hover, .pg-btn.active { background: var(--orange); color: white; border-color: var(--orange); }

/* ── ALERT ── */
.alert { padding: 11px 15px; border-radius: 7px; font-size: 0.84rem; margin-bottom: 14px; }
.alert-ok   { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-err  { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* ── TOAST ── */
.toast-wrap { position: fixed; bottom: 22px; right: 22px; z-index: 9999; display: flex; flex-direction: column; gap: 7px; }
.toast { background: var(--ink); color: white; padding: 10px 16px; border-radius: 8px; font-size: 0.83rem; box-shadow: 0 6px 20px rgba(0,0,0,0.18); animation: toastIn 0.28s ease; max-width: 300px; }
.toast.ok  { background: var(--green); }
.toast.err { background: var(--red); }
@keyframes toastIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── LOADING ── */
.loading-ov { position: fixed; inset: 0; background: rgba(15,36,96,0.72); z-index: 999; display: none; align-items: center; justify-content: center; flex-direction: column; gap: 14px; }
.loading-ov.show { display: flex; }
.spinner { width: 34px; height: 34px; border: 3px solid rgba(255,255,255,0.18); border-top-color: var(--ora2); border-radius: 50%; animation: spin 0.75s linear infinite; }
.loading-txt { color: white; font-size: 0.84rem; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── LOGIN PAGE ── */
.login-body { min-height: 100vh; }
.login-page { min-height: 100vh; display: flex; position: relative; overflow: hidden; background: var(--blue); }
.login-bg { position: absolute; inset: 0; background-image: url('/assets/img/bg-login.jpg'); background-size: cover; background-position: center; filter: brightness(0.32) saturate(0.7); }
.login-left { flex: 1; position: relative; z-index: 2; display: flex; flex-direction: column; justify-content: center; padding: 60px; }
.login-left::after { content:''; position: absolute; inset: 0; background: linear-gradient(110deg, rgba(15,36,96,0.96) 0%, rgba(15,36,96,0.72) 55%, rgba(224,112,16,0.12) 100%); z-index: -1; }
.login-brand { display: flex; align-items: center; gap: 16px; margin-bottom: 52px; }
.login-brand img { width: 54px; height: 54px; object-fit: contain; border-radius: 10px; background: rgba(255,255,255,0.1); padding: 4px; }
.login-brand-text .t1 { font-family: 'Cormorant Garamond', serif; font-size: 1.45rem; font-weight: 600; color: white; }
.login-brand-text .t2 { font-size: 0.7rem; color: rgba(255,255,255,0.32); text-transform: uppercase; letter-spacing: 0.12em; }
.login-headline { font-family: 'Cormorant Garamond', serif; font-size: 2.6rem; font-weight: 600; color: white; line-height: 1.2; margin-bottom: 18px; }
.login-headline span { color: var(--ora2); }
.login-desc { font-size: 0.9rem; color: rgba(255,255,255,0.47); line-height: 1.8; max-width: 380px; margin-bottom: 24px; }
.login-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.login-tag { padding: 5px 13px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1); border-radius: 20px; font-size: 0.76rem; color: rgba(255,255,255,0.45); }
.login-right { width: 400px; background: rgba(15,36,96,0.68); backdrop-filter: blur(20px); border-left: 1px solid rgba(255,255,255,0.07); display: flex; align-items: center; justify-content: center; padding: 50px 40px; position: relative; z-index: 2; }
.login-box { width: 100%; }
.login-box h2 { font-family: 'Cormorant Garamond', serif; font-size: 1.65rem; font-weight: 600; color: white; margin-bottom: 4px; }
.login-box > p { font-size: 0.8rem; color: rgba(255,255,255,0.32); margin-bottom: 26px; }
.lfield { margin-bottom: 14px; }
.lfield label { display: block; font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.09em; color: rgba(255,255,255,0.38); margin-bottom: 7px; }
.lfield input { width: 100%; padding: 11px 14px; background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.1); border-radius: 7px; font-size: 0.9rem; color: white; font-family: 'DM Sans', sans-serif; outline: none; transition: border-color 0.18s; }
.lfield input:focus { border-color: var(--ora2); }
.lfield input::placeholder { color: rgba(255,255,255,0.18); }
.btn-login { width: 100%; padding: 12px; background: var(--orange); color: white; border: none; border-radius: 7px; font-size: 0.93rem; font-weight: 600; cursor: pointer; font-family: 'DM Sans', sans-serif; transition: background 0.18s; margin-top: 6px; }
.btn-login:hover { background: #c86010; }
.login-err { background: rgba(176,48,48,0.15); border: 1px solid rgba(176,48,48,0.3); color: #f87171; padding: 9px 13px; border-radius: 6px; font-size: 0.81rem; margin-bottom: 12px; display: none; }

/* ── PRINT ── */
@media print {
  .sidebar, .topbar, .app-footer, .filter-bar, .btn-grp, .btn, .act-btns { display: none !important; }
  .main-wrap { margin-left: 0 !important; }
  .content { padding: 0 !important; }
}

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  :root { --sb-w: 0px; }
  .sidebar { transform: translateX(-240px); width: 240px; transition: transform 0.28s; }
  .sidebar.open { transform: translateX(0); }
  .main-wrap { margin-left: 0; }
  .sb-toggle { display: block; }
  .two-col { grid-template-columns: 1fr; }
  .login-left { display: none; }
  .login-right { width: 100%; }
}
