/**
 * FORRE_DARK — Mobile app shell rebuild (<=768px only).
 * Facebook-style app navigation for FORRE.NU mobile, matching the
 * forre-app-prototype design system. Desktop (>=769px) is NEVER affected:
 * every rule lives inside the media query and is scoped to the mobile
 * body class. No linear-gradient surfaces. 0px radius (except avatars/dots).
 * Loaded AFTER combined.css + mobile-premium-shell.css so it wins by cascade.
 */

@media (max-width: 768px) {

  /* ============================================================
     PROTOTYPE PALETTE (mobile only) — cyan accent + deep dark
     ============================================================ */
  body.tw-mob-premium-v1 {
    --primary: #00c8ff;
    --primary-hover: #33d4ff;
    --primary-glow: rgba(0, 200, 255, 0.45);
    --success: #00e676;
    --warning: #ffab00;
    --danger: #ff1744;
    --fb-bg: #0a0a0f;
    --fb-s1: #13131a;
    --fb-s2: #1c1c26;
    --fb-s3: #252533;
    --fb-deep: #0d0d14;
    --fb-txt: #ffffff;
    --fb-txt2: rgba(255, 255, 255, 0.70);
    --fb-txt3: rgba(255, 255, 255, 0.40);
    --fb-txt4: rgba(255, 255, 255, 0.20);
    --fb-border: rgba(255, 255, 255, 0.07);
    background: var(--fb-bg) !important;
  }

  /* ============================================================
     TOPBAR (the fixed <header> util row -> app topbar)
     ============================================================ */
  body.tw-mob-premium-v1 > header {
    background: rgba(13, 13, 20, 0.96) !important;
    border-bottom: 1px solid var(--fb-border) !important;
    transition: transform 0.3s ease;
  }

  body.tw-mob-premium-v1.tw-fbhide-top > header {
    transform: translateY(-100%);
  }

  body.tw-mob-premium-v1 .tw-fbtop {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 6px;
    height: 44px;
    grid-template-columns: none !important;
  }

  body.tw-mob-premium-v1 .tw-fbtop-btn {
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border: 0;
    background: transparent;
    color: var(--fb-txt);
    font-size: 20px;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s ease, color 0.15s ease;
  }

  body.tw-mob-premium-v1 .tw-fbtop-btn:active {
    background: var(--fb-s3);
  }

  body.tw-mob-premium-v1 .tw-fbtop-logo {
    flex: 1 1 auto;
    text-align: center;
    font-family: var(--font-family, Roboto, sans-serif);
    font-weight: 900;
    font-size: 19px;
    letter-spacing: 0.4px;
    color: var(--fb-txt);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  body.tw-mob-premium-v1 .tw-fbtop-logo span { color: var(--primary); }

  body.tw-mob-premium-v1 .tw-fbtop-actions {
    display: flex;
    align-items: center;
    gap: 0;
    flex: 0 0 auto;
  }

  body.tw-mob-premium-v1 .tw-fbtop-dot {
    position: absolute;
    top: 7px;
    right: 7px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--danger);
    border: 2px solid var(--fb-deep);
  }

  /* ============================================================
     BOTTOM NAV — 5 flat tabs (Hem/Matcher/Squad/Notiser/Profil)
     ============================================================ */
  body.tw-mob-premium-v1 .tw-mobile-bottom-nav {
    grid-template-columns: repeat(5, 1fr) !important;
    background: var(--fb-deep) !important;
    border-top: 1px solid var(--fb-border) !important;
    box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.5) !important;
    transition: transform 0.3s ease;
  }

  body.tw-mob-premium-v1.tw-fbhide-bottom .tw-mobile-bottom-nav {
    transform: translateY(100%);
  }

  body.tw-mob-premium-v1 .tw-mobile-bottom-item {
    color: var(--fb-txt3);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: color 0.18s ease;
  }

  body.tw-mob-premium-v1 .tw-mobile-bottom-item i {
    color: var(--fb-txt3);
    font-size: 20px;
    transition: color 0.18s ease, transform 0.18s ease;
  }

  body.tw-mob-premium-v1 .tw-mobile-bottom-item:active i { transform: translateY(1px); }

  body.tw-mob-premium-v1 .tw-mobile-bottom-item.is-active,
  body.tw-mob-premium-v1 .tw-mobile-bottom-item.is-active i {
    color: var(--primary);
  }

  /* Active marker: 2px line directly UNDER the icon (per spec) */
  body.tw-mob-premium-v1 .tw-mobile-bottom-item.is-active::before {
    display: none !important;
  }

  body.tw-mob-premium-v1 .tw-mob-badge-wrap { position: relative; }

  body.tw-mob-premium-v1 .tw-mobile-bottom-item.is-active .tw-mob-badge-wrap::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -5px;
    transform: translateX(-50%);
    width: 22px;
    height: 2px;
    background: var(--primary);
  }

  body.tw-mob-premium-v1 .tw-fbnav-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--fb-txt4);
  }

  body.tw-mob-premium-v1 .tw-fbnav-profile.is-active .tw-fbnav-avatar {
    border-color: var(--primary);
  }

  body.tw-mob-premium-v1 .tw-mob-pill-badge {
    border-radius: 0;
    background: var(--danger);
    font-weight: 700;
  }

  /* Hidden drawer trigger (keeps existing hub-menu JS alive) */
  body.tw-mob-premium-v1 .tw-fbhidden-trigger {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
    opacity: 0;
    pointer-events: none;
  }

  /* ============================================================
     HAMBURGER DRAWER — slide in from LEFT (85%)
     Reuses the existing hub-menu markup/JS, restyled.
     ============================================================ */
  body.tw-mob-premium-v1 .tw-mob-hub-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 984;
  }

  body.tw-mob-premium-v1 .tw-mob-hub-menu {
    top: 0 !important;
    left: 0 !important;
    right: auto !important;
    bottom: 0 !important;
    width: 86% !important;
    max-width: 340px !important;
    max-height: none !important;
    background: var(--fb-s1) !important;
    border: 0 !important;
    border-right: 1px solid var(--fb-border) !important;
    box-shadow: 10px 0 48px rgba(0, 0, 0, 0.55) !important;
    transform: translateX(-100%) !important;
    opacity: 1 !important;
    transition: transform 0.3s ease !important;
    pointer-events: none;
    z-index: 985 !important;
    padding-top: calc(14px + env(safe-area-inset-top, 0px));
  }

  body.tw-mob-premium-v1 .tw-mob-hub-menu.is-open {
    transform: translateX(0) !important;
    pointer-events: auto;
  }

  body.tw-mob-premium-v1 .tw-mob-hub-menu::before { display: none !important; }

  /* ============================================================
     CREATE bottom-sheet (the + action)
     ============================================================ */
  body.tw-mob-premium-v1 .tw-fbcreate-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 986;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
  }

  body.tw-mob-premium-v1 .tw-fbcreate-backdrop.is-open { opacity: 1; visibility: visible; }

  body.tw-mob-premium-v1 .tw-fbcreate {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 987;
    background: var(--fb-s2);
    border-top: 1px solid var(--fb-border);
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  }

  body.tw-mob-premium-v1 .tw-fbcreate.is-open { transform: translateY(0); }

  body.tw-mob-premium-v1 .tw-fbcreate-handle {
    width: 40px;
    height: 4px;
    background: var(--fb-s3);
    margin: 12px auto 6px;
  }

  body.tw-mob-premium-v1 .tw-fbcreate-title {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--fb-txt3);
    padding: 6px 18px 4px;
  }

  body.tw-mob-premium-v1 .tw-fbcreate-opt {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 18px;
    color: var(--fb-txt);
    text-decoration: none;
    transition: background 0.15s ease;
  }

  body.tw-mob-premium-v1 .tw-fbcreate-opt:active { background: var(--fb-s3); }

  body.tw-mob-premium-v1 .tw-fbcreate-ic {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--fb-s3);
    color: var(--primary);
    font-size: 19px;
  }

  body.tw-mob-premium-v1 .tw-fbcreate-tx .nm { font-weight: 700; font-size: 15px; }
  body.tw-mob-premium-v1 .tw-fbcreate-tx .ds { font-size: 12px; color: var(--fb-txt3); margin-top: 2px; }
}
