/* Global tweaks on top of Bootstrap 5 */

:root {
  --app-max-width: 1400px;
  --sidebar-width: 260px;
  --sidebar-bg: #ffffff;
  --body-bg: #f4f6f9;
  /* Slightly lighter, cleaner body */
  --topbar-height: 70px;
  --brand-blue: #1A2b4c;
  /* RAL 5002 Ultramarine Blue approximation */
  --brand-silver: #a5a5a5;
  /* RAL 9006 White Aluminium approximation */
  --brand-blue-hover: #13203b;
  --brand-blue-light: rgba(26, 43, 76, 0.08);
}

html,
body {
  height: 100%;
}

body {
  background: var(--body-bg);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* App Layout Wrapper */
.app-wrapper {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* Sidebar Styling */
.app-sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background-color: var(--sidebar-bg);
  border-right: 1px solid #eef2f7;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 1030;
  box-shadow: 2px 0 20px rgba(0, 0, 0, 0.02);
}

.sidebar-header {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  border-bottom: 1px solid #eef2f7;
}

.sidebar-brand {
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--brand-blue);
  text-decoration: none;
  letter-spacing: 0.5px;
}

.sidebar-brand i {
  color: var(--brand-blue) !important;
}

.sidebar-content {
  flex-grow: 1;
  overflow-y: auto;
  padding: 1.5rem 1rem;
}

/* Sidebar Links */
.sidebar-heading {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--brand-silver);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.75rem;
  padding-left: 0.75rem;
  margin-top: 1.5rem;
}

.sidebar-heading:first-child {
  margin-top: 0;
}

.sidebar-link {
  display: flex;
  align-items: center;
  color: #5c6770;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease-in-out;
  margin-bottom: 0.25rem;
}

.sidebar-link i {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
  margin-right: 0.6rem;
  color: var(--brand-silver);
  transition: color 0.2s;
}

.sidebar-link:hover {
  background-color: #f8f9fa;
  color: var(--brand-blue);
}

.sidebar-link:hover i {
  color: var(--brand-blue);
}

.sidebar-link.active {
  color: var(--brand-blue);
  background-color: var(--brand-blue-light);
  font-weight: 600;
}

.sidebar-link.active i {
  color: var(--brand-blue);
}

/* Main Content Area */
.app-main {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  /* Prevents flex blowout */
}

/* Minimal Topbar */
.app-topbar {
  height: var(--topbar-height);
  background-color: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  border-bottom: 1px solid #eef2f7;
  position: sticky;
  top: 0;
  z-index: 1020;
}

.app-content {
  padding: 2rem;
  max-width: var(--app-max-width);
  margin: 0 auto;
  width: 100%;
  flex-grow: 1;
}

/* Make content feel less "flat" */
.card {
  border: 1px solid rgba(0, 0, 0, 0.03);
  border-radius: 12px;
  background-color: #ffffff;
}

.shadow-soft {
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
}

/* Tables: slightly cleaner */
.table> :not(caption)>*>* {
  padding-top: .85rem;
  padding-bottom: .85rem;
  vertical-align: middle;
}

.table thead th {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #98a6ad;
  border-bottom: 2px solid #eef2f7;
  background-color: #f8f9fa;
}

/* Alerts: compact */
.alert {
  border: 0;
  border-radius: 10px;
}

/* Small helpers */
.text-muted-2 {
  color: #98a6ad !important;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #313a46;
  margin-bottom: 0.25rem;
}

.page-subtitle {
  margin-bottom: 0;
  color: #98a6ad;
  font-size: .9rem;
}

/* Footer */
.app-footer {
  color: #98a6ad;
  font-size: .85rem;
  padding: 1.5rem 0;
  margin-top: 2rem;
  border-top: 1px solid #eef2f7;
}

/* Omnibar Search */
#omnibarModal .modal-content {
  border: none;
  border-radius: 16px;
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.15);
}

#omnibarInput {
  border: none;
  font-size: 1.25rem;
  padding: 1.5rem 1rem;
  border-radius: 16px 16px 0 0;
}

#omnibarInput:focus {
  box-shadow: none;
}

.omnibar-item {
  border-left: none;
  border-right: none;
  border-radius: 0 !important;
  padding: 1rem;
}

.omnibar-item:first-child {
  border-top: none;
}

.omnibar-item:last-child {
  border-bottom: none;
  border-radius: 0 0 16px 16px !important;
}

/* Floating Action Button */
.btn-fab {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 4px 15px rgba(13, 110, 253, 0.3);
  z-index: 1040;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-fab:hover {
  transform: translateY(-3px) rotate(90deg);
  box-shadow: 0 6px 20px rgba(13, 110, 253, 0.4);
}

.fab-menu {
  position: fixed;
  bottom: 5.5rem;
  right: 2.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: flex-end;
  z-index: 1039;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.2s ease;
}

.btn-fab:focus+.fab-menu,
.fab-menu:focus-within,
.fab-menu:hover,
.btn-fab.show+.fab-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.fab-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: #313a46;
  background: white;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
  transition: background 0.2s, transform 0.2s;
  font-weight: 500;
}

.fab-item:hover {
  background: #f8f9fa;
  transform: translateX(-5px);
}

.fab-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

/* Tom Select Overrides */
.ts-control {
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 0.5rem 2.25rem 0.5rem 0.75rem;
  box-shadow: none;
  min-height: calc(1.5em + 1rem + 2px);
  outline: none;
  transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
  background-color: #fff;
}

.ts-wrapper.focus .ts-control {
  border-color: #86b7fe;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.15);
  outline: 0;
}

/* Pills configuration */
.ts-control .item {
  background-color: #f1f3fa !important;
  color: #313a46 !important;
  border: none !important;
  border-radius: 6px !important;
  padding: 0.2rem 0.6rem !important;
  margin: 0.15rem 0.25rem 0.15rem 0 !important;
  font-size: 0.85rem;
  font-weight: 500;
  display: flex !important;
  align-items: center;
}

.item .remove {
  color: #98a6ad !important;
  margin-left: 0.4rem;
  border-left: 1px solid rgba(0, 0, 0, 0.05) !important;
  padding-left: 0.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
}

.item .remove:hover {
  color: #fa5c7c !important;
  background: transparent !important;
  text-decoration: none;
}

.ts-dropdown {
  border-radius: 8px;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
  border: 1px solid #eef2f7;
  margin-top: 0.25rem;
  z-index: 1050;
}

.ts-dropdown .option {
  padding: 0.6rem 1rem;
  cursor: pointer;
  color: #313a46;
}

.ts-dropdown .active {
  background-color: #f8f9fa;
  color: #0d6efd;
}

.ts-wrapper.multi .ts-control>input {
  margin: 0.25rem 0;
}

/* Mobile Responsiveness */
@media (max-width: 991.98px) {
  .app-wrapper {
    flex-direction: column;
  }
  .app-sidebar {
    width: 100%;
    min-width: 100%;
    height: auto;
    position: relative;
    border-right: none;
    border-bottom: 1px solid #eef2f7;
    z-index: 1030;
  }
  .sidebar-header {
    width: 100%;
  }
  .sidebar-content {
    max-height: 60vh;
    padding: 1rem;
  }
  .app-topbar {
    padding: 0 1rem;
  }
  .app-content {
    padding: 1rem;
  }
}