/* assets/css/pwa.css — iPad/iPhone og vafra app upplifun */

:root {
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --bottom-nav-h: 64px;
}

/* Body padding fyrir bottom nav */
body {
  padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px)) !important;
}

/* ===================== BOTTOM NAV — alltaf sýnilegur ===================== */
.bottom-nav {
  display: flex;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(255,255,255,0.97);
  border-top: 0.5px solid rgba(0,0,0,0.14);
  z-index: 200;
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: #888;
  font-size: 11px;
  font-weight: 500;
  padding: 8px 4px;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.12s;
}

.bottom-nav-item:hover { color: #333; }
.bottom-nav-item.active { color: #1a1a1a; }

.bottom-nav-icon {
  font-size: 22px;
  line-height: 1;
}

/* ===================== STANDALONE / PWA ===================== */
@media (display-mode: standalone) {
  body {
    padding-top: calc(var(--nav-h) + var(--safe-top)) !important;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
    overscroll-behavior: none;
  }

  input, textarea, [contenteditable] {
    -webkit-user-select: text;
    user-select: text;
  }

  .main-nav {
    padding-top: var(--safe-top);
    height: calc(var(--nav-h) + var(--safe-top));
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  .nav-links { display: none; }

  .bottom-nav {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
}

/* ===================== SNERTISKJÁR ===================== */
@media (pointer: coarse) {
  .btn { min-height: 44px; }
  .btn-sm { min-height: 36px; }
  .sym-btn { min-height: 40px; padding: 8px 16px; }
  .nav-link { min-height: 44px; display: flex; align-items: center; }
  .meals-table td { padding: 12px 10px; }
  .btn-icon-sm {
    min-width: 36px; min-height: 36px;
    display: inline-flex; align-items: center; justify-content: center;
  }
  .btn-add-inline { min-height: 36px; display: inline-flex; align-items: center; }

  .form-group input,
  .form-group textarea,
  .form-group select {
    font-size: 16px !important;
    min-height: 44px;
    padding: 10px 14px;
  }
  .form-group textarea { min-height: 80px; }

  .modal-card {
    margin: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    max-height: 92vh;
    max-width: 100%;
  }

  .date-nav .btn-icon { font-size: 22px; min-width: 52px; min-height: 52px; }
  .date-heading { font-size: 20px; }
}

@media (min-width: 768px) and (pointer: coarse) {
  .nutrition-summary { grid-template-columns: repeat(5, 1fr); }
  .modal-card {
    position: relative; margin: auto;
    border-radius: var(--radius-lg);
    max-width: 600px;
    bottom: auto; left: auto; right: auto;
  }
}

html {
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
}

/* PWA install hint */
.pwa-install-hint {
  display: none;
  background: #1a1a1a; color: #fff;
  padding: 12px 16px; font-size: 13px; text-align: center;
  position: fixed; bottom: var(--bottom-nav-h); left: 0; right: 0;
  z-index: 199; animation: slideUp 0.3s ease;
}
.pwa-install-hint.show { display: block; }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.pwa-hint-close {
  background: none; border: none; color: #fff;
  font-size: 18px; cursor: pointer;
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
}
