/* Global theme refinements for second-pass UI polish */

:root {
  --portal-radius: 1rem;
  --portal-card-shadow: 0 10px 30px rgba(47, 43, 61, 0.08);
  --portal-card-shadow-hover: 0 14px 36px rgba(47, 43, 61, 0.12);
  --portal-border: rgba(47, 43, 61, 0.1);
}

body {
  background:
    radial-gradient(1200px 600px at 0% -10%, rgba(105, 108, 255, 0.12), transparent 50%),
    radial-gradient(900px 500px at 100% 0%, rgba(255, 76, 81, 0.08), transparent 55%);
}

.layout-navbar {
  position: relative;
  min-height: 4rem;
  border-bottom: 1px solid var(--portal-border);
}

#fullscreen-toggle {
  border-radius: 0.65rem;
  padding-inline: 0.55rem;
}

#pwa-install-btn,
#fullscreen-toggle {
  width: 2rem;
  min-width: 2rem;
  height: 2rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.topbar-tools {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: nowrap;
}

.topbar-lang-form {
  margin: 0;
}

.topbar-lang-select {
  min-width: 4.25rem;
  padding-inline: 0.45rem;
  padding-right: 1.35rem;
  line-height: 1.15;
  background-position: right 0.38rem center;
  background-size: 0.72rem 0.6rem;
}

#app-shell-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 3px;
  z-index: 2000;
  background: linear-gradient(90deg, var(--bs-primary), #49c2ff);
  transition: width 0.2s ease, opacity 0.25s ease;
  opacity: 0;
}

.layout-container {
  gap: 0.75rem;
  padding: 0.75rem 0.75rem 0;
}

.layout-menu {
  margin: 0;
  border-radius: 1rem;
  height: calc(100vh - 1.5rem);
  top: 0.75rem;
}

.layout-navbar {
  margin-bottom: 0.75rem;
  border-radius: 1rem;
  border: 1px solid var(--portal-border);
  box-shadow: var(--portal-card-shadow);
}

.portal-brand-logo {
  min-width: 26px;
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.portal-brand-name {
  max-width: 170px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

html.layout-menu-collapsed .portal-brand-name {
  display: none;
}

html.layout-menu-collapsed .portal-brand-logo {
  margin-inline-end: 0;
}

.layout-page {
  min-height: 100vh;
  min-width: 0;
}

.main-content-spacer {
  padding-top: 1.25rem;
}

.card {
  border: 1px solid var(--portal-border);
  border-radius: var(--portal-radius);
  box-shadow: var(--portal-card-shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--portal-card-shadow-hover);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  border-bottom: 1px solid var(--portal-border);
  font-weight: 700;
}

.table-responsive {
  border: 1px solid var(--portal-border);
  border-radius: 0.85rem;
}

.table.table-modern {
  margin-bottom: 0;
}

.table.table-modern thead th {
  background: linear-gradient(180deg, rgba(105, 108, 255, 0.07) 0%, rgba(105, 108, 255, 0.03) 100%);
  border-bottom: 1px solid var(--portal-border);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #566074;
  position: sticky;
  top: 0;
  z-index: 1;
}

.table.table-modern tbody tr {
  transition: background-color 0.15s ease;
}

.table.table-modern tbody tr:hover {
  background-color: rgba(105, 108, 255, 0.05);
}

.table.table-modern th.is-sortable {
  cursor: pointer;
  user-select: none;
}

.table.table-modern th.is-sortable::after {
  content: "  <>";
  font-size: 0.85em;
  opacity: 0.45;
}

.table.table-modern th.is-sortable[aria-sort='ascending']::after {
  content: "  ^";
  opacity: 0.8;
}

.table.table-modern th.is-sortable[aria-sort='descending']::after {
  content: "  v";
  opacity: 0.8;
}

.table-count-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  background: rgba(105, 108, 255, 0.12);
  color: var(--bs-primary);
}

.btn {
  border-radius: 0.7rem;
  font-weight: 600;
}

.form-control,
.form-select {
  border-radius: 0.7rem;
}

.modal-content {
  border-radius: 1rem;
}

.page-header .d-flex {
  flex-wrap: wrap;
}

.table td,
.table th {
  vertical-align: middle;
}

@media (max-width: 991.98px) {
  .layout-container {
    padding: 0;
    gap: 0;
  }

  .layout-menu {
    top: 0;
    height: 100vh;
    border-radius: 0;
  }

  .layout-navbar {
    margin-bottom: 0;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  #layout-navbar {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
  }

  .navbar-nav-right {
    min-width: 0;
  }

  .topbar-tools {
    margin-right: 0.4rem !important;
  }

  .topbar-lang-select {
    min-width: 4.1rem;
    max-width: 4.1rem;
    font-size: 0.75rem;
    padding-right: 1.25rem;
    background-position: right 0.32rem center;
  }

  .nav-item.navbar-dropdown.dropdown-user .nav-link {
    padding-left: 0.25rem !important;
    padding-right: 0.1rem !important;
  }

  .main-content-spacer {
    padding-top: 0.85rem;
    padding-left: 0.2rem;
    padding-right: 0.2rem;
  }

  .container-xxl {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }

  .page-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.55rem;
    margin-bottom: 0.9rem;
  }

  .row {
    margin-left: -0.35rem;
    margin-right: -0.35rem;
  }

  [class^='col-'],
  [class*=' col-'],
  .col {
    padding-left: 0.35rem;
    padding-right: 0.35rem;
  }

  .card {
    margin-bottom: 0.75rem;
  }

  .card-header,
  .card-body,
  .card-footer {
    padding: 0.75rem;
  }

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

  .table.table-modern th,
  .table.table-modern td {
    white-space: nowrap;
    font-size: 0.8rem;
    padding: 0.55rem 0.5rem;
  }

  .btn,
  .form-control,
  .form-select {
    min-height: 2.35rem;
  }
}
