/* ==========================================================================
   PERKKANAS - PWA Mobile Stylesheet
   Modern, sleek mobile app experience with bottom navigation & offcanvas drawer.
   ========================================================================== */

:root {
  --pwa-primary: #f97316;
  --pwa-primary-hover: #ea580c;
  --pwa-accent: #fbbf24;
  --pwa-bg-dark: #111625;
  --pwa-bg-card: #1a2236;
  --pwa-text-light: #f8f9fa;
  --pwa-text-muted: #a0aec0;
  --pwa-bottom-nav-height: 65px;
}

/* --------------------------------------------------------------------------
   Mobile View Padding & Adjustments
   -------------------------------------------------------------------------- */
@media (max-width: 991.98px) {
  body {
    padding-bottom: calc(var(--pwa-bottom-nav-height) + env(safe-area-inset-bottom, 10px)) !important;
  }
}

/* --------------------------------------------------------------------------
   PWA Mobile Top Header Bar (Mobile Only)
   -------------------------------------------------------------------------- */
.pwa-mobile-topbar {
  display: none;
}

@media (max-width: 991.98px) {
  .pwa-mobile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1040;
    background: rgba(17, 22, 37, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 8px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  }

  .pwa-mobile-topbar .pwa-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
  }

  .pwa-mobile-topbar .pwa-brand img {
    height: 38px;
    width: auto;
    object-fit: contain;
  }

  .pwa-mobile-topbar .pwa-brand-text {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--pwa-text-light);
    letter-spacing: 0.5px;
    margin: 0;
  }

  .pwa-mobile-topbar .pwa-top-actions {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .pwa-mobile-topbar .pwa-btn-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: var(--pwa-text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s ease;
  }

  .pwa-mobile-topbar .pwa-btn-icon:active {
    transform: scale(0.92);
    background: rgba(249, 115, 22, 0.3);
  }
}

/* --------------------------------------------------------------------------
   PWA Bottom Navigation Bar (Mobile Only)
   -------------------------------------------------------------------------- */
.pwa-bottom-nav {
  display: none;
}

@media (max-width: 991.98px) {
  .pwa-bottom-nav {
    display: flex;
    align-items: center;
    justify-content: space-around;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--pwa-bottom-nav-height) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(17, 22, 37, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1050;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
  }

  .pwa-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 100%;
    color: var(--pwa-text-muted);
    text-decoration: none !important;
    font-size: 0.72rem;
    font-weight: 500;
    transition: all 0.25s ease;
    position: relative;
  }

  .pwa-nav-item i {
    font-size: 1.25rem;
    margin-bottom: 3px;
    transition: transform 0.25s ease, color 0.25s ease;
  }

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

  .pwa-nav-item.active i {
    transform: translateY(-2px) scale(1.1);
    color: var(--pwa-primary);
  }

  .pwa-nav-item.active::after {
    content: '';
    position: absolute;
    top: 0;
    width: 32px;
    height: 3px;
    background: var(--pwa-primary);
    border-radius: 0 0 4px 4px;
    box-shadow: 0 2px 8px rgba(249, 115, 22, 0.6);
  }
}

/* --------------------------------------------------------------------------
   PWA Mobile Drawer (Offcanvas Menu)
   -------------------------------------------------------------------------- */
.pwa-drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1060;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.pwa-drawer-overlay.active {
  opacity: 1;
  visibility: visible;
}

.pwa-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 85%;
  max-width: 340px;
  background: var(--pwa-bg-dark);
  z-index: 1070;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  box-shadow: -5px 0 25px rgba(0, 0, 0, 0.5);
  overflow-y: auto;
  color: var(--pwa-text-light);
}

.pwa-drawer.active {
  transform: translateX(0);
}

.pwa-drawer-header {
  padding: 18px;
  background: var(--pwa-bg-card);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pwa-drawer-header .pwa-drawer-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  color: var(--pwa-text-light);
  display: flex;
  align-items: center;
  gap: 10px;
}

.pwa-drawer-header .pwa-drawer-close {
  background: transparent;
  border: none;
  color: var(--pwa-text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px;
}

.pwa-drawer-body {
  padding: 15px;
  flex: 1;
  overflow-y: auto;
}

/* Accordion Menu in Mobile Drawer */
.pwa-menu-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.pwa-menu-item {
  margin-bottom: 6px;
}

.pwa-menu-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  color: var(--pwa-text-light);
  text-decoration: none !important;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  font-weight: 500;
  font-size: 0.92rem;
  transition: all 0.2s ease;
}

.pwa-menu-link:hover,
.pwa-menu-link.active {
  background: rgba(249, 115, 22, 0.15);
  color: var(--pwa-primary);
}

.pwa-menu-link i.pwa-menu-icon {
  width: 24px;
  margin-right: 10px;
  color: var(--pwa-primary);
  text-align: center;
}

.pwa-menu-link i.pwa-arrow {
  font-size: 0.8rem;
  transition: transform 0.3s ease;
}

.pwa-menu-item.open > .pwa-menu-link i.pwa-arrow {
  transform: rotate(90deg);
}

.pwa-submenu {
  list-style: none;
  padding-left: 15px;
  margin-top: 4px;
  display: none;
}

.pwa-menu-item.open > .pwa-submenu {
  display: block;
}

.pwa-submenu .pwa-menu-link {
  font-size: 0.85rem;
  padding: 9px 12px;
  background: transparent;
  border-left: 2px solid rgba(249, 115, 22, 0.3);
  border-radius: 0 8px 8px 0;
}

/* --------------------------------------------------------------------------
   PWA Install Toast / Banner Banner
   -------------------------------------------------------------------------- */
.pwa-install-banner {
  display: none;
  position: fixed;
  bottom: calc(var(--pwa-bottom-nav-height) + 15px);
  left: 15px;
  right: 15px;
  background: var(--pwa-bg-card);
  border: 1px solid rgba(249, 115, 22, 0.4);
  border-radius: 14px;
  padding: 14px;
  z-index: 1045;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  color: var(--pwa-text-light);
  animation: pwaSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pwaSlideUp {
  from {
    transform: translateY(100px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.pwa-install-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pwa-install-icon img {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
}

.pwa-install-info {
  flex: 1;
}

.pwa-install-title {
  font-weight: 700;
  font-size: 0.9rem;
  margin: 0;
  color: #fff;
}

.pwa-install-desc {
  font-size: 0.75rem;
  margin: 2px 0 0 0;
  color: var(--pwa-text-muted);
}

.pwa-install-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  justify-content: flex-end;
}

.pwa-btn-install {
  background: var(--pwa-primary);
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.pwa-btn-dismiss {
  background: transparent;
  color: var(--pwa-text-muted);
  border: none;
  padding: 6px 10px;
  font-size: 0.8rem;
  cursor: pointer;
}

/* Offline Badge */
.pwa-offline-badge {
  display: none;
  background: #dc3545;
  color: #fff;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}
