/* =============================================
   GRSSL IMS — Modern UI Theme
   ============================================= */

:root {
  --sidebar-width: 240px;
  --topbar-height: 60px;
  --primary:   #4f46e5;
  --primary-dk:#3730a3;
  --success:   #10b981;
  --warning:   #f59e0b;
  --danger:    #ef4444;
  --info:      #3b82f6;
  --dark:      #0f172a;
  --surface:   #ffffff;
  --bg:        #f1f5f9;
  --border:    #e2e8f0;
  --text:      #1e293b;
  --muted:     #64748b;
  --radius:    12px;
  --shadow:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

/* ── TOPBAR ─────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-height);
  background: var(--dark);
  display: flex;
  align-items: center;
  padding: 0 20px;
  z-index: 1000;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.topbar-brand img {
  height: 32px;
  object-fit: contain;
  display: block;
}
.topbar-divider {
  width: 1px;
  height: 28px;
  background: rgba(255,255,255,.12);
}
.topbar-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
}
.topbar-nav a {
  color: rgba(255,255,255,.7);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all .15s;
  white-space: nowrap;
}
.topbar-nav a:hover,
.topbar-nav a.active {
  color: #fff;
  background: rgba(255,255,255,.1);
}
.topbar-nav .dropdown { position: relative; }
.topbar-nav .dropdown-toggle::after {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  margin-left: 4px;
  vertical-align: middle;
  margin-top: -3px;
}
.topbar-nav .dropdown-menu {
  position: absolute;
  top: 100%;          /* flush — no gap, padding-top creates safe zone */
  left: 0;
  padding-top: 8px;   /* safe hover bridge between trigger and menu */
  background: transparent;
  border: none;
  min-width: 210px;
  display: none;
  z-index: 9999;
  pointer-events: none;
}
.topbar-nav .dropdown-menu.open {
  display: block;
  pointer-events: all;
}
.topbar-nav .dropdown-menu-inner {
  background: #1e293b;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
  padding: 6px;
  box-shadow: var(--shadow-lg);
}
.topbar-nav .dropdown-menu a {
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255,255,255,.75);
  text-decoration: none;
  transition: all .15s;
}
.topbar-nav .dropdown-menu a:hover { background: rgba(255,255,255,.08); color: #fff; }
.topbar-nav .dropdown-menu hr {
  border: none;
  border-top: 1px solid rgba(255,255,255,.08);
  margin: 4px 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.topbar-btn {
  background: rgba(255,255,255,.08);
  border: none;
  color: rgba(255,255,255,.8);
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
  font-size: 14px;
}
.topbar-btn:hover { background: rgba(255,255,255,.15); color: #fff; }
.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255,255,255,.9);
  cursor: pointer;
  padding: 4px 10px 4px 4px;
  border-radius: 10px;
  transition: background .15s;
  position: relative;
}
.topbar-user:hover { background: rgba(255,255,255,.08); }
.topbar-avatar {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
}
.topbar-user-info { line-height: 1.2; }
.topbar-user-name { font-size: 13px; font-weight: 600; color: #fff; }
.topbar-user-role { font-size: 11px; color: rgba(255,255,255,.5); }
.user-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  padding-top: 8px;
  background: transparent;
  border: none;
  min-width: 180px;
  display: none;
  z-index: 9999;
  pointer-events: none;
}
.user-dropdown.open {
  display: block;
  pointer-events: all;
}
.user-dropdown-inner {
  background: #1e293b;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
  padding: 6px;
  box-shadow: var(--shadow-lg);
}
.user-dropdown a {
  color: rgba(255,255,255,.75);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all .15s;
}
.user-dropdown a:hover { background: rgba(255,255,255,.08); color: #fff; }
.user-dropdown hr {
  border: none;
  border-top: 1px solid rgba(255,255,255,.08);
  margin: 4px 0;
}

/* ── PAGE WRAPPER ───────────────────────────── */
.page-wrapper {
  padding-top: var(--topbar-height);
  min-height: 100vh;
}
.page-content {
  padding: 28px 28px;
  max-width: 1400px;
  margin: 0 auto;
}

/* ── PAGE HEADER ────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}
.page-title i { color: var(--primary); font-size: 18px; }
.page-subtitle { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ── CARDS ──────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}
.card-header .card-title { margin: 0; font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-header .card-title i { color: var(--primary); }
.card-body { padding: 20px; }

/* ── STAT CARDS ─────────────────────────────── */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: box-shadow .2s, transform .2s;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.stat-icon.blue   { background: #eff6ff; color: #3b82f6; }
.stat-icon.yellow { background: #fffbeb; color: #f59e0b; }
.stat-icon.green  { background: #f0fdf4; color: #10b981; }
.stat-icon.red    { background: #fef2f2; color: #ef4444; }
.stat-icon.purple { background: #f5f3ff; color: #8b5cf6; }
.stat-icon.gray   { background: #f8fafc; color: #64748b; }
.stat-info { flex: 1; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text); line-height: 1; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 4px; font-weight: 500; }

/* ── TABLES ─────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.ims-table { width: 100%; border-collapse: collapse; }
table.ims-table thead th {
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  background: #f8fafc;
}
table.ims-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}
table.ims-table tbody tr:last-child td { border-bottom: none; }
table.ims-table tbody tr:hover { background: #f8fafc; }

/* ── BADGES ─────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
}
.badge-blue   { background:#eff6ff; color:#2563eb; }
.badge-yellow { background:#fffbeb; color:#d97706; }
.badge-green  { background:#f0fdf4; color:#059669; }
.badge-red    { background:#fef2f2; color:#dc2626; }
.badge-purple { background:#f5f3ff; color:#7c3aed; }
.badge-gray   { background:#f1f5f9; color:#475569; }

/* ── BUTTONS ────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all .15s;
  text-decoration: none;
  line-height: 1;
}
.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dk); color: #fff; }
.btn-success   { background: var(--success); color: #fff; }
.btn-success:hover { opacity: .9; color: #fff; }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover  { opacity: .9; color: #fff; }
.btn-warning   { background: var(--warning); color: #fff; }
.btn-warning:hover { opacity: .9; color: #fff; }
.btn-outline   { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--bg); color: var(--text); }
.btn-ghost     { background: transparent; color: var(--muted); border: none; }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { width: 32px; height: 32px; padding: 0; justify-content: center; }

/* ── FORMS ──────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  font-family: inherit;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}
.input-group { display: flex; }
.input-group .input-prefix {
  padding: 9px 12px;
  background: #f8fafc;
  border: 1.5px solid var(--border);
  border-right: none;
  border-radius: 8px 0 0 8px;
  color: var(--muted);
  display: flex;
  align-items: center;
  font-size: 14px;
}
.input-group .form-control { border-radius: 0 8px 8px 0; }

/* ── ALERTS ─────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid transparent;
}
.alert-danger  { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.alert-success { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.alert-info    { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }
.alert-warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }

/* ── PAGINATION ─────────────────────────────── */
.pagination { display: flex; gap: 4px; align-items: center; justify-content: center; margin-top: 16px; }
.pagination a, .pagination span {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  color: var(--muted);
  border: 1px solid var(--border);
  transition: all .15s;
}
.pagination a:hover { background: var(--bg); color: var(--text); }
.pagination .active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── LOGIN ──────────────────────────────────── */
.login-bg {
  min-height: 100vh;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #312e81 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 25px 50px rgba(0,0,0,.3);
  width: 100%;
  max-width: 420px;
  overflow: hidden;
}
.login-header {
  background: linear-gradient(135deg, #0f172a, #1e1b4b);
  padding: 36px 32px 28px;
  text-align: center;
}
.login-header img { height: 48px; object-fit: contain; }
.login-body { padding: 32px; }
.login-body .form-control { padding: 11px 14px; font-size: 14px; }
.login-body .btn-primary {
  width: 100%;
  justify-content: center;
  padding: 12px;
  font-size: 14px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dk));
}
.login-body .btn-primary:hover { opacity: .95; }

/* ── MISC ───────────────────────────────────── */
.text-muted { color: var(--muted) !important; }
.text-small { font-size: 12px; }
.fw-600 { font-weight: 600; }
.gap-2 { gap: 8px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
code.ticket-num {
  background: #f1f5f9;
  border: 1px solid var(--border);
  color: var(--primary);
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
}
.welcome-bar {
  background: linear-gradient(135deg, var(--primary), var(--primary-dk));
  border-radius: var(--radius);
  padding: 20px 24px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.welcome-bar h4 { font-size: 16px; font-weight: 700; margin: 0; }
.welcome-bar p  { font-size: 13px; opacity: .8; margin: 4px 0 0; }
.date-pill {
  background: rgba(255,255,255,.15);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

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

@media (max-width: 768px) {
  .page-content { padding: 16px; }
  .topbar-nav { display: none; }
  .stat-value { font-size: 22px; }
}

/* ── Bootstrap coexistence overrides ─────────── */
.container-fluid, .container { padding-top: 0 !important; }
.navbar { display: none !important; } /* hide any BS navbar remnants */

/* Make BS cards match our theme */
.card { border-radius: var(--radius) !important; border-color: var(--border) !important; }
.card-header { font-size: 14px !important; font-weight: 600 !important; }
.table { font-size: 13px !important; }
.table thead th { font-size: 11px !important; text-transform: uppercase; letter-spacing:.04em; color: var(--muted) !important; font-weight: 700 !important; background: #f8fafc !important; }
.btn { font-size: 13px !important; }
.form-control, .form-select { font-size: 13px !important; border-radius: 8px !important; }
.badge { font-size: 11px !important; }
h2, h3, h4, h5 { font-weight: 700 !important; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important; }
