/*
 * Aim 4 The Cloud portal - AdminLTE template skin
 * Presentation-only overrides. Existing routes, controllers, form names, modal ids,
 * AJAX hooks, and Smarty variables are intentionally preserved.
 */
:root {
  --portal-primary: #0d6efd;
  --portal-primary-dark: #0b5ed7;
  --portal-primary-soft: #e7f1ff;
  --portal-ink: #1f2937;
  --portal-muted: #6c757d;
  --portal-border: rgba(0, 0, 0, .085);
  --portal-card-radius: .9rem;
  --portal-shadow: 0 .5rem 1.25rem rgba(0, 0, 0, .075);
}

html,
body {
  min-height: 100%;
}

body.app-shell {
  font-family: "Source Sans 3", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

body.auth-shell {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(13,110,253,.18), transparent 28rem),
    linear-gradient(135deg, #e9ecef 0%, #f8f9fa 50%, #dee2e6 100%) !important;
}

a {
  text-decoration: none;
}

.min-width-0 { min-width: 0; }
.min-vh-75 { min-height: 75vh; }
.text-white-75 { color: rgba(255, 255, 255, .75) !important; }
.text-sm { font-size: .875rem !important; }
.text-xs { font-size: .75rem !important; }
.font-weight-bold { font-weight: 700 !important; }
.font-weight-bolder { font-weight: 800 !important; }
.opacity-5 { opacity: .5 !important; }
.opacity-6 { opacity: .6 !important; }
.opacity-7 { opacity: .7 !important; }
.opacity-10 { opacity: 1 !important; }
.border-radius-md { border-radius: .5rem !important; }
.border-radius-lg { border-radius: .75rem !important; }
.border-radius-xl { border-radius: 1rem !important; }

.bg-gradient-primary,
.btn.bg-gradient-primary {
  background: linear-gradient(135deg, var(--portal-primary), #5b8def) !important;
  color: #fff !important;
}
.bg-gradient-success { background: linear-gradient(135deg, #198754, #20c997) !important; color: #fff !important; }
.bg-gradient-info { background: linear-gradient(135deg, #0dcaf0, #0d6efd) !important; color: #fff !important; }
.bg-gradient-warning { background: linear-gradient(135deg, #ffc107, #fd7e14) !important; color: #212529 !important; }
.bg-gradient-danger { background: linear-gradient(135deg, #dc3545, #b02a37) !important; color: #fff !important; }
.bg-gradient-secondary { background: linear-gradient(135deg, #6c757d, #495057) !important; color: #fff !important; }
.bg-gradient-dark { background: linear-gradient(135deg, #212529, #111827) !important; color: #fff !important; }
.bg-gradient-light { background: linear-gradient(135deg, #fff, #f8f9fa) !important; color: #212529 !important; }

/* AdminLTE shell */
.portal-adminlte-wrapper .app-main {
  min-height: calc(100vh - 57px);
}

.portal-app-header {
  border-bottom: 1px solid var(--bs-border-color);
  box-shadow: 0 .125rem .375rem rgba(0, 0, 0, .04);
}

.portal-content-header {
  border-bottom: 1px solid rgba(0, 0, 0, .05);
  background: linear-gradient(180deg, #fff, rgba(255,255,255,.72));
}

.portal-app-content {
  padding-bottom: 2rem;
}

.portal-footer {
  border-top: 1px solid var(--bs-border-color);
}

.portal-sidebar {
  background: linear-gradient(180deg, #212529 0%, #1f2937 54%, #111827 100%) !important;
}

.portal-sidebar-brand {
  border-bottom: 1px solid rgba(255,255,255,.12) !important;
}

.portal-sidebar .brand-link {
  color: #fff;
  gap: .65rem;
}

.portal-sidebar .brand-text {
  max-width: 12.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-brand-icon,
.app-brand-mark {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: .7rem;
  color: #fff;
  background: linear-gradient(135deg, var(--portal-primary), #6ea8fe);
  flex: 0 0 auto;
}

.portal-sidebar-nav .app-sidenav-section {
  margin: .35rem 0 .85rem;
}

.portal-sidebar-nav .app-sidenav-section > .navbar-nav {
  list-style: none;
  margin: 0;
  padding: 0 .5rem;
}

.portal-sidebar-nav .nav-header {
  padding: .75rem .85rem .35rem;
  color: rgba(255,255,255,.48);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  list-style: none;
}

.portal-sidebar-nav .nav-item {
  list-style: none;
}

.portal-sidebar-nav .nav-link,
.portal-sidebar-logout {
  display: flex;
  align-items: center;
  gap: .65rem;
  min-height: 42px;
  padding: .58rem .75rem;
  margin: .12rem 0;
  border-radius: .55rem;
  color: rgba(255,255,255,.80) !important;
  line-height: 1.25;
}

.portal-sidebar-nav .nav-link:hover,
.portal-sidebar-nav .nav-link:focus,
.portal-sidebar-logout:hover,
.portal-sidebar-logout:focus,
.portal-sidebar-nav .nav-link.active {
  color: #fff !important;
  background: rgba(13,110,253,.36);
}

.portal-sidebar-nav .nav-icon,
.portal-sidebar-logout .nav-icon {
  width: 1.4rem;
  text-align: center;
  flex: 0 0 auto;
}

.portal-sidebar-nav .nav-link p,
.portal-sidebar-logout p {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-sidebar-footer {
  padding: .75rem .5rem 1rem;
  border-top: 1px solid rgba(255,255,255,.12);
}

.portal-sidebar-logout {
  color: #f8d7da !important;
}

.portal-sidebar-logout:hover,
.portal-sidebar-logout:focus {
  background: rgba(220, 53, 69, .25);
}

/* Header user/notification controls */

.portal-app-header .container-fluid,
.portal-app-header .navbar-nav {
  min-width: 0;
}

.portal-topbar-actions {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
}

.portal-topbar-actions > .nav-item {
  flex: 0 0 auto;
}

.portal-topbar-actions .user-menu {
  flex: 0 1 auto;
  min-width: 0;
  max-width: min(18rem, calc(100vw - 8rem));
}

.portal-user-link {
  display: flex !important;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
}

.portal-user-link::after {
  flex: 0 0 auto;
  margin-left: .45rem;
}

.portal-navbar-badge-wrap {
  position: absolute;
  top: .15rem;
  right: .25rem;
}

.notification-badge,
#notification-badge {
  min-width: 1.05rem;
  height: 1.05rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 .28rem;
  border-radius: 999px;
  background: #dc3545;
  color: #fff;
  border: 2px solid #fff;
  font-size: .62rem;
  font-weight: 700;
  line-height: 1;
}

#notification-badge.has-unread {
  animation: portal-pulse 1.5s infinite;
}

@keyframes portal-pulse {
  0% { box-shadow: 0 0 0 0 rgba(220, 53, 69, .45); }
  70% { box-shadow: 0 0 0 .55rem rgba(220, 53, 69, 0); }
  100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}

.portal-user-image {
  width: 2rem;
  height: 2rem;
  flex: 0 0 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: #fff;
  background: var(--portal-primary);
  border-radius: 50% !important;
  font-size: 1rem;
  line-height: 1;
  vertical-align: middle;
}

.portal-user-image img,
.portal-user-menu-avatar img,
.profile-hero-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.portal-user-name {
  display: inline-block;
  min-width: 0;
  max-width: clamp(7rem, 14vw, 13rem);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

.portal-user-menu-header {
  min-height: 150px;
  text-align: center;
}

.portal-user-menu-avatar {
  width: 72px;
  height: 72px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: rgba(255,255,255,.2);
  color: #fff;
  font-size: 2rem;
  margin-bottom: .5rem;
}

.portal-user-menu-header p {
  margin-bottom: 0;
}

.portal-user-menu-header small {
  display: block;
  font-size: .78rem;
  opacity: .84;
  overflow-wrap: anywhere;
}

/* Card and content compatibility */
.card,
.modal-content,
.portal-card {
  border: 1px solid var(--portal-border) !important;
  border-radius: var(--portal-card-radius) !important;
  box-shadow: var(--portal-shadow) !important;
}

.card-header {
  border-bottom-color: var(--portal-border) !important;
}

.table thead th {
  color: #6c757d;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.table-responsive {
  border-radius: .75rem;
}

.portal-page-header,
.page-header-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.35rem 1.5rem;
  border-radius: var(--portal-card-radius);
  color: #fff;
  background:
    linear-gradient(135deg, rgba(13,110,253,.96), rgba(33,37,41,.92)),
    url('/assets/adminlte/assets/img/boxed-bg.jpg') center / cover no-repeat;
  box-shadow: var(--portal-shadow);
}

.portal-page-title {
  margin: 0;
  color: #fff;
  font-size: clamp(1.35rem, 2vw, 1.85rem);
  font-weight: 700;
}

.portal-page-kicker {
  display: block;
  margin: 0 0 .35rem;
  color: rgba(255,255,255,.72);
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.portal-form-section {
  padding: 1.35rem;
  border: 1px solid var(--portal-border);
  border-radius: .85rem;
  background: #fff;
  margin-bottom: 1.25rem;
}

.portal-section-heading {
  display: flex;
  gap: .9rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.portal-section-heading h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.portal-section-heading p {
  margin: .15rem 0 0;
  color: var(--portal-muted);
  font-size: .875rem;
}

.portal-section-icon,
.portal-icon-circle,
.portal-stat-icon,
.portal-notification-icon,
.metric-icon,
.info-icon,
.icon.icon-shape {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.portal-section-icon {
  width: 2.35rem;
  height: 2.35rem;
  border-radius: .75rem;
  color: var(--portal-primary);
  background: var(--portal-primary-soft);
}

.portal-icon-circle {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, var(--portal-primary), #6ea8fe);
  font-size: 1.8rem;
}

.portal-stat-card { border-radius: var(--portal-card-radius) !important; }
.portal-stat-icon,
.metric-icon,
.info-icon {
  width: 3rem;
  height: 3rem;
  border-radius: .85rem;
  font-size: 1.25rem;
}

.icon.icon-shape {
  width: 2.2rem;
  height: 2.2rem;
}

.icon-sm { width: 2rem !important; height: 2rem !important; font-size: .9rem; }

.portal-table-wrap { border-top: 1px solid var(--portal-border); }
.portal-table thead th { background: #f8f9fa; }
.portal-table td,
.portal-table th { padding: 1rem 1.25rem; }

.portal-avatar-sm {
  width: 2.4rem;
  height: 2.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--portal-primary);
  background: var(--portal-primary-soft);
  font-weight: 700;
  flex: 0 0 auto;
}

.portal-list-group .list-group-item,
.portal-notification-list .list-group-item {
  border-color: var(--portal-border);
}

.portal-search-form { min-width: min(100%, 420px); }

.portal-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.portal-detail-item {
  padding: 1rem;
  border: 1px solid var(--portal-border);
  border-radius: .75rem;
  background: #f8f9fa;
  height: 100%;
}

.portal-detail-item span {
  display: block;
  color: var(--portal-muted);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: .25rem;
}

.portal-detail-item strong {
  display: block;
  color: var(--portal-ink);
  overflow-wrap: anywhere;
}

.portal-details-collapse summary {
  cursor: pointer;
  color: var(--portal-primary);
  font-weight: 700;
}

.portal-claims-pre {
  max-height: 320px;
  overflow: auto;
  padding: 1rem;
  border-radius: .75rem;
  background: #111827;
  color: #e5e7eb;
  font-size: .78rem;
}

.profile-hero-avatar {
  width: 8rem;
  height: 8rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--portal-primary);
  background: var(--portal-primary-soft);
  border: 4px solid #fff;
  box-shadow: var(--portal-shadow);
  font-size: 3rem;
}

.portal-notification-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: .75rem;
  color: var(--portal-primary);
  background: var(--portal-primary-soft);
}

/* Forms/buttons */
.btn {
  font-weight: 600;
}

.btn-primary {
  box-shadow: 0 .25rem .55rem rgba(13,110,253,.22);
}

.form-label {
  font-weight: 600;
}

.input-group-merge .input-group-text {
  border-right: 0;
  background: #fff;
}

.input-group-merge .input-group-text + .form-control {
  border-left: 0;
}

.form-control:focus,
.form-select:focus {
  border-color: rgba(13, 110, 253, .55);
  box-shadow: 0 0 0 .2rem rgba(13, 110, 253, .12);
}

/* Auth pages */
.auth-main {
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
}

.auth-content {
  width: 100%;
  position: relative;
  z-index: 1;
}

.auth-page-row {
  width: 100%;
  position: relative;
  z-index: 1;
}

.auth-card-professional {
  border-radius: 1rem !important;
}

.auth-card-aside {
  min-height: 520px;
  background:
    linear-gradient(145deg, rgba(13,110,253,.92), rgba(17,24,39,.88)),
    url('/assets/adminlte/assets/img/photo2.png') center / cover no-repeat;
}

.registration-card,
.form-register-card {
  max-width: 1180px;
  margin-left: auto;
  margin-right: auto;
}

/* Existing component hooks kept */
.qr-container {
  text-align: center;
  padding: 1.25rem;
  background: #f8f9fa;
  border: 1px solid var(--portal-border);
  border-radius: .85rem;
  margin: 1rem 0;
}

.profile-card {
  background: #fff;
  border-radius: var(--portal-card-radius);
  padding: 1.5rem;
  box-shadow: var(--portal-shadow);
}

.verification-steps {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1.875rem;
}

.verification-step {
  flex: 1;
  text-align: center;
  position: relative;
}

.verification-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 15px;
  right: -50%;
  width: 100%;
  height: 2px;
  background: #dee2e6;
  z-index: -1;
}

.verification-step.active::after { background: var(--portal-primary); }

.step-circle {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #dee2e6;
  color: #6c757d;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  margin-bottom: .3rem;
}

.verification-step.active .step-circle,
.verification-step.completed .step-circle {
  background: var(--portal-primary);
  color: #fff;
}

.loading-spinner { display: none; }
.btn-loading .loading-spinner { display: inline-block; }
.btn-loading .btn-text { display: none; }

.mfa-input {
  letter-spacing: .45em;
  font-size: 1.45rem;
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  padding: .8em .9em;
}

.session-expiry-modal {
  border: 0;
  border-radius: .95rem;
  box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, .22) !important;
}

#sessionExpiryCountdown {
  font-variant-numeric: tabular-nums;
}

.modal { z-index: 2060; }
.modal-backdrop { z-index: 2055; }

/* Mobile/table safety */
@media (max-width: 991.98px) {
  .portal-page-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .portal-user-image {
    margin-right: 0 !important;
  }

  .portal-user-name {
    display: none !important;
  }
}

@media (max-width: 767.98px) {
  .portal-page-header {
    padding: 1.1rem;
  }

  .portal-table td,
  .portal-table th {
    padding: .85rem;
  }

  .table-responsive table {
    min-width: 720px;
  }

  .auth-content {
    max-width: 100%;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  .auth-page-row {
    margin-left: 0;
    margin-right: 0;
  }

  .auth-page-row > [class*="col-"] {
    padding-left: 0;
    padding-right: 0;
  }

  .auth-card-aside {
    min-height: 240px;
  }

  .portal-card,
  .auth-card-professional {
    border-radius: .9rem !important;
  }
}


.portal-notification-popup {
  display: none;
  position: fixed;
  right: 1rem;
  top: 4.25rem;
  z-index: 2100;
  max-width: min(24rem, calc(100vw - 2rem));
  padding: 1rem;
  border: 1px solid var(--portal-border);
  border-radius: .85rem;
  background: #fff;
  box-shadow: var(--portal-shadow);
}

/* Header avatar hydration: keep real profile photos circular and sized correctly. */
.portal-user-image.has-profile-photo,
.portal-user-menu-avatar.has-profile-photo {
  padding: 0;
  background: #fff;
  color: transparent;
}

.portal-user-image.has-profile-photo {
  border: 2px solid rgba(13, 110, 253, .18);
}

.portal-user-image.has-profile-photo img,
.portal-user-menu-avatar.has-profile-photo img {
  max-width: none;
  min-width: 100%;
  min-height: 100%;
}

/* AdminLTE profile page refresh */
.profile-page-header {
  min-height: 126px;
}

.profile-page-edit-btn {
  white-space: nowrap;
}

.portal-card-kicker {
  color: var(--portal-muted);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.profile-overview-row > [class*="col-"] {
  min-width: 0;
}

.profile-summary-card {
  overflow: hidden;
}

.profile-summary-cover {
  height: 112px;
  background:
    radial-gradient(circle at 18% 20%, rgba(255,255,255,.22), transparent 30%),
    linear-gradient(135deg, var(--portal-primary), #1f2937);
}

.profile-summary-body {
  position: relative;
  padding: 0 1.5rem 1.5rem;
}

.profile-hero-avatar-lg {
  width: 7.5rem;
  height: 7.5rem;
  margin-top: -3.75rem;
  margin-bottom: 1rem;
  border: 5px solid #fff;
}

.profile-display-name {
  color: var(--portal-ink);
  font-size: clamp(1.35rem, 2vw, 1.65rem);
  font-weight: 700;
}

.profile-display-email {
  overflow-wrap: anywhere;
}

.profile-summary-list {
  display: grid;
  gap: .75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--portal-border);
}

.profile-summary-list-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 1rem;
  border: 1px solid var(--portal-border);
  border-radius: .85rem;
  background: #f8f9fa;
}

.profile-summary-list-item span {
  color: var(--portal-muted);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.profile-summary-list-item strong {
  color: var(--portal-ink);
  font-weight: 700;
  text-align: right;
  overflow-wrap: anywhere;
}

.profile-card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.35rem 1.35rem 1rem;
}

.profile-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.profile-detail-tile {
  display: flex;
  align-items: flex-start;
  gap: .95rem;
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--portal-border);
  border-radius: .95rem;
  background: #fff;
  box-shadow: 0 .45rem 1rem rgba(15, 23, 42, .035);
}

.profile-detail-tile-wide {
  grid-column: span 2;
}

.profile-detail-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 2.65rem;
  width: 2.65rem;
  height: 2.65rem;
  border-radius: .85rem;
  color: var(--portal-primary);
  background: var(--portal-primary-soft);
  font-size: 1rem;
}

.profile-detail-copy {
  min-width: 0;
}

.profile-detail-copy span {
  display: block;
  margin-bottom: .25rem;
  color: var(--portal-muted);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.profile-detail-copy strong {
  display: block;
  color: var(--portal-ink);
  font-size: 1rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.profile-claims-card .card-body {
  padding-top: 0;
}

.profile-claims-collapse summary {
  display: inline-flex;
  align-items: center;
  list-style: none;
}

.profile-claims-collapse summary::-webkit-details-marker {
  display: none;
}

.profile-claims-collapse[open] summary .fa-chevron-right {
  transform: rotate(90deg);
}

.profile-claims-collapse summary .fa-chevron-right {
  transition: transform .18s ease;
}

@media (max-width: 1199.98px) {
  .profile-summary-card {
    height: auto !important;
  }
}

@media (max-width: 767.98px) {
  .profile-detail-grid {
    grid-template-columns: 1fr;
  }

  .profile-detail-tile-wide {
    grid-column: auto;
  }

  .profile-summary-list-item {
    display: block;
  }

  .profile-summary-list-item strong {
    display: block;
    margin-top: .25rem;
    text-align: left;
  }
}
