/* Dyklogg Modern Styling & Ocean Palette */
:root {
  --bg-main: #0b1120;
  --bg-card: #0f172a;
  --bg-card-hover: #1e293b;
  --border-subtle: #1e293b;
  --border-active: #0284c7;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --primary: #0284c7;
  --primary-light: #38bdf8;
  --accent-cyan: #06b6d4;
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  overflow: hidden;
  height: 100%;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  display: flex;
  flex-direction: column;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #0b1120;
}
::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* Utilities */
.ocean-glass {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(56, 189, 248, 0.15);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-depth {
  background: rgba(2, 132, 199, 0.2);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.badge-time {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.badge-rmv {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.badge-gas {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
  border: 1px solid rgba(192, 132, 252, 0.3);
}

.badge-telemetry {
  background: rgba(6, 182, 212, 0.25);
  color: #22d3ee;
  border: 1px solid rgba(34, 211, 238, 0.4);
}

.badge-tank {
  background: rgba(100, 116, 139, 0.25);
  color: #cbd5e1;
  border: 1px solid rgba(203, 213, 225, 0.3);
}

/* App Layout */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
  position: relative;
}

/* Header */
.app-header {
  height: 60px;
  background: #0f172a;
  border-bottom: 1px solid #1e293b;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 40;
  flex-shrink: 0;
}

/* Main Split View Area */
.app-main {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
  min-height: 0;
}

/* Left Sidebar (Dive List) */
.dive-sidebar {
  width: 380px;
  background: #0f172a;
  border-right: 1px solid #1e293b;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100%;
  min-height: 0;
}

@media (max-width: 900px) {
  .dive-sidebar {
    width: 100%;
  }
}

/* Right Content (Detail & Graph) */
.dive-content {
  flex: 1;
  background: #0b1120;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  height: 100%;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 900px) {
  .dive-content {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 30;
    padding-bottom: calc(75px + env(safe-area-inset-bottom, 0px));
  }
  .dive-content.mobile-active {
    display: flex;
  }
  #main-view-container {
    padding-bottom: calc(75px + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  #dive-list-container {
    padding-bottom: calc(75px + env(safe-area-inset-bottom, 0px));
  }
}

/* Dive Card */
.dive-card {
  padding: 14px;
  border-bottom: 1px solid #1e293b;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  background: #0f172a;
  position: relative;
}

.dive-card:hover {
  background: #1e293b;
}

.dive-card.active {
  background: rgba(2, 132, 199, 0.15);
  border-left: 4px solid var(--primary-light);
}

/* Chart Canvas Wrapper */
.telemetry-chart-container {
  width: 100%;
  height: 380px;
  background: #0f172a;
  border-radius: 12px;
  border: 1px solid #1e293b;
  position: relative;
  overflow: hidden;
}

/* Bottom Nav (Mobile) */
.bottom-nav {
  display: none;
  height: calc(58px + env(safe-area-inset-bottom, 0px));
  min-height: calc(58px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: #0f172a;
  border-top: 1px solid #1e293b;
  justify-content: space-around;
  align-items: center;
  flex-shrink: 0;
  z-index: 50;
  box-sizing: border-box;
}

.nav-desktop-item {
  transition: all 0.2s ease;
}

.nav-desktop-item.active {
  background: var(--primary) !important;
  color: #ffffff !important;
  border-color: var(--primary-light) !important;
  box-shadow: 0 0 10px rgba(2, 132, 199, 0.4);
}

@media (max-width: 900px) {
  .desktop-nav {
    display: none !important;
  }
  .bottom-nav {
    display: flex;
  }
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  padding: 4px 10px;
}

.nav-item.active {
  color: var(--primary-light);
}

/* Modal and Bottom Sheet */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease-in-out;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-panel {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 16px;
  max-width: 680px;
  width: 92%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  transform: scale(0.95);
  transition: transform 0.2s ease-in-out;
}

.modal-backdrop.open .modal-panel {
  transform: scale(1);
}

@media (max-width: 640px) {
  .modal-panel.bottom-sheet {
    position: absolute;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    max-height: 85vh;
    transform: translateY(100%);
  }
  .modal-backdrop.open .modal-panel.bottom-sheet {
    transform: translateY(0);
  }
}

/* Inputs & Form Controls */
input, select, textarea {
  background: #1e293b;
  border: 1px solid #334155;
  color: #f8fafc;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  border: none;
}

.btn-primary {
  background: #0284c7;
  color: white;
}
.btn-primary:hover {
  background: #0369a1;
}

.btn-secondary {
  background: #1e293b;
  color: #cbd5e1;
  border: 1px solid #334155;
}
.btn-secondary:hover {
  background: #334155;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.4);
}
.btn-danger:hover {
  background: rgba(239, 68, 68, 0.3);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.8rem;
}

/* Quick Tank Buttons */
.tank-selector-btn {
  padding: 6px 12px;
  border-radius: 8px;
  background: #1e293b;
  border: 1px solid #334155;
  font-size: 0.8rem;
  cursor: pointer;
  color: #cbd5e1;
}
.tank-selector-btn.selected {
  background: rgba(2, 132, 199, 0.25);
  border-color: var(--primary-light);
  color: var(--primary-light);
  font-weight: bold;
}

/* Autocomplete Dropdown */
.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 190px;
  overflow-y: auto;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  box-shadow: 0 12px 28px -4px rgba(0, 0, 0, 0.8);
  z-index: 50;
  margin-top: 4px;
}

.autocomplete-item {
  transition: background 0.1s ease;
}

.autocomplete-item:hover {
  background: #1e293b;
}

.buddy-chip {
  transition: all 0.15s ease;
}

.buddy-chip:hover {
  background: #334155 !important;
  color: #f8fafc !important;
}

/* Leaflet Map & Custom Popups */
.custom-dive-pin:hover > div {
  transform: scale(1.18);
  box-shadow: 0 0 24px rgba(56, 189, 248, 0.9) !important;
  border-color: #ffffff !important;
}

.custom-dark-popup .leaflet-popup-content-wrapper {
  background: #0f172a !important;
  color: #f8fafc !important;
  border-radius: 12px !important;
  border: 1px solid #334155 !important;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.8) !important;
  padding: 6px !important;
}

.custom-dark-popup .leaflet-popup-tip {
  background: #0f172a !important;
  border: 1px solid #334155 !important;
}

.custom-dark-popup .leaflet-popup-close-button {
  color: #94a3b8 !important;
  padding: 4px 6px !important;
}

.custom-dark-popup .leaflet-popup-close-button:hover {
  color: #f8fafc !important;
}

.country-chip {
  transition: all 0.15s ease;
}

.country-chip:hover {
  border-color: #0284c7 !important;
}

