/**
 * The Trek Tribes - Mobile-First App & CRM Stylesheet
 * Native App Feel with Smooth Animations & Responsive Architecture
 */

:root {
  --primary: #059669;
  --primary-dark: #047857;
  --primary-light: #10b981;
  --accent: #f59e0b;
  --bg-app: #f8fafc;
  --surface: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --bottom-nav-height: 64px;
}

/* Base Mobile App Resets */
* {
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  overscroll-behavior-y: contain;
  margin: 0;
  padding: 0;
}

/* Safe Area Insets for Mobile Notches & Navigation Bars */
.safe-top {
  padding-top: env(safe-area-inset-top, 0px);
}
.safe-bottom {
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Native App Feel Containers */
.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Bottom Navigation Bar for Mobile */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 40;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.05);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 6px 0;
  color: #64748b;
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 500;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.bottom-nav-item svg {
  width: 22px;
  height: 22px;
  margin-bottom: 2px;
  transition: transform 0.2s ease;
}

.bottom-nav-item.active {
  color: #059669;
  font-weight: 600;
}

.bottom-nav-item.active svg {
  transform: translateY(-2px);
}

.bottom-nav-fab {
  position: relative;
  top: -14px;
  background: linear-gradient(135deg, #10b981, #047857);
  color: white !important;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(5, 150, 105, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.bottom-nav-fab:active {
  transform: scale(0.92);
}

/* Touch feedback ripple & scale */
.touch-press {
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.touch-press:active {
  transform: scale(0.97);
  opacity: 0.9;
}

/* Metric / Stat Cards */
.stat-card {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(226, 232, 240, 0.8);
  background: #ffffff;
  cursor: pointer;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
}

.stat-card:active {
  transform: scale(0.98);
}

/* App Header styling */
.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
}

/* Slide-up Bottom Sheet (Mobile View for Trekker Details) */
.bottom-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease-out;
}

.bottom-sheet-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 88vh;
  background: #ffffff;
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  z-index: 51;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  box-shadow: 0 -10px 35px rgba(0, 0, 0, 0.15);
}

.bottom-sheet.open {
  transform: translateY(0);
}

.bottom-sheet-handle {
  width: 44px;
  height: 5px;
  background: #cbd5e1;
  border-radius: 10px;
  margin: 12px auto 6px;
  cursor: grab;
}

.bottom-sheet-content {
  overflow-y: auto;
  padding: 16px 20px 32px;
  -webkit-overflow-scrolling: touch;
}

/* Responsive adjustments */
@media (min-width: 768px) {
  #mobile-drawer {
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 16rem !important;
    height: 100vh !important;
    z-index: 30 !important;
    overflow-y: auto !important;
  }
  .bottom-nav {
    display: none;
  }
  .app-main-content {
    margin-bottom: 0;
  }
  .bottom-sheet {
    position: fixed;
    top: 50%;
    left: 50%;
    bottom: auto;
    right: auto;
    transform: translate(-50%, -46%) scale(0.96);
    border-radius: 20px;
    width: 600px;
    max-height: 85vh;
    opacity: 0;
    pointer-events: none;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }
  .bottom-sheet.open {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    pointer-events: auto;
  }
  .bottom-sheet-handle {
    display: none;
  }
}

@media (max-width: 767px) {
  .app-main-content {
    margin-bottom: calc(var(--bottom-nav-height) + 12px);
  }
  .desktop-only-table {
    display: none;
  }
}

/* Quick Action Chips */
.action-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s ease;
}

.action-chip-call {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}
.action-chip-call:active, .action-chip-call:hover {
  background: #10b981;
  color: white;
}

.action-chip-wa {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}
.action-chip-wa:active, .action-chip-wa:hover {
  background: #22c55e;
  color: white;
}

.action-chip-mail {
  background: #f0f9ff;
  color: #0369a1;
  border: 1px solid #bae6fd;
}
.action-chip-mail:active, .action-chip-mail:hover {
  background: #0284c7;
  color: white;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}
