/* ═══════════════════════════════════════════════════════════════════════════════
   Nabirahtek Admin Portal  –  Custom CSS
   Uses Bootstrap 5 as base; overrides only what's needed.
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ── Base ─────────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: #f4f6fb;
  color: #343a40;
}

/* ── Mobile App Showcase ─────────────────────────────────────────────────── */

.mobile-showcase {
  position: relative;
  transition: transform 0.3s ease;
}

.mobile-showcase:hover {
  transform: translateY(-10px);
}

.mobile-screen {
  border-radius: 24px;
  background: #fff;
  padding: 8px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.15);
  transition: all 0.3s ease;
}

.mobile-screen:hover {
  box-shadow: 0 30px 60px rgba(0,0,0,0.2);
  transform: scale(1.02);
}

/* ── Service Feature Cards ─────────────────────────────────────────────── */

.service-feature-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.service-feature-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 24px rgba(0,0,0,0.15);
}

.service-feature-img {
  transition: transform 0.3s ease;
}

.service-feature-card:hover .service-feature-img {
  transform: scale(1.05);
}

.service-content ul {
  list-style: none;
  padding: 0;
}

.service-content ul li {
  padding-left: 1.2rem;
  position: relative;
}

.service-content ul li:before {
  content: "✓";
  position: absolute;
  left: 0;
  color: #28a745;
  font-weight: bold;
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */

#sidebar-wrapper {
  min-width: 240px;
  max-width: 240px;
  min-height: 100vh;
  background: linear-gradient(180deg, #1a2236 0%, #1e2d4d 100%);
  color: #c8d6f0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  transition: min-width .25s, max-width .25s;
}

.sidebar-brand {
  color: #ffffff;
  letter-spacing: .5px;
}

.sidebar-divider {
  border-color: rgba(255, 255, 255, .12);
  margin: 0;
}

.sidebar-link {
  color: #afc2df;
  border-radius: 8px;
  padding: .6rem .85rem;
  font-size: .875rem;
  font-weight: 500;
  transition: background .15s, color .15s;
  display: flex;
  align-items: center;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, .08);
  color: #ffffff;
}

.sidebar-link.active {
  background: rgba(99, 157, 255, .18);
  color: #639dff;
}

/* Collapsed sidebar (mobile toggle) */
#wrapper.sidebar-collapsed #sidebar-wrapper {
  min-width: 0;
  max-width: 0;
  overflow: hidden;
}

/* ── Page Content Wrapper ─────────────────────────────────────────────────── */

#page-content-wrapper {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ── Top Navbar ───────────────────────────────────────────────────────────── */

.portal-topbar {
  background: #ffffff;
  border-bottom: 1px solid #e9ecef;
  min-height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
}

/* ── KPI Cards ────────────────────────────────────────────────────────────── */

.kpi-card {
  border-radius: 12px;
  transition: box-shadow .2s, transform .2s;
}

.kpi-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, .1) !important;
  transform: translateY(-2px);
}

.kpi-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Soft colour backgrounds */
.bg-primary-soft { background: rgba(13, 110, 253, .1); }
.bg-success-soft { background: rgba(25, 135, 84, .1); }
.bg-info-soft    { background: rgba(13, 202, 240, .12); }
.bg-warning-soft { background: rgba(255, 193, 7, .12); }
.bg-danger-soft  { background: rgba(220, 53, 69, .1); }

/* ── Login Page ───────────────────────────────────────────────────────────── */

.login-bg {
  background: linear-gradient(135deg, #1a2236 0%, #243a6e 60%, #1a2236 100%);
}

.login-card {
  width: 100%;
  max-width: 440px;
  border-radius: 16px;
}

/* ── Tables ───────────────────────────────────────────────────────────────── */

.table th {
  font-size: .8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #6c757d;
  white-space: nowrap;
}

.table td { font-size: .875rem; }

.avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(13, 110, 253, .1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.role-badge {
  font-size: .7rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}

/* ── Cards ────────────────────────────────────────────────────────────────── */

.card { border-radius: 12px; }

.card-header {
  font-size: .9rem;
  border-radius: 12px 12px 0 0 !important;
}

/* ── Terms Preview ────────────────────────────────────────────────────────── */

.term-preview {
  display: -webkit-box;
  display: -moz-box;
  display: box;
  -webkit-line-clamp: 5;
  -moz-line-clamp: 5;
  line-clamp: 5;
  -webkit-box-orient: vertical;
  -moz-box-orient: vertical;
  box-orient: vertical;
  overflow: hidden;
  white-space: pre-wrap;
}

.term-editor {
  font-family: 'Inter', monospace;
  font-size: .875rem;
  line-height: 1.7;
  resize: vertical;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */

.btn { border-radius: 8px; font-weight: 500; }
.btn-sm { border-radius: 6px; }

/* ── Forms ────────────────────────────────────────────────────────────────── */

.form-control, .form-select {
  border-radius: 8px;
  font-size: .875rem;
}

.form-control:focus, .form-select:focus {
  border-color: #0d6efd;
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, .15);
}

/* ── Alerts ───────────────────────────────────────────────────────────────── */

.alert { border-radius: 10px; font-size: .875rem; }

/* ── Pagination ───────────────────────────────────────────────────────────── */

.pagination .page-link { border-radius: 6px !important; margin: 0 2px; }

/* ── Breadcrumb ───────────────────────────────────────────────────────────── */

.breadcrumb { font-size: .8125rem; }

/* ── Mobile User Cards ────────────────────────────────────────────────────── */

.avatar-circle-lg {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  flex-shrink: 0;
  font-size: 1.25rem;
}

.user-card-mobile {
  border-radius: 14px;
  transition: box-shadow .2s, transform .15s;
}

.user-card-mobile:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, .08) !important;
  transform: translateY(-1px);
}

.min-width-0 { min-width: 0; }

/* ── Hero Banner ──────────────────────────────────────────────────────────── */

.hero-banner {
  background: linear-gradient(135deg, #f0f4ff 0%, #e8f0ff 60%, #f5f0ff 100%);
  border-radius: 16px;
}

[data-theme="dark"] .hero-banner {
  background: linear-gradient(135deg, #1a2236 0%, #1e2d4d 60%, #1f1a36 100%);
}

.hero-fleet-img {
  transition: transform 0.3s ease;
}

.hero-fleet-img:hover {
  transform: scale(1.04) rotate(-1deg);
}

/* ── Service Type Cards ────────────────────────────────────────────────────── */

.service-card {
  border-radius: 16px;
  transition: box-shadow 0.25s ease, transform 0.25s ease;
  cursor: default;
}

.service-card:hover {
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.13) !important;
  transform: translateY(-4px);
}

.service-card .service-img {
  transition: transform 0.3s ease, filter 0.3s ease;
}

.service-card:hover .service-img {
  transform: scale(1.06);
  filter: drop-shadow(0 8px 20px rgba(0,0,0,0.22)) !important;
}

.service-card-bg {
  position: absolute;
  top: -30px;
  right: -30px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  opacity: 0.4;
  pointer-events: none;
}

/* ── Admin Page Full-Height Layout ────────────────────────────────────────── */

/* Every admin page: body is a flex column filling the viewport.
   Structure: body > #wrapper (flex-grow-1, d-flex row) > sidebar + page-content
              body > scripts-div (contains footer at the bottom)               */
body:not(.login-bg) {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

body:not(.login-bg) > #wrapper,
body:not(.login-bg) > .d-flex:first-child {
  flex: 1;
}

/* Footer inside the scripts fragment wrapper */
body:not(.login-bg) > div:last-child > .footer {
  margin-top: auto;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  #sidebar-wrapper {
    min-width: 0;
    max-width: 0;
    overflow: hidden;
  }
  #wrapper.sidebar-collapsed #sidebar-wrapper {
    min-width: 240px;
    max-width: 240px;
    overflow-y: auto;
    position: fixed;
    z-index: 999;
    height: 100%;
    top: 0;
    left: 0;
  }
}
