/* ================================================================
   Recovery Management System – Custom Styles
   ================================================================ */

/* ---- CSS Variables ---- */
:root {
  --rm-sidebar-width:     260px;
  --rm-navbar-height:     64px;
  --rm-sidebar-bg:        #0d1b2a;
  --rm-sidebar-hover:     #1b2e42;
  --rm-sidebar-active:    #1a73e8;
  --rm-sidebar-text:      #c9d4e0;
  --rm-sidebar-text-muted:#7a96b0;
  --rm-body-bg:           #f0f4f8;
  --rm-card-radius:       .75rem;
  --rm-transition:        .2s ease;
}

/* ---- Base ---- */
body {
  background: var(--rm-body-bg);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  padding-top: calc(var(--rm-navbar-height) + .5rem);
}

/* ---- Top Navbar ---- */
.rm-navbar {
  height: var(--rm-navbar-height);
  background: var(--rm-sidebar-bg);
  border-bottom: 1px solid rgba(255,255,255,.08);
  z-index: 1040;
}

.rm-navbar .container-fluid {
  flex-wrap: nowrap;
}

.rm-user-name {
  display: inline-block;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}

/* ---- Sidebar ---- */
.rm-sidebar {
  position: fixed;
  top: var(--rm-navbar-height);
  left: 0;
  width: var(--rm-sidebar-width);
  height: calc(100vh - var(--rm-navbar-height));
  background: var(--rm-sidebar-bg);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1030;
  transition: transform var(--rm-transition);
  scrollbar-width: thin;
  scrollbar-color: #2a3f57 var(--rm-sidebar-bg);
}

.rm-sidebar-inner {
  padding: 1rem 0 2rem;
}

/* ---- Company badge in sidebar ---- */
.rm-company-badge {
  display: flex;
  align-items: center;
  padding: .75rem 1.25rem;
  margin: 0 .75rem .5rem;
  background: rgba(26,115,232,.15);
  border: 1px solid rgba(26,115,232,.3);
  border-radius: .5rem;
  color: #81b4f7;
  font-size: .85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rm-company-badge--admin {
  background: rgba(220,53,69,.12);
  border-color: rgba(220,53,69,.3);
  color: #f08;
}

/* ---- Sidebar Nav ---- */
.rm-nav {
  padding: 0 .75rem;
}

.rm-nav-section {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--rm-sidebar-text-muted);
  padding: 1.25rem .75rem .4rem;
}

.rm-nav-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem .85rem;
  border-radius: .5rem;
  color: var(--rm-sidebar-text);
  text-decoration: none;
  font-size: .9rem;
  transition: background var(--rm-transition), color var(--rm-transition);
  margin-bottom: 2px;
}

.rm-nav-link i {
  font-size: 1.1rem;
  flex-shrink: 0;
  opacity: .8;
}

.rm-nav-link span {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rm-nav-link:hover {
  background: var(--rm-sidebar-hover);
  color: #fff;
}

.rm-nav-link.active {
  background: var(--rm-sidebar-active);
  color: #fff;
  font-weight: 600;
}

.rm-nav-link.active i {
  opacity: 1;
}

.rm-nav-link--danger {
  color: #f08080;
}
.rm-nav-link--danger:hover {
  background: rgba(220,53,69,.2);
  color: #ff6b6b;
}

/* ---- Main content ---- */
.rm-main {
  margin-left: var(--rm-sidebar-width);
  min-height: calc(100vh - var(--rm-navbar-height));
  transition: margin-left var(--rm-transition);
}

.rm-content-inner {
  padding: 2rem 1.75rem 1.75rem;
  max-width: 1400px;
}

/* ---- Cards ---- */
.card {
  border-radius: var(--rm-card-radius) !important;
}

.card-header {
  border-radius: var(--rm-card-radius) var(--rm-card-radius) 0 0 !important;
  border-bottom: 1px solid rgba(0,0,0,.06);
}

/* ---- Stat cards ---- */
.stat-card .card-body {
  display: flex;
  flex-direction: column;
  gap: .25rem;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin-bottom: .5rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  color: #1a1a2e;
}

.stat-label {
  font-size: .8rem;
  color: #6c757d;
  font-weight: 500;
}

/* ---- Priority badges ---- */
.badge-priority-low     { background: #e2e8f0; color: #64748b; }
.badge-priority-normal  { background: #dbeafe; color: #1d4ed8; }
.badge-priority-high    { background: #fed7aa; color: #c2410c; }
.badge-priority-urgent  {
  background: #fecaca; color: #dc2626;
  animation: pulse-urgent 1.5s infinite;
}

@keyframes pulse-urgent {
  0%, 100% { opacity: 1; }
  50%       { opacity: .65; }
}

/* ---- Job status badges ---- */
.table th {
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #6c757d;
}

/* ---- Notification unread ---- */
.notif-unread {
  background: #f0f7ff;
  border-left: 3px solid #1a73e8;
}

/* ---- Login page ---- */
.rm-login-body {
  background: linear-gradient(135deg, #0d1b2a 0%, #1a365d 50%, #0d47a1 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.rm-login-wrapper {
  width: 100%;
  max-width: 460px;
}

.rm-login-card {
  border-radius: 1rem !important;
  overflow: hidden;
}

.rm-login-icon {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, #1a73e8, #0d47a1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: #fff;
  margin: 0 auto;
}

/* ---- Map container ---- */
#jobMap {
  background: #e8f0ef;
}

.leaflet-container {
  font-family: inherit;
}

/* ---- Tables ---- */
.table-hover tbody tr:hover {
  background-color: rgba(26,115,232,.04);
}

/* ---- Responsive: mobile ---- */
@media (max-width: 991.98px) {
  .rm-user-name {
    max-width: 110px;
  }

  .navbar-brand {
    white-space: nowrap;
    font-size: 1rem;
  }

  .rm-navbar {
    height: 58px;
  }

  body {
    padding-top: 62px;
  }

  .rm-sidebar {
    top: 58px;
    height: calc(100vh - 58px);
  }

  .rm-content-inner {
    padding-top: 1.25rem;
  }

  .rm-sidebar {
    transform: translateX(calc(-1 * var(--rm-sidebar-width)));
  }
  .rm-sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0,0,0,.3);
  }
  .rm-main {
    margin-left: 0;
  }
  .rm-content-inner {
    padding: 1rem;
  }
  .rm-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 1025;
  }
  .rm-sidebar-overlay.show {
    display: block;
  }
}

/* ---- Scrollbar ---- */
.rm-sidebar::-webkit-scrollbar { width: 4px; }
.rm-sidebar::-webkit-scrollbar-track { background: var(--rm-sidebar-bg); }
.rm-sidebar::-webkit-scrollbar-thumb { background: #2a3f57; border-radius: 2px; }

/* ---- Buttons ---- */
.btn {
  border-radius: .5rem;
}

.btn-sm {
  border-radius: .375rem;
}

/* ---- Form controls ---- */
.form-control, .form-select {
  border-radius: .5rem;
}

.input-group .form-control {
  border-radius: .5rem 0 0 .5rem !important;
}

.input-group .btn {
  border-radius: 0 .5rem .5rem 0 !important;
}

/* ---- Address UX enhancements ---- */
.address-suggestions {
  position: relative;
  z-index: 30;
  margin-top: .35rem;
  border: 1px solid rgba(0,0,0,.12);
  border-radius: .5rem;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 8px 18px rgba(0,0,0,.08);
}

.address-chip-row {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
}

.address-chip-row .btn {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#mapPickerMap {
  height: 420px;
  width: 100%;
  background: #e8f0ef;
}

/* ---- Alert improvements ---- */
.alert {
  border-radius: .625rem;
  border: none;
}

/* ---- Table card no border radius on table ---- */
.card > .table-responsive:first-child > table > thead > tr:first-child > th:first-child { border-top-left-radius: var(--rm-card-radius); }
.card > .table-responsive:first-child > table > thead > tr:first-child > th:last-child  { border-top-right-radius: var(--rm-card-radius); }

/* ---- Permission cards ---- */
.permission-item {
  border-radius: .5rem !important;
  transition: box-shadow var(--rm-transition);
}
.permission-item:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,.1) !important;
}
