/* ==========================================================================
   PondMaster PWA — Main Stylesheet
   Mobile-first, dark-mode default, light-mode via [data-theme="light"]
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CUSTOM PROPERTIES
   -------------------------------------------------------------------------- */

:root {
  --bg-primary: #F8F9FA;
  --bg-secondary: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-nav: #1A5276;
  --text-primary: #1A1A2E;
  --text-secondary: #555555;
  --text-muted: #888888;
  --text-nav: #FFFFFF;
  --border: #E0E0E0;
  --accent-blue: #1A5276;
  --accent-green: #1E8449;
  --accent-orange: #E67E22;
  --alert-red: #C0392B;
  --alert-yellow: #F39C12;
  --alert-green: #27AE60;
  --shadow: rgba(0, 0, 0, 0.08);
  --input-bg: #FFFFFF;
  --input-border: #CCCCCC;
  --chart-grid: rgba(0, 0, 0, 0.05);
  --transition: 200ms ease;
}

[data-theme="dark"] {
  --bg-primary: #0D1117;
  --bg-secondary: #161B22;
  --bg-card: #1C2128;
  --bg-nav: #0D1117;
  --text-primary: #E6EDF3;
  --text-secondary: #8B949E;
  --text-muted: #6E7681;
  --text-nav: #E6EDF3;
  --border: #30363D;
  --accent-blue: #58A6FF;
  --accent-green: #3FB950;
  --accent-orange: #F0883E;
  --alert-red: #F85149;
  --alert-yellow: #D29922;
  --alert-green: #3FB950;
  --shadow: rgba(0, 0, 0, 0.4);
  --input-bg: #21262D;
  --input-border: #30363D;
  --chart-grid: rgba(255, 255, 255, 0.05);
}

/* --------------------------------------------------------------------------
   2. RESET & BASE
   -------------------------------------------------------------------------- */

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

html {
  font-size: 16px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Color transitions for all themed elements */
body,
body *,
body *::before,
body *::after {
  transition:
    background-color var(--transition),
    color var(--transition),
    border-color var(--transition);
}

/* Exclude transforms and other properties from the global transition */
button,
a,
.btn,
.pond-card,
.tab-btn {
  transition:
    background-color var(--transition),
    color var(--transition),
    border-color var(--transition),
    opacity var(--transition),
    transform 100ms ease,
    box-shadow var(--transition);
}

img,
svg,
video,
canvas {
  display: block;
  max-width: 100%;
}

a {
  color: var(--accent-blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1, h2, h3, h4, h5, h6 {
  line-height: 1.2;
  font-weight: 600;
  color: var(--text-primary);
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.125rem; }
h4 { font-size: 1rem; }

p {
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

ul, ol {
  list-style: none;
}

/* Custom Scrollbar (WebKit) */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background-color: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background-color: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--text-muted);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) var(--bg-primary);
}

/* --------------------------------------------------------------------------
   3. APP LAYOUT
   -------------------------------------------------------------------------- */

.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar — hidden on mobile, visible on desktop */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  background-color: var(--bg-nav);
  color: var(--text-nav);
  display: none;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  z-index: 300;
}

.sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-nav);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.75rem;
  color: var(--text-nav);
  opacity: 0.5;
}

/* Main content area */
.main-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 80px; /* space for bottom nav on mobile */
  background-color: var(--bg-primary);
}

/* Top bar */
.top-bar {
  position: sticky;
  top: 0;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  z-index: 200;
}

.top-bar-title {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hamburger-btn {
  width: 40px;
  height: 40px;
  border: none;
  background-color: transparent;
  cursor: pointer;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  padding: 0;
}

.hamburger-btn:hover {
  background-color: var(--border);
}

/* Bottom navigation — mobile only */
.bottom-nav {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border);
  height: 64px;
  z-index: 100;
  align-items: stretch;
}

.bottom-nav-item {
  flex: 1;
  width: 20%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  border: none;
  background-color: transparent;
  color: var(--text-muted);
  font-size: 0.6875rem;
  font-weight: 500;
  text-decoration: none;
  min-height: 48px;
  min-width: 48px;
  -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item.active {
  color: var(--accent-blue);
}

.bottom-nav-item:hover {
  color: var(--accent-blue);
}

.bottom-nav-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bottom-nav-label {
  font-size: 0.625rem;
  line-height: 1;
}

/* Page content padding */
.page-content {
  padding: 16px;
}

/* --------------------------------------------------------------------------
   4. CARDS
   -------------------------------------------------------------------------- */

.card {
  background-color: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 16px;
  box-shadow: 0 2px 8px var(--shadow);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

/* Metric card */
.metric-card {
  background-color: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 16px;
  box-shadow: 0 2px 8px var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 100px;
}

.metric-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.metric-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 6px;
  font-weight: 500;
}

.metric-unit {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 400;
}

/* Pond card */
.pond-card {
  background-color: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 16px;
  box-shadow: 0 2px 8px var(--shadow);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.pond-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background-color: var(--accent-blue);
  border-radius: 12px 12px 0 0;
}

.pond-card:hover {
  border-color: var(--accent-blue);
  box-shadow: 0 4px 16px var(--shadow);
}

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

.pond-card-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.pond-card-meta {
  font-size: 0.8125rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.pond-card-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.pond-stat {
  text-align: center;
}

.pond-stat-value {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
}

.pond-stat-label {
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* --------------------------------------------------------------------------
   5. FORMS
   -------------------------------------------------------------------------- */

.form-group {
  margin-bottom: 16px;
}

.form-group:last-child {
  margin-bottom: 0;
}

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

input,
select,
textarea {
  width: 100%;
  background-color: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 8px;
  padding: 0 12px;
  font-size: 1rem;
  color: var(--text-primary);
  font-family: inherit;
  appearance: none;
  -webkit-appearance: none;
}

input,
select {
  height: 48px;
}

textarea {
  height: auto;
  padding: 12px;
  min-height: 100px;
  resize: vertical;
  line-height: 1.5;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(26, 82, 118, 0.15);
}

[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.2);
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23888' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

input[type="range"] {
  height: auto;
  padding: 0;
  border: none;
  background-color: transparent;
  box-shadow: none;
  accent-color: var(--accent-blue);
}

input[type="checkbox"],
input[type="radio"] {
  width: auto;
  height: auto;
  accent-color: var(--accent-blue);
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-error {
  font-size: 0.75rem;
  color: var(--alert-red);
  margin-top: 4px;
}

.input-group {
  display: flex;
  align-items: stretch;
  gap: 0;
}

.input-group input {
  border-radius: 8px 0 0 8px;
  border-right: none;
}

.input-addon {
  display: flex;
  align-items: center;
  padding: 0 12px;
  background-color: var(--bg-primary);
  border: 1px solid var(--input-border);
  border-radius: 0 8px 8px 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  padding: 0 24px;
  font-family: inherit;
  text-decoration: none;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary {
  background-color: var(--accent-green);
  color: #FFFFFF;
}

.btn-primary:hover {
  filter: brightness(1.1);
  text-decoration: none;
}

.btn-secondary {
  background-color: transparent;
  border: 2px solid var(--border);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background-color: var(--bg-primary);
  border-color: var(--text-muted);
  text-decoration: none;
}

.btn-danger {
  background-color: var(--alert-red);
  color: #FFFFFF;
}

.btn-danger:hover {
  filter: brightness(1.1);
  text-decoration: none;
}

.btn-ghost {
  background-color: transparent;
  color: var(--text-secondary);
  border: none;
}

.btn-ghost:hover {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  text-decoration: none;
}

.btn-full {
  width: 100%;
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-sm {
  height: 36px;
  font-size: 0.875rem;
  padding: 0 16px;
  border-radius: 6px;
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* --------------------------------------------------------------------------
   6. NAVIGATION
   -------------------------------------------------------------------------- */

.sidebar-nav {
  list-style: none;
  padding: 16px 0;
  flex: 1;
}

.sidebar-nav li {
  padding: 0 8px;
  margin-bottom: 2px;
}

.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: var(--text-nav);
  opacity: 0.7;
  text-decoration: none;
  border-radius: 8px;
  font-size: 0.9375rem;
  font-weight: 500;
  white-space: nowrap;
}

.sidebar-nav li a:hover {
  opacity: 1;
  background-color: rgba(255, 255, 255, 0.1);
  text-decoration: none;
}

.sidebar-nav li a.active {
  opacity: 1;
  background-color: rgba(255, 255, 255, 0.15);
}

.sidebar-nav-divider {
  height: 1px;
  background-color: rgba(255, 255, 255, 0.1);
  margin: 8px 20px;
}

.nav-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --------------------------------------------------------------------------
   7. TABS (pond detail)
   -------------------------------------------------------------------------- */

.tab-bar {
  display: flex;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  background-color: var(--bg-secondary);
  position: sticky;
  top: 56px;
  z-index: 100;
}

.tab-bar::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  flex-shrink: 0;
  padding: 12px 20px;
  border: none;
  border-bottom: 3px solid transparent;
  background-color: transparent;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-secondary);
  font-family: inherit;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.tab-btn:hover {
  color: var(--text-primary);
  background-color: var(--bg-primary);
}

.tab-btn.active {
  border-bottom-color: var(--accent-blue);
  color: var(--accent-blue);
  font-weight: 600;
}

.tab-content {
  display: none;
  padding: 16px;
}

.tab-content.active {
  display: block;
}

/* --------------------------------------------------------------------------
   8. TOAST NOTIFICATIONS
   -------------------------------------------------------------------------- */

.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: calc(100vw - 32px);
}

.toast {
  padding: 12px 16px;
  border-radius: 8px;
  min-width: 280px;
  max-width: 360px;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideInRight 300ms ease forwards;
  pointer-events: all;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  font-size: 0.9375rem;
  font-weight: 500;
}

.toast.success {
  background-color: var(--alert-green);
  color: #FFFFFF;
}

.toast.error {
  background-color: var(--alert-red);
  color: #FFFFFF;
}

.toast.warning {
  background-color: var(--alert-yellow);
  color: var(--text-primary);
}

.toast.info {
  background-color: var(--accent-blue);
  color: #FFFFFF;
}

.toast-icon {
  font-size: 1.125rem;
  flex-shrink: 0;
}

.toast-message {
  flex: 1;
  line-height: 1.3;
}

.toast-close {
  background-color: transparent;
  border: none;
  cursor: pointer;
  opacity: 0.7;
  color: inherit;
  font-size: 1.125rem;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}

.toast-close:hover {
  opacity: 1;
}

.toast.fade-out {
  animation: fadeOut 300ms ease forwards;
}

@keyframes slideInRight {
  from {
    transform: translateX(calc(100% + 16px));
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(calc(100% + 16px));
  }
}

/* --------------------------------------------------------------------------
   9. BOTTOM SHEET MODAL
   -------------------------------------------------------------------------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: none;
  align-items: flex-end;
  justify-content: center;
  backdrop-filter: blur(2px);
}

.modal-overlay.active {
  display: flex;
  animation: overlayFadeIn 200ms ease forwards;
}

.modal-sheet {
  background-color: var(--bg-card);
  border-radius: 20px 20px 0 0;
  padding: 24px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: sheetSlideUp 300ms ease forwards;
}

.modal-handle {
  width: 32px;
  height: 4px;
  background-color: var(--border);
  border-radius: 2px;
  margin: 0 auto 16px;
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.modal-actions .btn {
  flex: 1;
}

@keyframes overlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes sheetSlideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* --------------------------------------------------------------------------
   10. STATUS BADGES
   -------------------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.badge-active {
  background-color: rgba(39, 174, 96, 0.15);
  color: var(--accent-green);
}

.badge-warning {
  background-color: rgba(243, 156, 18, 0.15);
  color: var(--alert-yellow);
}

.badge-danger {
  background-color: rgba(192, 57, 43, 0.15);
  color: var(--alert-red);
}

.badge-owner {
  background-color: rgba(26, 82, 118, 0.15);
  color: var(--accent-blue);
}

.badge-neutral {
  background-color: var(--bg-primary);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* --------------------------------------------------------------------------
   11. OFFLINE INDICATOR
   -------------------------------------------------------------------------- */

.offline-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  background-color: var(--alert-yellow);
  color: var(--text-primary);
  text-align: center;
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 9998;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

body.offline .offline-bar {
  display: flex;
}

body.offline .main-content {
  margin-top: 36px;
}

body.offline .top-bar {
  top: 36px;
}

/* --------------------------------------------------------------------------
   12. FAB — Floating Action Button (mobile only)
   -------------------------------------------------------------------------- */

.fab {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: var(--accent-orange);
  color: #FFFFFF;
  font-size: 1.75rem;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px var(--shadow);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
}

.fab:hover {
  filter: brightness(1.1);
  transform: scale(1.05);
}

.fab:active {
  transform: scale(0.95);
}

/* --------------------------------------------------------------------------
   13. TOUR OVERLAY
   -------------------------------------------------------------------------- */

.tour-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  pointer-events: none;
}

.tour-spotlight {
  position: absolute;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.65);
  border-radius: 8px;
  transition: all 250ms ease;
  pointer-events: none;
}

.tour-tooltip {
  position: absolute;
  background-color: var(--bg-card);
  border-radius: 12px;
  padding: 20px;
  max-width: 90vw;
  width: 320px;
  pointer-events: all;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
}

.tour-tooltip-header {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-blue);
  margin-bottom: 8px;
}

.tour-tooltip-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.tour-tooltip-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 16px;
}

.tour-progress {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  align-items: center;
}

.tour-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--border);
  flex-shrink: 0;
}

.tour-dot.filled {
  background-color: var(--accent-blue);
}

.tour-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}

.tour-skip {
  font-size: 0.8125rem;
  color: var(--text-muted);
  background-color: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  font-family: inherit;
  pointer-events: all;
  margin-right: auto;
}

.tour-skip:hover {
  color: var(--text-secondary);
}

.tour-arrow {
  position: absolute;
  width: 0;
  height: 0;
  pointer-events: none;
}

.tour-arrow.arrow-down {
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid var(--bg-card);
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
}

.tour-arrow.arrow-up {
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid var(--bg-card);
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
}

/* --------------------------------------------------------------------------
   14. GROWTH CHART AREA
   -------------------------------------------------------------------------- */

.chart-container {
  position: relative;
  height: 220px;
  width: 100%;
}

.chart-container canvas {
  max-width: 100%;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
  justify-content: center;
}

.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.chart-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.chart-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-size: 0.875rem;
  flex-direction: column;
  gap: 8px;
  text-align: center;
}

/* --------------------------------------------------------------------------
   15. PAGE-SPECIFIC COMPONENTS
   -------------------------------------------------------------------------- */

/* Dashboard */
.welcome-banner {
  background-color: var(--bg-nav);
  color: var(--text-nav);
  padding: 20px 16px;
  border-radius: 12px;
  margin-bottom: 16px;
}

.welcome-banner h2 {
  color: var(--text-nav);
  font-size: 1.25rem;
}

.welcome-banner p {
  color: var(--text-nav);
  opacity: 0.8;
  margin-top: 4px;
  font-size: 0.875rem;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

/* Alert list */
.alert-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.alert-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background-color: var(--bg-card);
}

.alert-item.alert-warning {
  border-left: 3px solid var(--alert-yellow);
}

.alert-item.alert-danger {
  border-left: 3px solid var(--alert-red);
}

.alert-item.alert-info {
  border-left: 3px solid var(--accent-blue);
}

.alert-icon {
  font-size: 1.125rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.alert-body {
  flex: 1;
  min-width: 0;
}

.alert-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.alert-desc {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Calendar */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-top: 8px;
}

.calendar-day-header {
  text-align: center;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 4px 0;
  letter-spacing: 0.03em;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 0.8125rem;
  cursor: pointer;
  color: var(--text-primary);
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.calendar-day:hover {
  background-color: var(--bg-primary);
}

.calendar-day.today {
  background-color: var(--accent-blue);
  color: #FFFFFF;
  font-weight: 700;
}

.calendar-day.has-event::after {
  content: '';
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background-color: var(--accent-orange);
}

.calendar-day.today.has-event::after {
  background-color: #FFFFFF;
}

.calendar-day.other-month {
  color: var(--text-muted);
  opacity: 0.4;
}

.calendar-day.selected {
  background-color: var(--accent-blue);
  color: #FFFFFF;
}

/* Settings */
.settings-section {
  margin-bottom: 24px;
}

.settings-section-title {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0 0 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  gap: 16px;
  min-height: 56px;
}

.settings-row:last-child {
  border-bottom: none;
}

.settings-row-label {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-primary);
}

.settings-row-desc {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.settings-row-info {
  flex: 1;
}

/* Toggle switch */
.toggle {
  position: relative;
  width: 50px;
  height: 28px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: var(--border);
  border-radius: 14px;
  transition: background-color var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background-color: #FFFFFF;
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle input:checked + .toggle-slider {
  background-color: var(--accent-green);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(22px);
}

.toggle input:focus + .toggle-slider {
  box-shadow: 0 0 0 3px rgba(26, 82, 118, 0.2);
}

/* Reports */
.report-period-selector {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
  margin-bottom: 16px;
}

.report-period-selector::-webkit-scrollbar {
  display: none;
}

.period-btn {
  flex-shrink: 0;
  height: 36px;
  padding: 0 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background-color: transparent;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.period-btn.active {
  background-color: var(--accent-blue);
  border-color: var(--accent-blue);
  color: #FFFFFF;
}

/* Data table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background-color: var(--bg-primary);
}

.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: 12px;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* Loading spinner */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
  display: inline-block;
}

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

.loading-overlay {
  position: absolute;
  inset: 0;
  background-color: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
  z-index: 10;
}

/* Skeleton loader */
.skeleton {
  background-color: var(--border);
  border-radius: 4px;
  animation: skeletonPulse 1.5s ease-in-out infinite;
}

@keyframes skeletonPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Theme toggle button */
.theme-toggle {
  width: 40px;
  height: 40px;
  border: none;
  background-color: transparent;
  cursor: pointer;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  color: var(--text-primary);
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

.theme-toggle:hover {
  background-color: var(--bg-primary);
}

/* Avatar */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--accent-blue);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Divider */
.divider {
  height: 1px;
  background-color: var(--border);
  margin: 16px 0;
}

/* --------------------------------------------------------------------------
   16. UTILITY CLASSES
   -------------------------------------------------------------------------- */

/* Text colors */
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-primary { color: var(--text-primary); }
.text-success { color: var(--accent-green); }
.text-danger { color: var(--alert-red); }
.text-warning { color: var(--alert-yellow); }
.text-blue { color: var(--accent-blue); }
.text-orange { color: var(--accent-orange); }

/* Font sizes */
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }

/* Font weight */
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* Flex helpers */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-end { justify-content: flex-end; }

/* Gap */
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }

/* Margin top */
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }

/* Margin bottom */
.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }

/* Padding */
.p-16 { padding: 16px; }
.p-24 { padding: 24px; }
.px-16 { padding-left: 16px; padding-right: 16px; }
.py-8 { padding-top: 8px; padding-bottom: 8px; }

/* Width/height */
.w-full { width: 100%; }
.h-full { height: 100%; }

/* Display */
.hidden { display: none !important; }
.block { display: block; }
.inline-flex { display: inline-flex; }

/* Position */
.relative { position: relative; }
.absolute { position: absolute; }

/* Text alignment */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

/* Overflow / truncate */
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overflow-hidden { overflow: hidden; }

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Cursor */
.cursor-pointer { cursor: pointer; }

/* Border radius */
.rounded { border-radius: 8px; }
.rounded-full { border-radius: 9999px; }

/* --------------------------------------------------------------------------
   17. TABLET BREAKPOINT — 768px
   -------------------------------------------------------------------------- */

@media (min-width: 768px) {
  /* Layout */
  .sidebar {
    display: flex;
  }

  .bottom-nav {
    display: none;
  }

  .main-content {
    padding-bottom: 0;
  }

  .page-content {
    padding: 24px;
  }

  .hamburger-btn {
    display: none;
  }

  /* Cards */
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .stats-row {
    grid-template-columns: repeat(4, 1fr);
  }

  /* FAB hidden on tablet+ */
  .fab {
    display: none;
  }

  /* Modal */
  .modal-overlay {
    align-items: center;
  }

  .modal-sheet {
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
  }

  .modal-handle {
    display: none;
  }

  /* Chart */
  .chart-container {
    height: 280px;
  }

  /* Tabs */
  .tab-content {
    padding: 24px;
  }
}

/* --------------------------------------------------------------------------
   18. DESKTOP BREAKPOINT — 1200px
   -------------------------------------------------------------------------- */

@media (min-width: 1200px) {
  /* Cards */
  .card-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Page layout */
  .page-content {
    padding: 32px;
    max-width: 1400px;
    margin: 0 auto;
  }

  /* Top bar */
  .top-bar {
    padding: 0 32px;
  }

  /* Chart */
  .chart-container {
    height: 320px;
  }

  /* Modal */
  .modal-sheet {
    max-width: 560px;
  }

  /* Toast */
  .toast {
    min-width: 320px;
  }
}

/* --------------------------------------------------------------------------
   19. PRINT STYLES
   -------------------------------------------------------------------------- */

@media print {
  /* Hide chrome and navigation */
  .sidebar,
  .bottom-nav,
  .fab,
  .toast-container,
  .offline-bar,
  .top-bar,
  .tab-bar,
  .modal-overlay,
  .tour-overlay,
  .btn-icon,
  .theme-toggle,
  .hamburger-btn {
    display: none !important;
  }

  /* Reset layout */
  .app-shell {
    display: block;
    height: auto;
  }

  .main-content {
    overflow: visible;
    padding-bottom: 0;
    margin-top: 0;
  }

  .page-content {
    padding: 0;
  }

  /* Force white background, black text */
  body,
  body * {
    background-color: #FFFFFF !important;
    color: #000000 !important;
    box-shadow: none !important;
  }

  .card,
  .metric-card,
  .pond-card {
    border: 1px solid #CCCCCC !important;
    border-radius: 4px !important;
    break-inside: avoid;
  }

  /* Show all tab content when printing */
  .tab-content {
    display: block !important;
  }

  /* Table borders for print */
  .data-table th,
  .data-table td {
    border: 1px solid #CCCCCC !important;
  }

  /* Page break helpers */
  .page-break-before { page-break-before: always; }
  .page-break-after { page-break-after: always; }
  .no-break { break-inside: avoid; }

  /* Print header */
  .print-header {
    display: block !important;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 2px solid #000000;
  }

  /* URL after links */
  a[href]::after {
    content: ' (' attr(href) ')';
    font-size: 0.75rem;
    color: #555555;
  }

  a[href^="#"]::after,
  a[href^="javascript"]::after {
    content: '';
  }
}

/* Print header (hidden on screen) */
.print-header {
  display: none;
}
