/* ============================================================
   PRM System – Custom Stylesheet
   ============================================================ */

/* --- Variables --- */
:root {
  --sidebar-width: 240px;
  --navbar-height: 56px;
}

/* --- Body & Layout --- */
body {
  font-family: 'Segoe UI', 'Noto Sans Thai', sans-serif;
  font-size: .9rem;
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  min-height: calc(100vh - var(--navbar-height));
  background: #1a2332;
  color: #b0bec5;
  position: sticky;
  top: var(--navbar-height);
  overflow-y: auto;
  overflow-x: hidden;
  transition: width .25s ease;
  flex-shrink: 0;
}

/* Desktop collapsed sidebar */
.sidebar.collapsed {
  width: 60px;
}
.sidebar.collapsed .sidebar-heading,
.sidebar.collapsed .nav-link span {
  display: none;
}
.sidebar.collapsed .nav-link {
  justify-content: center;
  padding: .5rem 0;
  margin: 1px 6px;
}
.sidebar.collapsed .nav-link i {
  width: auto;
  font-size: .95rem;
  margin: 0;
}

.sidebar .nav-link {
  color: #b0bec5;
  padding: .45rem .9rem;
  border-radius: 6px;
  margin: 1px 8px;
  font-size: .83rem;
  transition: all .15s;
  display: flex;
  align-items: center;
  gap: .55rem;
}

.sidebar .nav-link:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
}

.sidebar .nav-link.active {
  background: #0d6efd;
  color: #fff;
}

.sidebar .nav-link i {
  width: 18px;
  text-align: center;
  font-size: .82rem;
}

.sidebar-heading {
  font-size: .68rem;
  letter-spacing: .08em;
  padding: .7rem 1rem .2rem;
}

/* --- Sidebar collapsed (mobile) --- */
@media (max-width: 991.98px) {
  .sidebar {
    position: fixed;
    top: var(--navbar-height);
    left: -100%;
    z-index: 1040;
    height: calc(100vh - var(--navbar-height));
    transition: left .25s ease;
  }

  .sidebar.open {
    left: 0;
  }

  #mainContent {
    width: 100%;
  }
}

/* --- Main Content --- */
#mainContent {
  min-height: calc(100vh - var(--navbar-height));
  max-width: calc(100vw - var(--sidebar-width));
}

@media (max-width: 991.98px) {
  #mainContent { max-width: 100vw; }
}

/* --- Cards --- */
.card { border-radius: 10px; }
.card-header { border-radius: 10px 10px 0 0 !important; font-size: .88rem; }

/* --- Stat Icon --- */
.stat-icon { width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; }

/* --- Kanban --- */
.kanban-wrapper { -webkit-overflow-scrolling: touch; }
.kanban-col     { user-select: none; }
.kanban-card    { cursor: grab; transition: box-shadow .15s; }
.kanban-card:active { cursor: grabbing; }
.kanban-card:hover  { box-shadow: 0 4px 16px rgba(0,0,0,.12) !important; }
.sortable-ghost     { opacity: .4; }

/* --- Tables --- */
.table-responsive { border-radius: 0 0 10px 10px; overflow: hidden; }
.table > :not(caption) > * > * { padding: .6rem .75rem; }
.table-hover > tbody > tr:hover { background: rgba(13,110,253,.04); }

/* --- Badges --- */
.badge { font-weight: 500; }

/* --- Forms --- */
.form-control:focus, .form-select:focus {
  border-color: #0d6efd;
  box-shadow: 0 0 0 3px rgba(13,110,253,.15);
}

/* --- Alerts --- */
.alert { border-radius: 8px; font-size: .875rem; }

/* --- Pagination --- */
.page-link { border-radius: 6px !important; margin: 0 2px; }

/* --- Progress --- */
.progress { border-radius: 10px; overflow: hidden; }

/* --- Buttons --- */
.btn-xs { font-size: .72rem; padding: .1rem .4rem; border-radius: 4px; }

/* --- Avatar placeholder --- */
.avatar-placeholder { font-size: .875rem; }

/* --- Login Page --- */
.login-card { animation: fadeUp .4s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* --- Notification dropdown --- */
.dropdown-menu { border-radius: 10px; border: none; box-shadow: 0 8px 30px rgba(0,0,0,.12); }

/* --- Dark sidebar toggle overlay --- */
#sidebarOverlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 1039;
}

/* --- Deal countdown badge --- */
.countdown-badge { animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.6} }

/* --- Scrollbar styling (Webkit) --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 10px; }
::-webkit-scrollbar-thumb { background: #c1c1c1; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #a8a8a8; }

/* --- Print --- */
@media print {
  .sidebar, #mainNavbar, .btn, .modal { display: none !important; }
  #mainContent { max-width: 100%; padding: 0; }
}
