/* ════════════════════════════════════════════════════════════
   CoreTech Unified Portal — Premium Stylesheet v2
   Bootstrap 5 base · Dark sidebar · Responsive layout
   ════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --ct-sidebar-width: 256px;
  --ct-sidebar-bg:         #0a1628;
  --ct-sidebar-hover:      rgba(255,255,255,0.07);
  --ct-sidebar-active-bg:  linear-gradient(90deg,#1a56db,#0ea5e9);
  --ct-sidebar-text:       #8ba3be;
  --ct-sidebar-heading:    #3d5a78;
  --ct-topnav-bg:          #0d1f35;
  --ct-topnav-height:      58px;
  --ct-primary:            #1a56db;
  --ct-primary-dark:       #1347c0;
  --ct-primary-light:      #eff6ff;
  --ct-accent:             #0ea5e9;
  --ct-body-bg:            #f0f4f8;
  --ct-card-bg:            #ffffff;
  --ct-card-border:        #e2e8f0;
  --ct-text:               #0f172a;
  --ct-text-muted:         #64748b;
  --ct-success:            #10b981;
  --ct-warning:            #f59e0b;
  --ct-danger:             #ef4444;
  --ct-transition:         0.22s ease;
  --ct-radius:             14px;
  --ct-shadow:             0 2px 12px rgba(0,0,0,0.07);
  --ct-shadow-lg:          0 8px 30px rgba(0,0,0,0.12);
}

/* ── RESET / BASE ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body.ct-body {
  background: var(--ct-body-bg);
  color: var(--ct-text);
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  font-size: 0.875rem;
  margin: 0;
  -webkit-font-smoothing: antialiased;
}

/* ── TOP NAV ────────────────────────────────────────────────────── */
.ct-topnav {
  background: var(--ct-topnav-bg) !important;
  height: var(--ct-topnav-height);
  z-index: 1040;
  box-shadow: 0 1px 0 rgba(255,255,255,0.04), 0 2px 16px rgba(0,0,0,0.35);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.ct-brand-icon {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--ct-primary), var(--ct-accent));
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1rem;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(26,86,219,0.4);
}

.navbar-brand { font-size: 0.95rem; letter-spacing: -0.01em; }
.ct-role-badge { font-size: 0.63rem; color: var(--ct-accent); font-weight: 500; }

.ct-badge {
  position: absolute; top: 4px; right: 4px;
  background: #ef4444; color: #fff;
  border-radius: 50%; width: 17px; height: 17px;
  font-size: 0.6rem; display: flex; align-items: center; justify-content: center;
  font-weight: 700; border: 2px solid var(--ct-topnav-bg);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.4); }
  50%       { box-shadow: 0 0 0 5px rgba(239,68,68,0); }
}

/* ── SIDEBAR ────────────────────────────────────────────────────── */
.ct-sidebar {
  position: fixed; top: var(--ct-topnav-height); left: 0; bottom: 0;
  width: var(--ct-sidebar-width);
  background: var(--ct-sidebar-bg);
  overflow: hidden;
  z-index: 1030;
  transition: transform var(--ct-transition);
  display: flex; flex-direction: column;
  border-right: 1px solid rgba(255,255,255,0.04);
}

/* ── SIDEBAR USER CARD ──────────────────────────────────────────── */
.ct-sidebar-user-card {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 1rem 0.85rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
  background: rgba(255,255,255,0.02);
}
.ct-sidebar-user-avatar {
  position: relative; flex-shrink: 0;
}
.ct-user-avatar-img {
  width: 44px; height: 44px;
  border-radius: 12px;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.12);
}
.ct-user-status-dot {
  position: absolute; bottom: 2px; right: 2px;
  width: 10px; height: 10px;
  background: #10b981;
  border-radius: 50%;
  border: 2px solid var(--ct-sidebar-bg);
}
.ct-sidebar-user-info { flex: 1; min-width: 0; }
.ct-sidebar-user-name {
  font-size: 0.82rem; font-weight: 700;
  color: #fff; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ct-sidebar-user-role {
  font-size: 0.7rem; font-weight: 500;
  display: flex; align-items: center; gap: 0.3rem;
  margin-top: 0.15rem;
}
.ct-user-settings-btn {
  width: 28px; height: 28px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ct-sidebar-text);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  text-decoration: none; flex-shrink: 0;
  font-size: 0.85rem;
  transition: all 0.18s;
}
.ct-user-settings-btn:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

/* ── SIDEBAR SCROLL ─────────────────────────────────────────────── */
.ct-sidebar-scroll { overflow-y: auto; flex: 1; padding: 0.5rem 0 1rem; }
.ct-sidebar-scroll::-webkit-scrollbar { width: 3px; }
.ct-sidebar-scroll::-webkit-scrollbar-track { background: transparent; }
.ct-sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 2px; }

/* ── SIDEBAR NAV ────────────────────────────────────────────────── */
.ct-sidebar-nav { list-style: none; margin: 0; padding: 0 0.6rem; }

.ct-sidebar-section {
  font-size: 0.58rem; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ct-sidebar-heading);
  padding: 1rem 0.6rem 0.3rem;
  user-select: none;
}

.ct-nav-link {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.55rem 0.75rem;
  color: var(--ct-sidebar-text);
  text-decoration: none;
  border-radius: 10px;
  font-size: 0.83rem; font-weight: 500;
  transition: background var(--ct-transition), color var(--ct-transition), transform 0.15s;
  margin-bottom: 1px;
  position: relative;
}
.ct-nav-link i {
  font-size: 0.95rem; width: 1.1rem;
  text-align: center; flex-shrink: 0;
  transition: transform 0.2s;
}
.ct-nav-link:hover {
  background: var(--ct-sidebar-hover);
  color: #e2edf7;
  transform: translateX(2px);
}
.ct-nav-link:hover i { transform: scale(1.1); }
.ct-nav-link.active {
  background: linear-gradient(90deg, rgba(26,86,219,0.85), rgba(14,165,233,0.7));
  color: #fff;
  box-shadow: 0 2px 8px rgba(26,86,219,0.35);
}
.ct-nav-link.active i { transform: none; }
.ct-nav-logout { color: #f87171; }
.ct-nav-logout:hover { background: rgba(239,68,68,0.1); color: #ef4444; }

/* ── MAIN WRAPPER ───────────────────────────────────────────────── */
.ct-main-wrapper {
  margin-left: var(--ct-sidebar-width);
  padding-top: var(--ct-topnav-height);
  min-height: 100vh;
  transition: margin-left var(--ct-transition);
}

/* ── SIDEBAR OVERLAY (mobile) ───────────────────────────────────── */
.ct-sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(2px);
  z-index: 1020;
}

/* ── RESPONSIVE ─────────────────────────────────────────────────── */
@media (max-width: 991.98px) {
  .ct-sidebar { transform: translateX(-100%); }
  .ct-sidebar.open { transform: translateX(0); }
  .ct-main-wrapper { margin-left: 0 !important; }
  .ct-sidebar-overlay.show { display: block; }
  .ct-topnav .ct-sidebar-toggle { display: flex !important; }
}
@media (min-width: 992px) {
  .ct-topnav .ct-sidebar-toggle { display: none !important; }
  body.sidebar-collapsed .ct-sidebar { transform: translateX(-100%); }
  body.sidebar-collapsed .ct-main-wrapper { margin-left: 0; }
}

/* ── NOTIFICATION DROPDOWN ──────────────────────────────────────── */
.ct-notif-dropdown {
  box-shadow: 0 12px 40px rgba(0,0,0,0.18);
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  overflow: hidden;
}
.ct-notif-list { max-height: 340px; overflow-y: auto; }
.ct-notif-item {
  display: flex; align-items: flex-start; gap: 0.75rem;
  padding: 0.75rem 1rem; border-bottom: 1px solid #f1f5f9;
  transition: background 0.15s; cursor: pointer;
}
.ct-notif-item:hover { background: #f8fafc; }
.ct-notif-item.unread { background: #eff6ff; }
.ct-notif-icon {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 1rem;
}

/* ── CARDS ──────────────────────────────────────────────────────── */
.ct-card {
  background: var(--ct-card-bg);
  border: 1px solid var(--ct-card-border);
  border-radius: var(--ct-radius);
  box-shadow: var(--ct-shadow);
  transition: box-shadow 0.2s;
}
.ct-card:hover { box-shadow: var(--ct-shadow-lg); }

.ct-stat-card {
  background: var(--ct-card-bg);
  border: 1px solid var(--ct-card-border);
  border-radius: var(--ct-radius);
  padding: 1.25rem;
  display: flex; align-items: center; gap: 1rem;
  transition: box-shadow var(--ct-transition), transform var(--ct-transition);
  box-shadow: var(--ct-shadow);
}
.ct-stat-card:hover { box-shadow: var(--ct-shadow-lg); transform: translateY(-2px); }
.ct-stat-icon {
  width: 52px; height: 52px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; flex-shrink: 0;
}
.ct-stat-label { font-size: 0.75rem; color: var(--ct-text-muted); font-weight: 500; }
.ct-stat-value { font-size: 1.7rem; font-weight: 800; line-height: 1; color: var(--ct-text); letter-spacing: -0.03em; }

/* ── PAGE HEADER ─────────────────────────────────────────────────── */
.ct-page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem; flex-wrap: wrap; gap: 0.75rem;
}
.ct-page-title { font-size: 1.25rem; font-weight: 700; margin: 0; color: var(--ct-text); letter-spacing: -0.02em; }
.ct-page-subtitle { font-size: 0.8rem; color: var(--ct-text-muted); margin: 0.2rem 0 0; }

/* ── BUTTONS ─────────────────────────────────────────────────────── */
.btn-primary { background: var(--ct-primary); border-color: var(--ct-primary); font-weight: 600; border-radius: 9px; }
.btn-primary:hover { background: var(--ct-primary-dark); border-color: var(--ct-primary-dark); }
.btn { border-radius: 9px; font-weight: 500; }

/* ── TABLES ──────────────────────────────────────────────────────── */
.table-hover > tbody > tr:hover > * { background-color: #f8fafc; }
.table th {
  font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ct-text-muted);
  border-bottom: 2px solid var(--ct-card-border);
}

/* ── AUTH PAGE ───────────────────────────────────────────────────── */
.ct-auth-wrapper {
  min-height: 100vh;
  background: linear-gradient(135deg, #0a1628 0%, #0f3166 50%, #0a1e3d 100%);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.ct-auth-card {
  background: #fff; border-radius: 20px;
  padding: 2.5rem; width: 100%; max-width: 440px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.35);
}
.ct-auth-logo { text-align: center; margin-bottom: 2rem; }
.ct-auth-logo .ct-brand-icon { width: 56px; height: 56px; font-size: 1.8rem; margin: 0 auto 0.75rem; }

/* ── ORG CHART ───────────────────────────────────────────────────── */
.ct-orgchart-node {
  display: inline-flex; flex-direction: column; align-items: center;
  background: #fff; border: 2px solid #e2e8f0; border-radius: 14px;
  padding: 0.75rem 1rem; min-width: 140px;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}
.ct-orgchart-node:hover {
  border-color: var(--ct-primary);
  box-shadow: 0 4px 18px rgba(26,86,219,0.18);
  transform: translateY(-2px);
}
.ct-orgchart-node img { border: 2px solid var(--ct-card-border); }

/* ── CHAT ────────────────────────────────────────────────────────── */
.ct-chat-layout {
  display: flex; height: calc(100vh - var(--ct-topnav-height) - 120px);
  border: 1px solid var(--ct-card-border); border-radius: var(--ct-radius);
  overflow: hidden; background: #fff;
}
.ct-chat-sidebar { width: 280px; border-right: 1px solid var(--ct-card-border); display: flex; flex-direction: column; flex-shrink: 0; }
.ct-chat-body { flex: 1; display: flex; flex-direction: column; }
.ct-chat-messages { flex: 1; overflow-y: auto; padding: 1rem; }
.ct-chat-input { border-top: 1px solid var(--ct-card-border); padding: 0.75rem; }
.ct-bubble { max-width: 70%; padding: 0.6rem 0.9rem; border-radius: 14px; margin-bottom: 0.5rem; font-size: 0.88rem; }
.ct-bubble.me { background: var(--ct-primary); color: #fff; border-bottom-right-radius: 4px; }
.ct-bubble.them { background: #f1f5f9; color: var(--ct-text); border-bottom-left-radius: 4px; }
.ct-chat-contact { padding: 0.75rem 1rem; display: flex; align-items: center; gap: 0.75rem; cursor: pointer; transition: background 0.15s; }
.ct-chat-contact:hover { background: #f8fafc; }
.ct-chat-contact.active { background: #eff6ff; }

/* ── FORM BUILDER ────────────────────────────────────────────────── */
.ct-field-card {
  background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px;
  padding: 1rem; margin-bottom: 0.75rem; cursor: grab; transition: box-shadow 0.15s;
}
.ct-field-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
.ct-field-card.dragging { opacity: 0.5; }

/* ── BADGES ──────────────────────────────────────────────────────── */
.badge { font-size: 0.7rem; font-weight: 600; padding: 0.3em 0.65em; border-radius: 6px; }

/* ── OFFER LETTER ────────────────────────────────────────────────── */
.ct-offer-preview {
  max-width: 780px; margin: 0 auto; background: #fff;
  padding: 3rem; border: 1px solid #e2e8f0; border-radius: 10px; line-height: 1.7;
}
.ct-offer-preview h1 { color: var(--ct-primary); }

/* ── AVATAR GROUP ────────────────────────────────────────────────── */
.ct-avatar-group { display: flex; }
.ct-avatar-group img { margin-left: -8px; border: 2px solid #fff; border-radius: 50%; }
.ct-avatar-group img:first-child { margin-left: 0; }

/* ── ALERTS / FLASH ──────────────────────────────────────────────── */
.alert { border-radius: 10px; border: none; font-size: 0.85rem; }
.alert-success { background: #ecfdf5; color: #065f46; }
.alert-danger  { background: #fef2f2; color: #991b1b; }
.alert-warning { background: #fffbeb; color: #92400e; }
.alert-info    { background: #eff6ff; color: #1e40af; }

/* ── MISC ────────────────────────────────────────────────────────── */
.text-primary   { color: var(--ct-primary) !important; }
.bg-primary     { background-color: var(--ct-primary) !important; }
.border-primary { border-color: var(--ct-primary) !important; }
a.text-primary:hover { color: var(--ct-primary-dark) !important; }

.dataTables_wrapper .dataTables_filter input {
  border-radius: 9px; border: 1px solid #e2e8f0;
  padding: 0.3rem 0.75rem; font-size: 0.83rem;
}
.dataTables_wrapper .dataTables_length select {
  border-radius: 9px; border: 1px solid #e2e8f0;
}

.ct-empty { text-align: center; padding: 3rem 1rem; color: var(--ct-text-muted); }
.ct-empty i { font-size: 2.5rem; display: block; margin-bottom: 0.75rem; opacity: 0.5; }

.profile-pic-preview {
  width: 90px; height: 90px; border-radius: 50%;
  object-fit: cover; border: 3px solid var(--ct-card-border);
}

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

/* ── RESPONSIVE UTILITIES ────────────────────────────────────────── */
@media (max-width: 575.98px) {
  .container-fluid { padding: 1rem !important; }
  .ct-stat-value { font-size: 1.35rem; }
  .ct-auth-card { padding: 1.5rem; }
  .ct-chat-layout { height: calc(100vh - var(--ct-topnav-height) - 90px); }
  .ct-chat-sidebar { display: none; }
  .ct-chat-sidebar.show { display: flex; width: 100%; position: absolute; z-index: 10; height: 100%; background: #fff; }
}

/* ── SMOOTH PAGE TRANSITIONS ─────────────────────────────────────── */
.ct-main-wrapper > .container-fluid {
  animation: fadeInUp 0.3s ease both;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
