/* Extracted nav styles from line_name_card.css for React pages */
:root {
    --line-green: #06C755;
    --line-gray: #8C8C8C;
    --line-dark: #1E1E1E;
    --line-border: #EBEBEB;
    --page-bg: #F7F7F7;
    --success-green: #4CAF50;
    --bs-primary: #06C755;
    --bs-primary-hover: #28c589;
}

/* Bootstrap-style display utilities used by the nav labels (this app doesn't
   load Bootstrap). Labels are hidden on mobile so only the icons show; the
   text returns at the md breakpoint. */
.d-none {
    display: none !important;
}

@media (min-width: 768px) {
    .d-md-inline {
        display: inline !important;
    }
}

.nav-link {
    color: var(--line-gray);
    text-decoration: none;
    font-size: 14px;
    display: flex;
    align-items: center;
    /* gap between each icon and its label (desktop; labels are hidden on mobile) */
    gap: 8px;
}

.nav-link i {
    font-size: 16px;
}

.nav-link:hover {
    color: var(--line-green);
}

nav.main-nav {
    background-color: #fff;
    /* px (not rem) so left/right inset matches across legacy + React pages —
       rem would be 20px on milligram's 62.5% base vs 32px on the React 16px base. */
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 65.55px;
    position: fixed;
    max-width: 100vw;
    top: 0;
    z-index: 1000;
    width: 100%;
    align-self: flex-start;
    box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
}

nav .logo-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

nav .logo-container img {
    width: auto;
    height: 58px;
}

nav .logo-container span {
    font-size: 2rem;
    font-weight: 600;
    color: var(--line-green);
}

/* Text wordmark in place of the old logo image: "LINE" in brand green +
   "數位名片" in dark, sized to the old ~58px logo block. */
nav .logo-container .brand-text-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    text-decoration: none;
    line-height: 1;
    white-space: nowrap;
    /* Pin the typeface so legacy pages (Noto Sans TC body) and React pages
       (Microsoft JhengHei body) resolve the wordmark to the SAME font. */
    font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", sans-serif;
}
/* Absolute px (not rem) so the wordmark renders the SAME size on every page —
   legacy pages load milligram which sets html font-size:62.5% (1rem=10px) while
   the React pages use the 16px default, so rem would diverge. These px match the
   home page's size. */
nav .logo-container .brand-text-logo .brand-line {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: 0.01em;
    color: var(--line-green);
}
nav .logo-container .brand-text-logo .brand-name {
    font-size: 24px;
    font-weight: 700;
    color: #1f2a37;
}
@media screen and (max-width: 576px) {
    nav .logo-container .brand-text-logo .brand-line { font-size: 22px; }
    nav .logo-container .brand-text-logo .brand-name { font-size: 19px; }
}

/* 頁面標題（我的名片 / 好友名片）直接放在 nav 上，取代頁面內的標題列。 */
nav .logo-container .nav-page-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--line-green);
    white-space: nowrap;
}

@media screen and (max-width: 576px) {
    nav .logo-container {
        gap: 0.5rem;
    }
    nav .logo-container .nav-page-title {
        font-size: 1rem;
    }
}

.fw-nav__dev-badge {
    background: #fef3c7;
    color: #92400e;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

/* Wrapper around the dev badge. On desktop it's content-sized and pushes the
   right-hand action group over; on mobile it becomes a full-width second row
   that centres the (still small) badge. */
.fw-nav__dev-badge-wrap {
    display: inline-flex;
    align-items: center;
    margin-left: auto;
    /* a bit of breathing room before the 管理名片 action group (desktop;
       overridden by the absolute positioning on mobile) */
    margin-right: 16px;
}

.custom-dropdown {
    position: relative;
    display: inline-block;
    margin-right: 1rem;
    border-right: 1px solid #dee2e6;
    padding-right: 1rem;
    font-size: 14px;
  }

.custom-dropdown-toggle {
    display: flex;
    align-items: center;
    cursor: pointer;
    text-decoration: none;
    padding: 0.5rem 0;
    background: none;
    border: none;
    font: inherit;
    outline: none;
  }

.custom-dropdown-toggle:after {
    content: "▼";
    font-size: 0.7em;
    margin-left: 0.5em;
    transition: transform 0.2s;
  }

.custom-dropdown:focus-within .custom-dropdown-toggle:after,
  .custom-dropdown:hover .custom-dropdown-toggle:after {
    transform: rotate(180deg);
  }

.custom-dropdown-menu {
    display: none;
    position: absolute;
   top:24px;   
    right: 0;
    min-width: 140px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 0.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    z-index: 100;
    margin-top: 0.3rem;
    padding: 0.5rem 0;
  }

.custom-dropdown:focus-within .custom-dropdown-menu,
  .custom-dropdown:hover .custom-dropdown-menu {
    display: block;
  }

.custom-dropdown-menu li {
    list-style: none;
    border-bottom: 1px solid #dee2e6;
    margin-bottom: 0;
    
  }

.custom-dropdown-menu li:last-child {
    border-bottom: none;
  }

.custom-dropdown-menu a {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
   color:var(--line-gray);
    text-decoration: none;
    transition: background 0.2s;
    font-size: 14px;
    white-space: nowrap;
    border-radius: 0.25rem;
    gap: 0.5rem;
  }

.custom-dropdown-menu a:hover {
    background: #f5f5f5;
  }

.custom-dropdown-menu i {
    margin-right: 0.5em;
    width: 1.5rem;
    text-align: center;
  }

.brand-dropdown {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: 12px;
}

.brand-dropdown-toggle {
    color: var(--line-green);
    font-weight: 600;
    font-size: 16px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    user-select: none;
    cursor: pointer;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    background: #fff;
    width: 168px;
    height: 36px;
    transition: background-color 0.2s;
}

.brand-dropdown-toggle:hover {
    background: #f7f7f7;
}

/* Brand badge links to home; no dropdown, so no caret. */
.brand-dropdown-toggle:after {
    display: none;
}

.nav-modes-wrapper {
    display: inline-flex;
    align-items: center;
    border-radius: 10px;
    padding: 4px;
    margin-left: 12px;
    gap: 8px;
}

@media (max-width: 768px) {
  nav.main-nav {
          flex-wrap: nowrap;
          height: auto !important;
          padding-top: 10px;
          padding-bottom: 10px;
          row-gap: 8px;
          justify-content: flex-start !important;
          column-gap: 8px;
      }
  nav.main-nav .logo-container {
          /* keep the logo + selection box together as the left group and let
             it grow so the action icons get pinned to the right of row 1 */
          display: flex;
          align-items: center;
          gap: 8px;
          flex: 1 1 auto;
          min-width: 0;
          margin: 0;
      }
  nav.main-nav .brand-dropdown {
          flex: 0 1 auto;
          max-width: 130px; /* 稍微再縮小一點 */
          margin-left: 0;
      }
  nav.main-nav .brand-dropdown-toggle {
          white-space: nowrap;
          font-size: 12px; /* 字體再縮小一點 */
          padding-left: 6px;
          padding-right: 6px;
      }
  .nav-modes-wrapper {
          order: 3;
          /* keep the action icons on the first row, pinned to the right */
          margin-left: auto;
          justify-content: flex-end;
          flex: 0 0 auto;
          gap: 6px;
      }
  /* icons only on mobile: drop the divider/padding so they fit beside the logo,
     but keep a gap between the 管理名片 dropdown and the 分享 icon */
  nav.main-nav .custom-dropdown {
          margin-right: 10px;
          padding-right: 0;
          border-right: none;
      }
  .fw-nav__dev-badge-wrap {
          /* taken out of the flow so the logo + action icons stay on one row;
             floats as a centred pill just below the nav bar */
          position: absolute;
          top: 100%;
          left: 50%;
          transform: translateX(-50%);
          display: flex;
          justify-content: center;
          margin: 4px 0 0;
          pointer-events: none;
      }
  .fw-nav__dev-badge {
          font-size: 10px;
          padding: 2px 12px;
          pointer-events: auto;
      }
}

@media (max-width: 640px) {
  nav.main-nav {
          column-gap: 8px;
          row-gap: 14px;
          padding-left: 12px;
          padding-right: 12px;
      }
  nav.main-nav .logo-container img,
      nav.main-nav .logo-img {
          width: auto !important;
          height: 42px !important;
      }
  nav.main-nav .brand-dropdown {
          max-width: none;
          margin-left: 0 !important;
      }
  nav.main-nav .brand-dropdown-toggle {
          white-space: nowrap;
          font-size: 14px;
          padding: 7px 6px 7px 10px;
          width: auto !important;
      }
  nav.main-nav .brand-dropdown-toggle:after {
          margin-left: 2px;
      }
  .nav-modes-wrapper {
          flex: 0 1 auto !important;
      }
  .fw-nav__dev-badge-wrap {
          position: absolute;
          top: 100%;
          left: 50%;
          transform: translateX(-50%);
          display: flex;
          justify-content: center;
          margin: 4px 0 0;
          pointer-events: none;
      }
  .fw-nav__dev-badge {
          font-size: 10px !important;
          padding: 2px 12px !important;
          pointer-events: auto;
      }
}

@media (max-width: 768px) {
  nav .logo-container img {
          width: auto;
          height: 48px;
      }
  nav .logo-container span {
          font-size: 1.5rem;
      }
}
