/* ============================================================
   NACHUPONG PORTAL – Main Stylesheet
   ============================================================ */

:root {
  --primary:       #2563eb;
  --primary-dark:  #1d4ed8;
  --primary-light: #eff6ff;
  --accent:        #7c3aed;
  --success:       #16a34a;
  --warning:       #d97706;
  --danger:        #dc2626;
  --info:          #0891b2;
  --sidebar-w:     260px;
  --navbar-h:      58px;
  --sidebar-bg:    #0f172a;
  --sidebar-hover: #1e293b;
  --sidebar-active:#2563eb;
  --text-primary:  #1e293b;
  --text-muted:    #64748b;
  --border:        #e2e8f0;
  --card-shadow:   0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --card-shadow-hover: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
}

/* ─── Reset & Base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: #f1f5f9;
  color: var(--text-primary);
  font-size: .875rem;
  overflow-x: hidden;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
.fw-700 { font-weight: 700; }

/* ─── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ─── Navbar ─────────────────────────────────────────────── */
.navbar-portal {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  height: var(--navbar-h);
  z-index: 1050;
  border-bottom: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.navbar-portal .navbar-brand { font-size: 1rem; letter-spacing: -.3px; }
.brand-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--primary); display: grid; place-items: center;
  font-size: 1rem; color: #fff;
}
.sidebar-toggle { border: none !important; text-decoration: none !important; }
.sidebar-toggle:hover { opacity: .8; }
.fs-notif { font-size: 9px; }

/* Avatar */
.avatar-sm { width: 34px; height: 34px; }
.avatar-initials {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700; letter-spacing: .5px;
}
.notif-icon {
  width: 32px; height: 32px; border-radius: 8px;
  display: grid; place-items: center; flex-shrink: 0; font-size: 12px;
}

/* ─── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: var(--navbar-h);
  left: 0;
  width: var(--sidebar-w);
  height: calc(100vh - var(--navbar-h));
  background: var(--sidebar-bg);
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform .3s ease, width .3s ease;
  z-index: 1040;
}
.sidebar-inner { padding: .75rem 0 2rem; }
.sidebar-nav { list-style: none; margin: 0; padding: 0; }
.nav-section {
  font-size: 10px; font-weight: 700; letter-spacing: 1.2px;
  color: #475569; text-transform: uppercase;
  padding: 1.25rem 1.25rem .4rem; margin-top: .25rem;
}
.sidebar-nav .nav-link {
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem 1.25rem; color: #94a3b8;
  border-radius: 0; transition: all .2s;
  font-weight: 500; font-size: .8125rem;
  border-left: 3px solid transparent;
  white-space: nowrap;
}
.sidebar-nav .nav-link i { font-size: 1rem; flex-shrink: 0; }
.sidebar-nav .nav-link:hover {
  background: var(--sidebar-hover); color: #e2e8f0;
  border-left-color: rgba(255,255,255,.2);
}
.sidebar-nav .nav-link.active {
  background: rgba(37,99,235,.15); color: #93c5fd;
  border-left-color: var(--sidebar-active); font-weight: 600;
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 1039;
}
.sidebar-overlay.active { display: block; }

/* ─── Main Content ───────────────────────────────────────── */
.app-wrapper { display: flex; min-height: 100vh; }
.main-content {
  margin-left: var(--sidebar-w);
  margin-top: var(--navbar-h);
  padding: 1.5rem;
  width: calc(100% - var(--sidebar-w));
  min-height: calc(100vh - var(--navbar-h));
  transition: margin-left .3s ease, width .3s ease;
}
.main-content.sidebar-collapsed {
  margin-left: 0; width: 100%;
}

/* Sidebar collapsed state (desktop) */
body.sidebar-collapsed .sidebar { transform: translateX(-100%); }
body.sidebar-collapsed .main-content { margin-left: 0; width: 100%; }

/* ─── Page Header ────────────────────────────────────────── */
.page-header {
  background: #fff; border-radius: 12px;
  padding: 1.25rem 1.5rem; margin-bottom: 1.5rem;
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .75rem;
}
.page-header-title { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); margin: 0; }
.page-header-sub { font-size: .8rem; color: var(--text-muted); margin-top: 2px; }
.breadcrumb { margin: 0; font-size: .8rem; }
.breadcrumb-item + .breadcrumb-item::before { color: #94a3b8; }

/* ─── Cards ──────────────────────────────────────────────── */
.card {
  border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--card-shadow); background: #fff;
}
.card-header {
  background: #fff; border-bottom: 1px solid var(--border);
  border-radius: 12px 12px 0 0 !important;
  padding: 1rem 1.25rem; font-weight: 600;
}
.card:hover { box-shadow: var(--card-shadow-hover); }

/* Stat Cards */
.stat-card {
  border-radius: 16px; padding: 1.25rem; border: none;
  position: relative; overflow: hidden; transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--card-shadow-hover); }
.stat-card .stat-icon {
  width: 52px; height: 52px; border-radius: 14px;
  display: grid; place-items: center; font-size: 1.4rem;
}
.stat-card .stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.stat-card .stat-label { font-size: .78rem; font-weight: 500; opacity: .85; margin-top: 4px; }
.stat-card .stat-change { font-size: .72rem; margin-top: .5rem; }
.stat-card-primary { background: linear-gradient(135deg, #2563eb, #1d4ed8); color: #fff; }
.stat-card-success { background: linear-gradient(135deg, #16a34a, #15803d); color: #fff; }
.stat-card-warning { background: linear-gradient(135deg, #d97706, #b45309); color: #fff; }
.stat-card-danger  { background: linear-gradient(135deg, #dc2626, #b91c1c); color: #fff; }
.stat-card-info    { background: linear-gradient(135deg, #0891b2, #0e7490); color: #fff; }
.stat-card-purple  { background: linear-gradient(135deg, #7c3aed, #6d28d9); color: #fff; }

/* ─── Tables ─────────────────────────────────────────────── */
.table-card { border-radius: 12px; overflow: hidden; border: 1px solid var(--border); }
.table { margin: 0; font-size: .8375rem; }
.table thead th {
  background: #f8fafc; font-weight: 600; font-size: .75rem;
  text-transform: uppercase; letter-spacing: .4px;
  color: var(--text-muted); border-bottom: 1px solid var(--border);
  padding: .75rem 1rem; white-space: nowrap;
}
.table tbody td { padding: .75rem 1rem; vertical-align: middle; border-color: var(--border); }
.table tbody tr:hover td { background: #f8fafc; }
.table-striped > tbody > tr:nth-of-type(odd) > td { background: #fafbfc; }

/* ─── Forms ──────────────────────────────────────────────── */
.form-control, .form-select {
  border-radius: 8px; border: 1.5px solid var(--border);
  font-size: .8375rem; padding: .5rem .875rem; transition: border-color .2s, box-shadow .2s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.form-label { font-weight: 500; font-size: .8rem; color: var(--text-primary); margin-bottom: .3rem; }
.input-group-text { border-radius: 8px; border: 1.5px solid var(--border); }

/* ─── Buttons ────────────────────────────────────────────── */
.btn { border-radius: 8px; font-weight: 500; font-size: .8375rem; transition: all .2s; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-sm { padding: .35rem .75rem; font-size: .78rem; }
.btn-xs { padding: .2rem .5rem; font-size: .72rem; border-radius: 6px; }
.btn-icon { width: 32px; height: 32px; padding: 0; display: grid; place-items: center; border-radius: 8px; }

/* ─── Badges ─────────────────────────────────────────────── */
.badge { font-size: .72rem; font-weight: 600; padding: .3em .65em; border-radius: 6px; }

/* ─── Modals ─────────────────────────────────────────────── */
.modal-content { border-radius: 16px; border: none; box-shadow: 0 25px 50px rgba(0,0,0,.2); }
.modal-header { border-bottom: 1px solid var(--border); padding: 1.25rem 1.5rem; border-radius: 16px 16px 0 0; }
.modal-footer { border-top: 1px solid var(--border); padding: 1rem 1.5rem; }

/* ─── Search & Filter Bar ────────────────────────────────── */
.filter-bar {
  background: #fff; border-radius: 12px; padding: 1rem 1.25rem;
  border: 1px solid var(--border); margin-bottom: 1rem;
  display: flex; gap: .75rem; flex-wrap: wrap; align-items: center;
}
.filter-bar .form-control, .filter-bar .form-select {
  max-width: 200px; height: 36px; padding: .3rem .75rem;
}
.filter-bar .btn { height: 36px; }

/* ─── Kanban ─────────────────────────────────────────────── */
.kanban-board { display: flex; gap: 1rem; overflow-x: auto; padding-bottom: 1rem; }
.kanban-col {
  min-width: 260px; max-width: 280px; flex-shrink: 0;
  background: #f1f5f9; border-radius: 12px; padding: .75rem;
}
.kanban-col-header {
  font-weight: 700; font-size: .8rem; text-transform: uppercase;
  letter-spacing: .5px; margin-bottom: .75rem; display: flex; align-items: center; gap: .5rem;
}
.kanban-card {
  background: #fff; border-radius: 10px; padding: .875rem;
  border: 1px solid var(--border); margin-bottom: .625rem;
  cursor: pointer; transition: box-shadow .2s;
}
.kanban-card:hover { box-shadow: var(--card-shadow-hover); }

/* ─── Timeline ───────────────────────────────────────────── */
.timeline { position: relative; padding: .5rem 0; }
.timeline::before {
  content: ''; position: absolute; left: 20px; top: 0; bottom: 0;
  width: 2px; background: var(--border);
}
.timeline-item { display: flex; gap: 1rem; margin-bottom: 1.25rem; position: relative; }
.timeline-icon {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; font-size: .875rem; z-index: 1;
  background: #fff; border: 2px solid var(--border);
}
.timeline-content { flex: 1; background: #f8fafc; border-radius: 10px; padding: .75rem; }
.timeline-content .title { font-weight: 600; font-size: .8125rem; }
.timeline-content .meta  { font-size: .75rem; color: var(--text-muted); }

/* ─── Print ──────────────────────────────────────────────── */
@media print {
  .sidebar, .navbar-portal, .filter-bar, .btn, .no-print { display: none !important; }
  .main-content { margin: 0 !important; padding: 0 !important; width: 100% !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; }
}

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
    z-index: 1045;
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-content { margin-left: 0; width: 100%; padding: 1rem; }
  .stat-card { margin-bottom: .75rem; }
  .filter-bar .form-control, .filter-bar .form-select { max-width: 150px; }
  .kanban-board { padding-bottom: 2rem; }
}
@media (max-width: 575.98px) {
  .main-content { padding: .75rem; }
  .page-header { padding: 1rem; }
  .filter-bar { padding: .75rem; }
  .filter-bar .form-control, .filter-bar .form-select { max-width: 100%; }
  .table-responsive { font-size: .78rem; }
}

/* ─── Login Page ─────────────────────────────────────────── */
body.login-page {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 50%, #0f172a 100%);
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
}
.login-card {
  background: rgba(255,255,255,.97); border-radius: 20px;
  box-shadow: 0 25px 50px rgba(0,0,0,.4);
  padding: 2.5rem; width: 100%; max-width: 420px;
}
.login-logo {
  width: 56px; height: 56px; background: var(--primary);
  border-radius: 16px; display: grid; place-items: center;
  font-size: 1.5rem; color: #fff; margin: 0 auto 1rem;
}

/* ─── Utilities ──────────────────────────────────────────── */
.text-primary-custom { color: var(--primary); }
.bg-primary-light { background: var(--primary-light); }
.rounded-xl { border-radius: 12px !important; }
.rounded-2xl { border-radius: 16px !important; }
.transition { transition: all .2s ease; }
.cursor-pointer { cursor: pointer; }
.shadow-card { box-shadow: var(--card-shadow); }
.notif-dropdown { border-radius: 12px; border: 1px solid var(--border); }
