/* ============================================
   COVO APP STYLES — Mobile-first, app-lignende
   ============================================ */

/* --- Viewport & Safe Areas --- */
@supports (padding-top: env(safe-area-inset-top)) {
  body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* --- Bottom Navigation (App Tab Bar) --- */
.app-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(0,0,0,0.06);
  z-index: 1000;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.app-bottom-nav .nav-inner {
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 60px;
  max-width: 500px;
  margin: 0 auto;
}

.app-bottom-nav .nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-decoration: none;
  color: #888;
  font-size: 10px;
  flex: 1;
  height: 100%;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.app-bottom-nav .nav-item i {
  font-size: 22px;
  margin-bottom: 2px;
}

.app-bottom-nav .nav-item.active,
.app-bottom-nav .nav-item:hover {
  color: #00b4d8;
}

.app-bottom-nav .nav-item.sell-btn {
  color: #fff;
}

.app-bottom-nav .nav-item.sell-btn .sell-circle {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #00b4d8 0%, #0077b6 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0,180,216,0.4);
  margin-bottom: 0;
}

.app-bottom-nav .nav-item.sell-btn .sell-circle i {
  font-size: 20px;
  margin: 0;
}

/* --- App Header (Compact) --- */
.app-header {
  display: none;
  position: sticky;
  top: 0;
  z-index: 999;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(0,0,0,0.06);
  padding: 8px 16px;
  padding-top: max(8px, env(safe-area-inset-top));
}

.app-header .header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 500px;
  margin: 0 auto;
}

.app-header .app-logo {
  font-size: 20px;
  font-weight: 800;
  color: #00b4d8;
  text-decoration: none;
  letter-spacing: -0.5px;
}

.app-header .header-actions {
  display: flex;
  gap: 16px;
  align-items: center;
}

.app-header .header-actions a {
  color: #333;
  font-size: 20px;
  text-decoration: none;
  position: relative;
}

.app-header .header-actions .badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #ff4757;
  color: white;
  font-size: 10px;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- Category Stories (Horizontal Scroll) --- */
.category-stories {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 12px 16px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.category-stories::-webkit-scrollbar { display: none; }

.category-stories .story-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: #333;
  min-width: 72px;
  -webkit-tap-highlight-color: transparent;
}

.category-stories .story-ring {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  padding: 3px;
  background: linear-gradient(135deg, #00b4d8 0%, #0077b6 50%, #00d2ff 100%);
}

.category-stories .story-ring img,
.category-stories .story-ring .story-icon {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  border: 3px solid white;
}

.category-stories .story-name {
  font-size: 11px;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 72px;
}

/* --- App Product Cards (Full Width) --- */
.app-product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 0 8px 80px;
}

.app-product-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  transition: transform 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.app-product-card:active {
  transform: scale(0.97);
}

.app-product-card .card-image {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
}

.app-product-card .card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.app-product-card .card-save {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  background: rgba(255,255,255,0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  color: #888;
  font-size: 14px;
  cursor: pointer;
  backdrop-filter: blur(4px);
}

.app-product-card .card-save.saved { color: #ff4757; }

.app-product-card .card-info {
  padding: 10px 12px;
}

.app-product-card .card-price {
  font-size: 16px;
  font-weight: 700;
  color: #00b4d8;
  margin-bottom: 4px;
}

.app-product-card .card-title {
  font-size: 13px;
  color: #333;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 8px;
  min-height: 34px;
}

.app-product-card .card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #888;
}

.app-product-card .card-meta .seller-avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  object-fit: cover;
}

/* --- Pull to Refresh --- */
.pull-refresh {
  display: none;
  height: 50px;
  align-items: center;
  justify-content: center;
  color: #888;
  font-size: 13px;
  gap: 8px;
}

.pull-refresh.visible { display: flex; }

.pull-refresh i {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* --- Bottom Sheet (App Modal) --- */
.bottom-sheet-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.3s;
}

.bottom-sheet-overlay.open {
  display: block;
  opacity: 1;
}

.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-radius: 20px 20px 0 0;
  z-index: 2001;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  max-height: 85vh;
  overflow-y: auto;
  padding-bottom: env(safe-area-inset-bottom, 20px);
}

.bottom-sheet.open {
  transform: translateY(0);
}

.bottom-sheet .sheet-handle {
  width: 40px;
  height: 4px;
  background: #ddd;
  border-radius: 2px;
  margin: 12px auto;
}

/* --- Install Prompt Banner --- */
.install-banner {
  display: none;
  position: fixed;
  bottom: 70px;
  left: 16px;
  right: 16px;
  background: white;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.15);
  z-index: 1500;
  align-items: center;
  gap: 12px;
}

.install-banner.visible { display: flex; }

.install-banner .install-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, #00b4d8 0%, #0077b6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
  flex-shrink: 0;
}

.install-banner .install-text {
  flex: 1;
}

.install-banner .install-text strong {
  display: block;
  font-size: 15px;
  color: #333;
  margin-bottom: 2px;
}

.install-banner .install-text span {
  font-size: 13px;
  color: #888;
}

.install-banner .install-btn {
  background: #00b4d8;
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
}

.install-banner .install-close {
  background: none;
  border: none;
  color: #888;
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
}

/* --- Skeleton Loading --- */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- Mobile Overrides --- */
@media (max-width: 768px) {
  /* Skjul desktop header */
  .desktop-header { display: none !important; }

  /* Vis app header */
  .app-header { display: block; }

  /* Vis bottom nav */
  .app-bottom-nav { display: block; }

  /* Tilføj padding til bunden så indhold ikke gemmes bag nav */
  body { padding-bottom: 70px; }

  /* App product grid */
  .app-product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 8px;
  }

  /* Søgefelt i header */
  .app-search-bar {
    background: #f5f5f5;
    border-radius: 10px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 16px;
    text-decoration: none;
    color: #888;
    font-size: 14px;
  }

  .app-search-bar i { color: #888; }
}

@media (max-width: 380px) {
  .app-product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    padding: 6px;
  }

  .category-stories .story-ring {
    width: 56px;
    height: 56px;
  }

  .category-stories .story-name {
    font-size: 10px;
    max-width: 60px;
  }
}

/* --- Standalone mode (når app er installeret) --- */
@media (display-mode: standalone) {
  body {
    padding-top: env(safe-area-inset-top);
    user-select: none;
    -webkit-user-select: none;
  }

  .app-bottom-nav {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* --- Touch feedback --- */
.touch-feedback {
  position: relative;
  overflow: hidden;
}

.touch-feedback::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(0,180,216,0.15);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.3s, height 0.3s;
}

.touch-feedback:active::after {
  width: 200%;
  height: 200%;
}