@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Outfit:wght@500;600;700;800&display=swap');


/* =============================================================================
   LOOPS LOGISTICS - COMPLETE DESIGN SYSTEM & STYLES (v3.3)
   ============================================================================= */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: #0f172a;
  color: #f8fafc;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
}

/* APP SHELL */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* TOP NAVBAR */
.app-header {
  height: 56px;
  background-color: #1e293b;
  border-bottom: 1px solid #334155;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 1000;
  flex-shrink: 0;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.5px;
  color: #ffffff;
}

.brand-icon {
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, #38bdf8, #0284c7);
  border-radius: 6px;
  display: inline-block;
}

.nav-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: #0f172a;
  padding: 4px;
  border-radius: 8px;
  border: 1px solid #334155;
}

.nav-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-tab:hover {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.05);
}

.nav-tab.active {
  background: #38bdf8;
  color: #0f172a;
  font-weight: 700;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.simulator-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid #38bdf8;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.simulator-btn:hover {
  background: #38bdf8;
  color: #0f172a;
}

/* PAGE CONTENT CONTAINER */
.page-content {
  flex: 1;
  min-height: 0;
  height: calc(100vh - 56px);
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* DATABASE PAGE STYLES */
.database-container {
  padding: 16px 24px;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #0f172a;
  overflow: hidden;
}

.database-sub-navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #334155;
  padding-bottom: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.database-tabs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #334155;
  padding-bottom: 12px;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.database-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.db-sub-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.db-sub-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #1e293b;
  padding: 4px;
  border-radius: 8px;
  border: 1px solid #334155;
}

.db-sub-tab, .db-subtab {
  background: transparent;
  color: #94a3b8;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  outline: none;
}

.db-sub-tab:hover, .db-subtab:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
}

.db-sub-tab.active, .db-subtab.active {
  background: #38bdf8;
  color: #0f172a;
  font-weight: 700;
}

.database-view-body,
.database-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.database-content .data-table th {
  position: sticky;
  top: 0;
  z-index: 10;
}

.db-actions-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

.precision-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #1e293b;
  padding: 4px;
  border-radius: 6px;
  border: 1px solid #334155;
}

.filter-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.filter-btn.active {
  background: #334155;
  color: #ffffff;
}

.db-search {
  flex: 1;
  max-width: 320px;
  background: #1e293b;
  border: 1px solid #334155;
  color: #ffffff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.82rem;
}

.db-search:focus {
  outline: none;
  border-color: #38bdf8;
}

.btn-primary {
  background: #38bdf8;
  color: #0f172a;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary:hover {
  background: #0284c7;
  color: #ffffff;
}

/* EXPEDITION DASHBOARD SPLIT LAYOUT */
.expedition-container {
  display: flex;
  width: 100vw;
  height: calc(100vh - 56px);
  overflow: hidden;
  position: relative;
  background-color: #0f172a;
}

.expedition-left-panel {
  height: 100%;
  background: #182030;
  border-right: 1px solid #334155;
  display: flex;
  flex-direction: row;
  overflow-x: auto;
  overflow-y: hidden;
  z-index: 10;
  position: relative;
  transition: width 0.2s ease;
}

.expedition-right-map {
  flex: 1;
  height: 100%;
  position: relative;
}

.expedition-right-map .map-canvas {
  width: 100%;
  height: 100%;
}

.overlay-card {
  background: #1e293b;
  border-bottom: 1px solid #334155;
  padding: 10px 12px;
}

.date-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.date-badge {
  background: #0f172a;
  border: 1px solid #334155;
  color: #f8fafc;
  padding: 4px 8px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 0.8rem;
}

.icon-btn-header {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #0f172a;
  border: 1px solid #334155;
  color: #38bdf8;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.icon-btn-header:hover {
  background: #38bdf8;
  color: #0f172a;
}

.search-input {
  width: 100%;
  background: #0f172a;
  border: 1px solid #334155;
  color: #f8fafc;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
}

.search-input:focus {
  outline: none;
  border-color: #38bdf8;
}

.missions-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mission-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mission-card:hover {
  border-color: #38bdf8;
  background: #242e42;
}

.mission-card.selected {
  border-color: #38bdf8;
  background: #242e42;
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.2);
}

.btn-new-job-dashed {
  width: 100%;
  background: rgba(30, 41, 59, 0.6);
  border: 2px dashed #475569;
  color: #94a3b8;
  border-radius: 8px;
  padding: 8px;
  font-weight: 600;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-new-job-dashed:hover {
  background: rgba(56, 189, 248, 0.1);
  border-color: #38bdf8;
  color: #38bdf8;
}

.left-detail-pane {
  flex: 1;
  min-height: 0;
  height: 100%;
  background: #182030;
  border-left: 1px solid #334155;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dispatcher-overlay-right {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 280px;
  z-index: 500;
  pointer-events: none;
}

.notifications-box {
  pointer-events: auto;
  background: rgba(30, 41, 59, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 10px;
  max-height: 220px;
  overflow-y: auto;
}

.notification-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.78rem;
}

.notification-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 4px;
  flex-shrink: 0;
}

.notification-dot.delivered { background-color: #22c55e; }
.notification-dot.failed { background-color: #ef4444; }

/* DATA TABLES */
.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.82rem;
}

.data-table th {
  background-color: #0f172a;
  color: #94a3b8;
  font-weight: 600;
  padding: 8px 10px;
  border-bottom: 1px solid #334155;
}

.data-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: #f8fafc;
}

.data-table tr:hover {
  background-color: #242e42;
  cursor: pointer;
}

.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #1e293b;
  color: #f8fafc;
  border: 1px solid #334155;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-action:hover {
  background: #334155;
  border-color: #94a3b8;
}

.table-input {
  background: #0f172a;
  border: 1px solid #334155;
  color: #f8fafc;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
}

/* MODAL OVERLAY & CONTENT */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-overlay > .overlay-card {
  max-height: 90vh;
  max-width: 95vw;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-content {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.hover-underline {
  transition: all 0.12s ease;
}

.hover-underline:hover {
  text-decoration: underline !important;
  color: #38bdf8 !important;
}

@keyframes live-pulse {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.65); opacity: 0.15; }
  100% { transform: scale(0.9); opacity: 0.8; }
}

.live-position-pin {
  pointer-events: auto !important;
  cursor: pointer !important;
}

/* Clean time input without cramped webkit clock picker */
.clean-time-input::-webkit-calendar-picker-indicator {
  display: none !important;
  -webkit-appearance: none !important;
}
.clean-time-input {
  -moz-appearance: textfield;
}

/* =============================================================================
   MOBILE & PHONE SCROLLING AND RESPONSIVE LAYOUT (<= 900px)
   Preserves 100% of desktop UI while making every screen scrollable on phone
   ============================================================================= */
@media (max-width: 900px) {
  html, body {
    height: auto !important;
    min-height: 100dvh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
  }

  .app-container {
    height: auto !important;
    min-height: 100dvh !important;
    width: 100% !important;
    overflow-y: visible !important;
    overflow-x: hidden !important;
  }

  .app-header {
    height: auto !important;
    min-height: 52px;
    padding: 8px 12px !important;
    flex-wrap: wrap;
    gap: 8px;
    position: sticky;
    top: 0;
    z-index: 1000;
  }

  .app-header .nav-tabs {
    width: 100%;
    order: 3;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }

  .app-header .nav-tabs::-webkit-scrollbar {
    display: none;
  }

  .app-header .nav-tab {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 6px 12px;
    font-size: 0.78rem;
  }

  .page-content {
    height: auto !important;
    min-height: calc(100dvh - 96px) !important;
    overflow-y: visible !important;
    overflow-x: hidden !important;
    display: flex;
    flex-direction: column;
  }

  /* Expedition Page on Phone: Vertical Scrollable Stack */
  .expedition-container {
    flex-direction: column !important;
    width: 100% !important;
    height: auto !important;
    min-height: calc(100dvh - 96px) !important;
    overflow: visible !important;
  }

  .expedition-left-panel {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    flex-direction: column !important;
    overflow: visible !important;
    border-right: none !important;
  }

  .expedition-jobs-menu {
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
    border-right: none !important;
    border-bottom: 1px solid #334155;
  }

  .expedition-jobs-menu .missions-list {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  .left-detail-pane {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: auto !important;
    overflow: visible !important;
    border-left: none !important;
    border-top: 2px solid #38bdf8;
  }

  .left-detail-pane > div {
    max-height: none !important;
    overflow-y: visible !important;
    overflow-x: auto !important;
  }

  .expedition-right-map {
    width: 100% !important;
    height: 420px !important;
    min-height: 360px !important;
    flex: none !important;
  }

  /* Database & Admin Pages on Phone */
  .database-container {
    height: auto !important;
    min-height: calc(100dvh - 96px) !important;
    overflow: visible !important;
    padding: 12px !important;
  }

  .database-tabs-header,
  .database-sub-navbar {
    flex-wrap: wrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .db-sub-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    flex-wrap: nowrap;
  }

  .db-sub-tab, .db-subtab {
    flex-shrink: 0;
    white-space: nowrap;
  }

  .database-view-body,
  .database-content {
    height: auto !important;
    max-height: none !important;
    overflow-y: visible !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  /* Connect Page on Phone */
  .connect-page-root {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  .connect-page-body {
    height: auto !important;
    overflow-y: visible !important;
    overflow-x: hidden !important;
    padding: 14px !important;
  }

  /* Documentation Page on Phone */
  .docs-page-root {
    flex-direction: column !important;
    height: auto !important;
    overflow: visible !important;
  }

  .docs-sidebar {
    width: 100% !important;
    height: auto !important;
    max-height: 240px !important;
    border-right: none !important;
    border-bottom: 1px solid #252530 !important;
  }

  .docs-main {
    height: auto !important;
    overflow: visible !important;
    padding: 16px !important;
  }

  /* Modals on Phone */
  .modal-overlay {
    padding: 10px !important;
    align-items: flex-start !important;
    overflow-y: auto !important;
  }
}
