/* ============================================================
   custom.css  —  PMS Custom Styles
   Bootstrap 5.3 handles all layout/grid/components
   Only project-specific overrides here
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --pms-green:       #1a5c4a;
  --pms-green-dark:  #134a3b;
  --pms-green-light: #e6f2ef;
  --pms-accent:      #c8773a;
  --pms-sidebar-w:   240px;
}

/* ---- GLOBAL ---- */
body {
  font-family: 'DM Sans', sans-serif;
  background: #f4f2ee;
  font-size: .9rem;
}

/* ---- BOOTSTRAP COLOR OVERRIDES ---- */
.btn-primary, .bg-primary              { background-color: var(--pms-green) !important; border-color: var(--pms-green) !important; }
.btn-primary:hover                     { background-color: var(--pms-green-dark) !important; border-color: var(--pms-green-dark) !important; }
.btn-outline-primary                   { color: var(--pms-green) !important; border-color: var(--pms-green) !important; }
.btn-outline-primary:hover             { background-color: var(--pms-green) !important; color: #fff !important; }
.text-primary                          { color: var(--pms-green) !important; }
.nav-pills .nav-link.active            { background-color: var(--pms-green) !important; }
.form-control:focus, .form-select:focus{ border-color: var(--pms-green); box-shadow: 0 0 0 .2rem rgba(26,92,74,.18); }
.page-item.active .page-link           { background-color: var(--pms-green); border-color: var(--pms-green); }
.page-link                             { color: var(--pms-green); }
.form-check-input:checked              { background-color: var(--pms-green); border-color: var(--pms-green); }
.btn-check:checked + .btn-outline-secondary { background: var(--pms-green-light); border-color: var(--pms-green); color: var(--pms-green); }
.text-success                          { color: var(--pms-green) !important; }
.bg-success                            { background-color: var(--pms-green) !important; }
.bg-success-subtle                     { background-color: var(--pms-green-light) !important; }
.border-success-subtle                 { border-color: #a8d5c8 !important; }

/* ---- SIDEBAR ---- */
#pms-sidebar {
  width: var(--pms-sidebar-w);
  background: var(--pms-green);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 1040;
  transition: transform .28s ease;
}
#pms-sidebar::-webkit-scrollbar       { width: 3px; }
#pms-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 1.2rem 1rem .9rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
  flex-shrink: 0;
}
.sidebar-brand-icon {
  width: 36px; height: 36px;
  background: rgba(255,255,255,.15);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.1rem;
  flex-shrink: 0;
}
.sidebar-brand-name {
  font-family: 'DM Serif Display', serif;
  color: #fff; font-size: 1rem; line-height: 1.1; font-weight: 400;
}
.sidebar-brand-sub {
  font-size: .62rem; color: rgba(255,255,255,.45);
  letter-spacing: .08em; text-transform: uppercase;
}
.sidebar-nav   { padding: .5rem .5rem; flex: 1; }
.sidebar-label {
  font-size: .6rem; letter-spacing: .13em; text-transform: uppercase;
  color: rgba(255,255,255,.38); padding: .9rem .75rem .3rem;
}
.sidebar-hr    { border-color: rgba(255,255,255,.08); margin: .4rem .75rem; }
.sidebar-link {
  display: flex; align-items: center; gap: 8px;
  padding: .48rem .75rem; border-radius: 7px; margin: 1px 0;
  color: rgba(255,255,255,.72); font-size: .84rem; text-decoration: none;
  transition: background .15s, color .15s;
}
.sidebar-link:hover { background: rgba(255,255,255,.1); color: #fff; }
.sidebar-link.active { background: rgba(255,255,255,.18); color: #fff; font-weight: 500; }
.sidebar-sublink {
  display: flex; align-items: center; gap: 7px;
  padding: .32rem .75rem .32rem 2.1rem; border-radius: 6px; margin: 1px 0;
  color: rgba(255,255,255,.55); font-size: .78rem; text-decoration: none;
  transition: background .14s, color .14s;
}
.sidebar-sublink:hover { background: rgba(255,255,255,.07); color: rgba(255,255,255,.9); }
.sidebar-sublink.active { color: #fff; font-weight: 500; }
.sidebar-footer {
  padding: .75rem 1rem;
  border-top: 1px solid rgba(255,255,255,.1);
  flex-shrink: 0;
}
.sidebar-user {
  display: flex; align-items: center; gap: 9px; margin-bottom: .6rem;
}
.sidebar-avatar {
  width: 30px; height: 30px;
  background: rgba(255,255,255,.2); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; flex-shrink: 0;
}
.sidebar-user-name { font-size: .82rem; color: #fff; font-weight: 500; }
.sidebar-user-role { font-size: .68rem; color: rgba(255,255,255,.45); }
.sidebar-logout-btn {
  width: 100%; padding: .38rem .75rem; border-radius: 6px;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.15);
  color: rgba(255,255,255,.8); font-size: .78rem; cursor: pointer;
  transition: background .15s;
  font-family: 'DM Sans', sans-serif;
}
.sidebar-logout-btn:hover { background: rgba(255,255,255,.2); color: #fff; }

/* ---- MAIN ---- */
.pms-main {
  margin-left: var(--pms-sidebar-w);
  min-height: 100vh;
  display: flex; flex-direction: column;
}

/* ---- TOPBAR ---- */
.pms-topbar {
  height: 56px; background: #fff;
  border-bottom: 1px solid #e2dfd9;
  position: sticky; top: 0; z-index: 1030;
  box-shadow: 0 1px 5px rgba(0,0,0,.06);
  display: flex; align-items: center;
  padding: 0 1.5rem; gap: 10px; flex-shrink: 0;
}
.topbar-toggle {
  display: none; background: none; border: none;
  color: #555; padding: 4px 6px; border-radius: 6px; line-height: 1;
}

/* ---- PAGE BODY ---- */
.pms-body { padding: 1.5rem; flex: 1; }

/* ---- PAGE TITLE ---- */
.pms-page-title {
  font-family: 'DM Serif Display', serif;
  font-size: 1.65rem; font-weight: 400; color: #1c1a17;
}

/* ---- STAT CARDS ---- */
.stat-card {
  background: #fff; border: 1px solid #dbd7cf;
  border-left: 3px solid var(--pms-green);
  border-radius: 10px; padding: 1rem 1.1rem;
}
.stat-card.stat-blue   { border-left-color: #1d4ed8; }
.stat-card.stat-orange { border-left-color: var(--pms-accent); }
.stat-card.stat-red    { border-left-color: #c0392b; }
.stat-card.stat-green  { border-left-color: var(--pms-green); }
.stat-val {
  font-family: 'DM Serif Display', serif;
  font-size: 1.9rem; color: #1c1a17; line-height: 1; margin: .25rem 0 .2rem;
}
.stat-lbl { font-size: .68rem; font-weight: 500; text-transform: uppercase; letter-spacing: .07em; color: #9e9992; }
.stat-sub { font-size: .74rem; color: #6b6660; }

/* ---- CARD SECTION HEADER ---- */
.section-card-title {
  font-family: 'DM Serif Display', serif;
  font-size: 1rem; color: var(--pms-green); font-weight: 400;
  display: flex; align-items: center; gap: 7px;
}
.card-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--pms-accent); flex-shrink: 0; display: inline-block;
}

/* ---- UHID BOX ---- */
.uhid-box {
  background: var(--pms-green-light); border: 1px solid var(--pms-green);
  border-radius: 6px; padding: .5rem .75rem;
  color: var(--pms-green); font-size: .85rem; font-weight: 500;
}

/* ---- TOGGLE BUTTONS ---- */
.pms-toggle .btn-outline-secondary { color: #6b6660; font-size: .82rem; }

/* ---- SEVERITY BUTTONS ---- */
.btn-check:checked + [data-sev="mild"]     { background: #d4edda; border-color: #28a745; color: #155724; }
.btn-check:checked + [data-sev="moderate"] { background: #fff3cd; border-color: #ffc107; color: #856404; }
.btn-check:checked + [data-sev="severe"]   { background: #f8d7da; border-color: #dc3545; color: #721c24; }
.btn-check:checked + [data-sev="critical"] { background: #f5c6cb; border-color: #bd2130; color: #491217; }

/* ---- REPEATING ROWS ---- */
.repeat-row {
  background: #f8f7f4; border: 1px solid #e2dfd9;
  border-radius: 8px; padding: 14px; margin-bottom: 10px; position: relative;
}
.btn-remove {
  position: absolute; top: 8px; right: 8px; padding: 2px 7px; font-size: .76rem;
}
.btn-add-row {
  width: 100%; padding: 9px; border-radius: 7px;
  border: 1.5px dashed #c5c0b8; background: none;
  color: #6b6660; font-size: .82rem; cursor: pointer;
  font-family: 'DM Sans', sans-serif; transition: all .15s;
}
.btn-add-row:hover { border-color: var(--pms-green); color: var(--pms-green); background: var(--pms-green-light); }

/* ---- DATA TABLE ---- */
.pms-table thead th {
  background: #f4f2ee; font-size: .7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em;
  color: #6b6660; border-bottom: 2px solid #dbd7cf;
  white-space: nowrap; vertical-align: middle;
}
.pms-table td        { vertical-align: middle; font-size: .85rem; }
.pms-table tbody tr:hover { background: #f8f7f4; }
.th-sort             { cursor: pointer; user-select: none; }
.th-sort:hover       { color: var(--pms-green); }

/* ---- TOOLBAR ---- */
.grid-toolbar {
  background: #fff; border: 1px solid #dbd7cf;
  border-radius: 10px; padding: .75rem 1rem; margin-bottom: .9rem;
}

/* ---- UPLOAD ZONE ---- */
.upload-zone {
  border: 2px dashed #c5c0b8; border-radius: 8px;
  padding: 1.5rem; text-align: center; background: #f8f7f4;
  cursor: pointer; transition: all .18s; display: block;
}
.upload-zone:hover { border-color: var(--pms-green); background: var(--pms-green-light); }
.upload-zone input { display: none; }

/* ---- EMPTY STATE ---- */
.empty-state { padding: 3rem 1rem; text-align: center; }
.empty-state .ei { font-size: 2.5rem; opacity: .5; }
.empty-state h6   { font-family: 'DM Serif Display', serif; font-weight: 400; color: #6b6660; }
.empty-state p    { font-size: .82rem; color: #9e9992; }

/* ---- QUICK LINK CARD ---- */
.ql-card {
  display: flex; align-items: center; gap: 12px;
  padding: 1rem 1.1rem; background: #fff;
  border: 1px solid #dbd7cf; border-radius: 10px;
  text-decoration: none; color: inherit; transition: all .16s;
}
.ql-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.1); border-color: var(--pms-green); }
.ql-icon {
  width: 38px; height: 38px; background: var(--pms-green-light);
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; flex-shrink: 0;
}

/* ---- LOGIN ---- */
.login-wrapper {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--pms-green) 0%, var(--pms-green-dark) 60%, #0d3328 100%);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.login-card {
  width: 100%; max-width: 400px;
  background: #fff; border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0,0,0,.28); overflow: hidden;
}
.login-header {
  background: var(--pms-green); padding: 2rem 2rem 1.5rem; text-align: center;
}
.login-header h4 {
  font-family: 'DM Serif Display', serif;
  color: #fff; font-weight: 400; font-size: 1.4rem; margin: 0;
}
.login-header small { color: rgba(255,255,255,.55); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; }
.login-body        { padding: 1.75rem 2rem; }

/* ---- DASHBOARD ---- */
.dash-stats-row > [class*="col"] .stat-card { cursor: pointer; transition: all .16s; }
.dash-stats-row > [class*="col"] .stat-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.1); transform: translateY(-2px); }

/* ---- MOBILE ---- */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.4); z-index: 1039;
}
.sidebar-overlay.show { display: block; }

@media (max-width: 991.98px) {
  #pms-sidebar       { transform: translateX(-100%); }
  #pms-sidebar.sidebar-open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,.2); }
  .pms-main          { margin-left: 0 !important; }
  .topbar-toggle     { display: flex; align-items: center; }
  .pms-body          { padding: 1rem; }
  .pms-topbar        { padding: 0 1rem; }
}
@media (max-width: 575.98px) {
  .grid-toolbar      { flex-direction: column !important; align-items: stretch !important; }
  .pms-page-title    { font-size: 1.3rem; }
}
