/* =============================================
   TicketSystem – Admin Panel Styles
   ============================================= */

:root {
  --sidebar-width: 280px;
  --sidebar-bg: #1a2035;
  --sidebar-hover: rgba(255, 255, 255, 0.07);
  --sidebar-active-bg: rgba(78, 110, 242, 0.2);
  --sidebar-active-border: #4e6ef2;
  --topbar-height: 58px;
  --body-bg: #f4f6fb;
  --card-radius: 12px;
  --accent: #4e6ef2;
}

/* ---- Base ---- */
body {
  background-color: var(--body-bg);
  font-family: Poppins, Helvetica, sans-serif;
  font-size: 0.9rem;
  color: #2d3748;
}

a {
  text-decoration: none;
}

/* ---- Sidebar ---- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  z-index: 1040;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-brand {
  padding: 1.2rem 1.5rem;
  color: #fff;
  font-size: 1.15rem;
  /* font-weight: 700; */
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  white-space: nowrap;
}

.sidebar-brand .brand-icon {
  width: 34px;
  height: 34px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.sidebar-nav {
  padding: 0.75rem 0;
  flex: 1;
}

.nav-section-label {
  padding: 0.75rem 1.5rem 0.3rem;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.35);
  font-weight: 600;
}

.sidebar-nav .nav-link {
  color: rgba(255, 255, 255, 0.65);
  padding: 0.6rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  transition: all 0.18s ease;
  border-left: 3px solid transparent;
  white-space: nowrap;
}

.sidebar-nav .nav-link:hover {
  color: #fff;
  background: var(--sidebar-hover);
}

.sidebar-nav .nav-link.active {
  color: #fff;
  background: var(--sidebar-active-bg);
  border-left-color: var(--sidebar-active-border);
}

.sidebar-nav .nav-link i {
  width: 18px;
  text-align: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.sidebar-nav .nav-link .badge {
  margin-left: auto;
  font-size: 0.65rem;
}

/* Sidebar user footer */
.sidebar-user {
  padding: 0.9rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-user .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
  line-height: normal;
}

.sidebar-user .user-name {
  color: #fff;
  font-size: 0.855rem;
  font-weight: 600;
  line-height: 1.2;
}

.sidebar-user .user-role {
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.73rem;
}

.sidebar-user .logout-btn {
  margin-left: auto;
  color: rgba(255, 255, 255, 0.4);
  transition: color 0.15s;
}

.sidebar-user .logout-btn:hover {
  color: #ef4444;
}

/* ---- Main wrapper ---- */
.main-wrapper {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- Hamburger toggle ---- */
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  padding: 0.4rem 0.5rem;
  cursor: pointer;
  color: #374151;
  border-radius: 8px;
  transition: background 0.15s;
  flex-shrink: 0;
  line-height: 1;
}
.sidebar-toggle:hover {
  background: #f0f0f5;
}
.sidebar-toggle .fa-bars {
  color: currentColor;
  font-size: 1.5em;
}

/* ---- Sidebar overlay (mobile) ---- */
#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1039;
  backdrop-filter: blur(1px);
  -webkit-backdrop-filter: blur(1px);
}
#sidebar-overlay.active {
  display: block;
}

/* ---- Topbar ---- */
.topbar {
  height: var(--topbar-height);
  background: #fff;
  border-bottom: 1px solid #e5e9f0;
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  position: sticky;
  top: 0;
  z-index: 1020;
  gap: 0.75rem;
}

.topbar-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: #1e2a3a;
  flex: 1;
  line-height: 1.2;
}

.topbar-title .breadcrumb-sep {
  color: #bbb;
  margin: 0 0.4rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* ---- Main content ---- */
.main-content {
  flex: 1;
  padding: 1.75rem;
}

.page-header {
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.page-header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: #1e2a3a;
  margin: 0;
}

.page-header .page-subtitle {
  font-size: 0.85rem;
  color: #6b7280;
  margin-top: 0.2rem;
}

/* ---- Stat cards ---- */
.stat-card {
  border: none;
  border-radius: var(--card-radius);
  background: #fff;
  box-shadow:
    0 1px 6px rgba(0, 0, 0, 0.06),
    0 4px 12px rgba(0, 0, 0, 0.03);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: box-shadow 0.2s;
}

.stat-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.stat-icon {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
}

.stat-icon.blue {
  background: #eff6ff;
  color: #3b82f6;
}
.stat-icon.purple {
  background: #f5f3ff;
  color: #8b5cf6;
}
.stat-icon.amber {
  background: #fffbeb;
  color: #f59e0b;
}
.stat-icon.green {
  background: #f0fdf4;
  color: #10b981;
}
.stat-icon.red {
  background: #fef2f2;
  color: #ef4444;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: #1e2a3a;
  line-height: 1;
}

.stat-label {
  font-size: 0.8rem;
  color: #6b7280;
  margin-top: 0.2rem;
}

/* ---- Data card (table wrapper) ---- */
.data-card {
  border: none;
  border-radius: var(--card-radius);
  background: #fff;
  box-shadow:
    0 1px 6px rgba(0, 0, 0, 0.06),
    0 4px 12px rgba(0, 0, 0, 0.03);
  overflow: hidden;
}

/* Padding for filter/content sections inside a data-card (no table) */
.data-card-filters {
  padding: 1rem 1.25rem;
}

.data-card .card-header {
  background: #fff;
  border-bottom: 1px solid #f0f0f5;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.data-card .card-header h5 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
  flex: 1;
}

.table {
  margin: 0;
}

.table th {
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9ca3af;
  font-weight: 600;
  border-top: none;
  padding: 0.65rem 1.25rem;
  white-space: nowrap;
}

.table td {
  padding: 0.75rem 1.25rem;
  vertical-align: middle;
  border-color: #f5f5f8;
}

.table tbody tr:hover {
  background-color: #fafbfd;
}

/* Clickable rows */
.table tbody tr.clickable-row {
  cursor: pointer;
}

/* Action button cells — prevent wrapping and normalise spacing.
   Overrides Bootstrap's me-1 on the first button so gap is always
   applied symmetrically via an adjacent-sibling rule instead. */
.table td.text-end,
.table td.text-center {
  white-space: nowrap;
}

.table td .btn.me-1 {
  margin-right: 0;
}

.table td .btn + .btn {
  margin-left: 0.25rem;
}

/* ---- Badges ---- */
.badge-severity-low {
  background-color: #10b981;
}
.badge-severity-medium {
  background-color: #f59e0b;
}
.badge-severity-high {
  background-color: #ef4444;
}

.sev-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  vertical-align: middle;
  flex-shrink: 0;
  margin-right: 5px;
}
.sev-dot-low    { background-color: #10b981; }
.sev-dot-medium { background-color: #f59e0b; }
.sev-dot-high   { background-color: #ef4444; }

.badge-open {
  background-color: #3b82f6;
}
.badge-pending {
  background-color: #8b5cf6;
}
.badge-closed {
  background-color: #6b7280;
}
.badge-resolved {
  background-color: #10b981;
}
.badge-new {
  background-color: #f59e0b;
  color: #1a1a1a !important;
}

/* ---- Ticket thread ---- */
.ticket-info-card {
  border: none;
  border-radius: var(--card-radius);
  background: #fff;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
  padding: 1.25rem;
}

.thread-message {
  border-radius: var(--card-radius);
  background: #fff;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.05);
  margin-bottom: 1.1rem;
  overflow: hidden;
}

.thread-message.from-client {
  border-left: 4px solid #3b82f6;
}
.thread-message.from-admin {
  border-left: 4px solid #10b981;
}

.message-header {
  padding: 0.65rem 1rem;
  background: #f9fafb;
  border-bottom: 1px solid #f0f0f5;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.message-header .sender-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.message-header .sender-name {
  font-weight: 600;
  font-size: 0.875rem;
}
.message-header .message-date {
  color: #9ca3af;
  font-size: 0.78rem;
  margin-left: auto;
}

.message-body {
  padding: 1rem;
  line-height: 1.65;
}

.message-attachments {
  padding: 0.5rem 1rem 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  background: #f0f4ff;
  border: 1px solid #c7d7ff;
  border-radius: 6px;
  font-size: 0.78rem;
  color: #3b5bdb;
  cursor: pointer;
  transition: background 0.15s;
}

.attachment-chip:hover {
  background: #dce6ff;
}

.message-footer {
  padding: 0.5rem 1rem;
  border-top: 1px solid #f5f5f8;
  background: #fafafa;
}

.time-log-entry {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
  font-size: 0.82rem;
  margin-bottom: 0.35rem;
}

.time-log-entry .time-badge {
  background: #10b981;
  color: #fff;
  border-radius: 5px;
  padding: 0.1rem 0.4rem;
  font-weight: 600;
  white-space: nowrap;
  font-size: 0.78rem;
}

/* ---- Reply box ---- */
.reply-card {
  border: none;
  border-radius: var(--card-radius);
  background: #fff;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
  padding: 1.5rem;
  margin-top: 1.25rem;
}

/* ---- Report preview ---- */
.report-section-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 2rem 0 1.25rem;
  color: #6b7280;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.report-section-divider::before,
.report-section-divider::after {
  content: "";
  flex: 1;
  height: 2px;
  background: linear-gradient(to right, #e5e9f0, #c9d3e8);
  border-radius: 2px;
}

.report-section-divider::before {
  background: linear-gradient(to right, #e5e9f0, #c9d3e8);
  max-width: 2rem;
}

.report-preview {
  background: #fff;
  border: 1px solid #e5e9f0;
  border-radius: var(--card-radius);
  padding: 2rem;
  font-size: 0.88rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

.report-preview .report-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.report-client-section {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 2px solid #e5e9f0;
}

.report-client-section h5 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.report-ticket {
  background: #f8f9fc;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.6rem;
}

/* ---- Login page ---- */
.login-wrapper {
  min-height: 100vh;
  background: linear-gradient(135deg, #1a2035 0%, #2d3a6e 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-logo {
  width: 56px;
  height: 56px;
  background: var(--accent);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: #fff;
  margin: 0 auto 1.25rem;
}

/* ---- Accordion (client groups) ---- */
.client-accordion .accordion-item {
  border: none;
  border-radius: var(--card-radius) !important;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
  margin-bottom: 0.75rem;
  overflow: hidden;
}

.client-accordion .accordion-button {
  font-weight: 600;
  font-size: 0.9rem;
  background: #fff;
}

.client-accordion .accordion-button:not(.collapsed) {
  background: #f0f4ff;
  color: var(--accent);
  box-shadow: none;
}

.client-accordion .accordion-body {
  padding: 0;
}

/* ---- Form styles ---- */
.form-section {
  border: none;
  border-radius: var(--card-radius);
  background: #fff;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.form-section-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9ca3af;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #f0f0f5;
}

/* ---- Responsive / Mobile-first ---- */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-wrapper {
    margin-left: 0;
  }
  .sidebar-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  /* Content padding */
  .main-content {
    padding: 1rem;
  }

  /* Page header stacks on tiny screens */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
  }

  /* Stat cards: 2-up on small, 1-up on tiny */
  .stat-card {
    padding: 1rem;
  }
  .stat-value {
    font-size: 1.4rem;
  }

  /* Tables: horizontal scroll instead of overflow */
  .table-responsive {
    -webkit-overflow-scrolling: touch;
  }

  /* Hide less important table columns on mobile */
  .table .col-hide-mobile {
    display: none;
  }

  /* Touch-friendly table rows */
  .table td,
  .table th {
    padding: 0.7rem 0.85rem;
  }

  /* Reduce accordion padding */
  .client-accordion .accordion-button {
    padding: 0.75rem 1rem;
    font-size: 0.855rem;
  }

  /* Reply/form cards */
  .reply-card {
    padding: 1rem;
  }
  .form-section {
    padding: 1rem;
  }

  /* Topbar title shorter on small screens */
  .topbar-title {
    font-size: 0.95rem;
  }
  .topbar-title .breadcrumb-sep {
    display: block;
    height: 0;
  }

  /* report preview */
  .report-preview {
    padding: 1rem;
  }
}

@media (max-width: 575.98px) {
  .main-content {
    padding: 0.75rem;
  }
  /* Full-width action buttons on tiny screens */
  .topbar-actions .btn {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
  }
  /* Inline table action buttons: compact on tiny screens */
  .table .btn-outline-primary,
  .table .btn-outline-secondary,
  .table .btn-outline-danger {
    padding: 0.3rem 0.5rem;
    font-size: 0.78rem;
  }
}

/* =============================================
   Theme colour swatch picker (client-edit.html)
   ============================================= */
.theme-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.theme-swatch-item {
  position: relative;
}

.theme-swatch-item input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.theme-swatch-item .swatch-dot {
  display: block;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid transparent;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
  transition:
    transform 0.15s,
    box-shadow 0.15s;
  cursor: pointer;
}

.theme-swatch-item input:checked + .swatch-dot {
  box-shadow:
    0 0 0 2px #fff,
    0 0 0 4px currentColor;
  transform: scale(1.18);
}

.theme-swatch-item .swatch-dot:hover {
  transform: scale(1.1);
}

/* ── Settings page tabs ───────────────────────────────────── */
.settings-tab-body {
  border: 1px solid #dee2e6;
  border-top: none;
  border-radius: 0 0 10px 10px;
  padding: 1.25rem;
  background: #fff;
  margin-bottom: 0.5rem;
}

.nav-tabs .nav-link {
  padding: 0.5rem 0.75rem;
}
