/* ProMessage Console — UI layer on top of Bootstrap 5 */

:root {
  --pm-primary: #1c6fe6;
  --pm-primary-rgb: 28, 111, 230;
  --pm-primary-dark: #1558b8;
  --pm-surface: #f4f6f9;
  --pm-card-radius: 0.65rem;
  --pm-navbar-gradient: linear-gradient(135deg, #152642 0%, #0c1829 55%, #0a1424 100%);
  --pm-shadow-sm: 0 0.125rem 0.35rem rgba(15, 23, 42, 0.06);
  --pm-shadow-md: 0 0.35rem 1rem rgba(15, 23, 42, 0.08);
}

[data-bs-theme="light"] {
  --bs-primary: var(--pm-primary);
  --bs-primary-rgb: var(--pm-primary-rgb);
}

body.pm-app {
  background-color: var(--pm-surface);
  color: #1e293b;
}

/* ----- Navbar ----- */
.pm-navbar {
  background: var(--pm-navbar-gradient);
  box-shadow: var(--pm-shadow-md);
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
}

.pm-navbar .navbar-brand {
  font-weight: 600;
  letter-spacing: -0.02em;
  font-size: 1.1rem;
}

.pm-navbar .nav-link {
  border-radius: 0.375rem;
  padding: 0.45rem 0.75rem !important;
  margin: 0 0.1rem;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.pm-navbar .nav-link:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

.pm-navbar .nav-link.active {
  background-color: rgba(255, 255, 255, 0.14);
  font-weight: 500;
}

.pm-navbar .dropdown-toggle::after {
  margin-left: 0.35em;
}

/* ----- Main content ----- */
.pm-content {
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
}

.pm-page-title {
  font-weight: 600;
  letter-spacing: -0.03em;
  color: #0f172a;
  font-size: 1.65rem;
}

.pm-page-title i {
  color: var(--pm-primary);
  opacity: 0.9;
}

/* ----- Cards ----- */
.pm-card {
  border: none;
  border-radius: var(--pm-card-radius);
  box-shadow: var(--pm-shadow-sm);
  overflow: hidden;
}

.pm-card .card-header {
  background: #fff;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  font-weight: 600;
  padding: 0.85rem 1.25rem;
}

.pm-card .table {
  margin-bottom: 0;
}

.pm-card .table thead th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  color: #64748b;
  border-bottom-width: 1px;
  background-color: #f8fafc;
  white-space: nowrap;
}

.pm-card .table tbody td {
  vertical-align: middle;
  border-color: rgba(15, 23, 42, 0.06);
}

.pm-card .table tbody tr:last-child td {
  border-bottom: 0;
}

.pm-card .table-hover tbody tr:hover {
  background-color: rgba(var(--pm-primary-rgb), 0.04);
}

/* ----- Stat tiles (dashboard) ----- */
.pm-stat {
  border: none;
  border-radius: var(--pm-card-radius);
  box-shadow: var(--pm-shadow-sm);
  height: 100%;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.pm-stat:hover {
  box-shadow: var(--pm-shadow-md);
  transform: translateY(-2px);
}

.pm-stat .card-body {
  padding: 1.35rem 1.25rem;
}

.pm-stat-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  margin-bottom: 0.35rem;
}

.pm-stat-value {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: #0f172a;
}

.pm-stat-icon {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.pm-stat-icon-primary {
  background: rgba(var(--pm-primary-rgb), 0.12);
  color: var(--pm-primary);
}

.pm-stat-icon-info {
  background: rgba(13, 202, 240, 0.15);
  color: #0aa2c0;
}

.pm-stat-icon-success {
  background: rgba(25, 135, 84, 0.12);
  color: #198754;
}

/* ----- Definition lists (detail view, dl.row) ----- */
.pm-dl.row > dt {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #64748b;
  margin-bottom: 0;
}

.pm-dl.row > dd {
  margin-bottom: 0;
}

.pm-dl.row > dt:not(:first-of-type),
.pm-dl.row > dd:not(:first-of-type) {
  border-top: 1px solid rgba(15, 23, 42, 0.06);
  padding-top: 0.85rem;
  margin-top: 0;
}

/* ----- Login ----- */
.pm-login-body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: linear-gradient(160deg, #e8eef8 0%, #dce7f5 40%, #cfd9ea 100%);
}

.pm-login-body > .container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.pm-login-card {
  max-width: 420px;
  width: 100%;
}

.pm-login-card .card {
  border: none;
  border-radius: var(--pm-card-radius);
  box-shadow: 0 1rem 2.5rem rgba(15, 23, 42, 0.12);
}

.pm-login-brand {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 0.85rem;
  background: linear-gradient(145deg, var(--pm-primary) 0%, var(--pm-primary-dark) 100%);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.65rem;
  box-shadow: 0 0.35rem 1rem rgba(var(--pm-primary-rgb), 0.35);
}

.pm-login-divider {
  display: flex;
  align-items: center;
  margin: 1.5rem 0;
}

.pm-login-divider::before,
.pm-login-divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid rgba(15, 23, 42, 0.1);
}

.pm-login-divider span {
  padding: 0 0.85rem;
  color: #64748b;
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ----- Empty table state ----- */
.pm-empty {
  padding: 2.5rem 1rem !important;
}

.pm-empty-inner {
  color: #94a3b8;
  font-size: 0.95rem;
}

.pm-empty-inner i {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.5rem;
  opacity: 0.6;
}

/* ----- Forms ----- */
.pm-form-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  margin-bottom: 1rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

/* ----- Pagination ----- */
.pm-card .pagination .page-link {
  border-radius: 0.375rem;
  margin: 0 0.15rem;
  border: 1px solid rgba(15, 23, 42, 0.1);
  color: #334155;
}

.pm-card .pagination .page-item.active .page-link {
  background-color: var(--pm-primary);
  border-color: var(--pm-primary);
}

/* ----- Badges in headers ----- */
.pm-role-badge {
  font-weight: 500;
  padding: 0.4em 0.75em;
}

/* ----- Responsive ----- */

/* Tables: horizontal scroll on small screens */
.table-responsive {
  -webkit-overflow-scrolling: touch;
}

/* Stack action buttons vertically on mobile */
@media (max-width: 575.98px) {
  .pm-page-title {
    font-size: 1.3rem;
  }

  .pm-stat-value {
    font-size: 1.5rem;
  }

  .pm-stat-icon {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.2rem;
  }

  .pm-stat .card-body {
    padding: 1rem;
  }

  /* Admin form: stack all columns */
  .pm-card .card-body .row.g-3 > [class*="col-md-"] {
    flex: 0 0 100%;
    max-width: 100%;
  }

  /* Tighter card padding on mobile */
  .pm-card .card-body {
    padding: 0.85rem;
  }

  .pm-card .card-header {
    padding: 0.75rem 0.85rem;
    font-size: 0.9rem;
  }

  /* Detail view: full-width columns */
  .pm-dl.row > dt,
  .pm-dl.row > dd {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .pm-dl.row > dd {
    margin-bottom: 0.65rem;
  }

  .pm-dl.row > dt:not(:first-of-type),
  .pm-dl.row > dd:not(:first-of-type) {
    border-top: none;
    padding-top: 0;
  }

  .pm-dl.row > dt:not(:first-of-type) {
    border-top: 1px solid rgba(15, 23, 42, 0.06);
    padding-top: 0.85rem;
    margin-top: 0.25rem;
  }

  /* Button groups: wrap on small screens */
  .btn-group-sm {
    flex-wrap: wrap;
  }
}

@media (min-width: 576px) and (max-width: 767.98px) {
  .pm-page-title {
    font-size: 1.45rem;
  }

  .pm-stat-value {
    font-size: 1.75rem;
  }
}

/* Touch-friendly: larger tap targets on mobile */
@media (pointer: coarse) {
  .btn-sm {
    min-height: 2.25rem;
    min-width: 2.25rem;
  }

  .form-select-sm {
    min-height: 2.25rem;
  }

  .form-control-sm {
    min-height: 2.25rem;
  }
}
