/* =========================================================
   NeedsDoctor Header v2 — Light Medical Theme (Refactor)
   Clean • Fresh • Healthcare look
========================================================= */

:root{
  --nd2-bg: #ffffff;
  --nd2-bg-soft: #f7f9fc;
  --nd2-line: #e6ebf2;
  --nd2-text: #1e293b;
  --nd2-muted: #64748b;
  --nd2-accent: #0ea5e9;         /* medical blue */
  --nd2-accent-soft: #e0f2fe;
  --nd2-success: #22c55e;

  --nd2-radius: 14px;
  --nd2-radius-sm: 10px;

  --nd2-shadow: 0 8px 24px rgba(15,23,42,.06);

  --nd2-font: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

/* ============== Layout Container ============== */

.nd2-container{
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

/* ============== General Resets (Scoped) ============== */

.nd2-topbar, .nd2-header{
  font-family: var(--nd2-font);
}

.nd2-topbar a, .nd2-header a{
  -webkit-tap-highlight-color: transparent;
}

.nd2-topbar button, .nd2-header button{
  font-family: inherit;
}

/* Focus ring (accessible) */
.nd2-topbar a:focus-visible,
.nd2-header a:focus-visible,
.nd2-topbar button:focus-visible,
.nd2-header button:focus-visible{
  outline: 3px solid rgba(14,165,233,.35);
  outline-offset: 2px;
  border-radius: 12px;
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce){
  *{ transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ================= TOP BAR ================= */

.nd2-topbar{
  background: var(--nd2-bg-soft);
  border-bottom: 1px solid var(--nd2-line);
  position: relative;
  z-index: 1002; /* MUST be above sticky header when dropdown is open */
}

.nd2-topbar-inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:8px 0;
}

.nd2-top-left{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.nd2-top-right{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

/* Chips */
.nd2-chip{
  display:inline-flex;
  align-items:center;
  padding:6px 12px;
  border-radius: 999px;
  font-size:13px;
  text-decoration:none;
  background: #fff;
  border: 1px solid var(--nd2-line);
  color: var(--nd2-text);
  transition: .15s ease;
  line-height: 1;
}

.nd2-chip:hover{
  background: var(--nd2-accent-soft);
  border-color: var(--nd2-accent);
}

.nd2-chip.is-active{
  background: var(--nd2-accent);
  color: #fff;
  border-color: var(--nd2-accent);
}

/* ================= HEADER ================= */

.nd2-header{
  position: sticky;
  top: 0;
  z-index: 999;
  background: var(--nd2-bg);
  border-bottom: 1px solid var(--nd2-line);
  transition: .2s ease;
}

.nd2-header.is-scrolled{
  box-shadow: var(--nd2-shadow);
}

.nd2-header-inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding:14px 0;
}

/* ================= BRAND ================= */

.nd2-brand{
  display:flex;
  align-items:center;
  gap:12px;
  text-decoration:none;
  color: var(--nd2-text);
  min-width: 180px;
}

.nd2-logo{
  width:42px;
  height:42px;
  display:grid;
  place-items:center;
  border-radius: 12px;
  background: var(--nd2-accent-soft);
  color: var(--nd2-accent);
  font-weight:800;
  font-size:16px;
  border: 1px solid var(--nd2-line);
}

.nd2-brand-text{
  display:flex;
  flex-direction:column;
  line-height:1.1;
}

.nd2-title{
  font-weight:800;
  font-size:16px;
  letter-spacing: .2px;
}

.nd2-subtitle{
  font-size:12px;
  color: var(--nd2-muted);
}

/* ================= NAV ================= */

.nd2-nav{
  display:flex;
  align-items:center;
  gap:8px;
}

.nd2-link{
  text-decoration:none;
  font-size:14px;
  padding:9px 12px;
  border-radius: var(--nd2-radius-sm);
  color: var(--nd2-text);
  transition: .15s ease;
  white-space: nowrap;
}

.nd2-link:hover{
  background: var(--nd2-accent-soft);
  color: var(--nd2-accent);
}

.nd2-link.is-active{
  background: var(--nd2-accent-soft);
  color: var(--nd2-accent);
  font-weight:600;
}

/* Right actions wrapper */
.nd2-nav-actions{
  display:flex;
  align-items:center;
  gap:10px;
  margin-left: 6px;
}

/* ================= BUTTONS ================= */

.nd2-cta,
.nd2-user,
.nd2-dd-btn{
  padding:9px 14px;
  border-radius: var(--nd2-radius-sm);
  font-size:14px;
  border: 1px solid var(--nd2-line);
  background: #fff;
  color: var(--nd2-text);
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  gap:8px;
  transition: .15s ease;
  line-height: 1;
}

.nd2-dd-btn:hover,
.nd2-user:hover{
  background: var(--nd2-accent-soft);
  border-color: rgba(14,165,233,.35);
}

.nd2-cta{
  background: var(--nd2-accent);
  color:#fff;
  border-color: var(--nd2-accent);
}

.nd2-cta:hover{
  background:#0284c7;
  border-color:#0284c7;
}

.nd2-user-dot{
  width:8px;
  height:8px;
  border-radius:50%;
  background: var(--nd2-success);
}

/* Caret */
.nd2-caret{
  width:0;height:0;
  border-left:4px solid transparent;
  border-right:4px solid transparent;
  border-top:6px solid var(--nd2-muted);
  transition: transform .15s ease;
}

/* Rotate caret when open */
.nd2-dd.is-open > .nd2-dd-btn .nd2-caret,
.nd2-dd.is-open > .nd2-user .nd2-caret,
.nd2-dd.is-open > .nd2-cta .nd2-caret{
  transform: rotate(180deg);
}

/* ================= DROPDOWN ================= */

.nd2-dd{ position:relative; }

/* Base menu */
.nd2-dd-menu{
  position:absolute;
  right:0;
  min-width: 220px;
  max-width: 320px;
  background:#fff;
  border:1px solid var(--nd2-line);
  border-radius: var(--nd2-radius);
  box-shadow: var(--nd2-shadow);
  padding:8px;
  display:none;

  /* smooth reveal */
  transform: translateY(6px);
  opacity: 0;
  transition: opacity .15s ease, transform .15s ease;
}

/* Default open direction (down) */
.nd2-dd-menu{
  top: calc(100% + 10px);
}

/* Menu items */
.nd2-dd-menu a{
  display:block;
  padding:9px 10px;
  border-radius:10px;
  text-decoration:none;
  color: var(--nd2-text);
  font-size:14px;
}

.nd2-dd-menu a:hover{
  background: var(--nd2-accent-soft);
  color: var(--nd2-accent);
}

/* Open state */
.nd2-dd.is-open > .nd2-dd-menu{
  display:block;
  opacity: 1;
  transform: translateY(0);
}

/* ================= SOCIAL ================= */

.nd2-social .needs_topul02{
  display:flex;
  gap:8px;
  margin:0;
  padding:0;
  list-style:none;
}

.nd2-social .needs_topul02 a{
  display:flex;
  align-items:center;
  justify-content:center;
  width:30px;
  height:30px;
  border-radius:8px;
  background:#fff;
  border:1px solid var(--nd2-line);
  transition:.15s ease;
}

.nd2-social .needs_topul02 a:hover{
  background: var(--nd2-accent-soft);
  border-color: var(--nd2-accent);
}

.nd2-social img{
  width:16px;
  height:16px;
}

/* ================= MOBILE ================= */

.nd2-burger{
  display:none;
  width:40px;
  height:40px;
  border-radius: var(--nd2-radius-sm);
  border:1px solid var(--nd2-line);
  background:#fff;
  cursor:pointer;
}

.nd2-burger span{
  display:block;
  width:18px;
  height:2px;
  background: var(--nd2-text);
  margin:5px auto;
}

@media (max-width: 991.98px){

  .nd2-burger{ display:block; }

  .nd2-nav{
    position:absolute;
    left:0; right:0;
    top:100%;
    background:#fff;
    border-bottom:1px solid var(--nd2-line);
    padding:16px;
    flex-direction:column;
    display:none;
    gap:10px;
  }

  .nd2-nav.is-open{ display:flex; }

  .nd2-link,
  .nd2-dd-btn,
  .nd2-user,
  .nd2-cta{
    width:100%;
    justify-content:space-between;
  }

  /* Mobile dropdown inside accordion-style list */
  .nd2-dd-menu{
    position:static;
    margin-top:6px;
    box-shadow:none;
    transform:none;
    opacity: 1;
    display:none;
    max-width: none;
  }

  .nd2-dd.is-open > .nd2-dd-menu{
    display:block;
  }
}

/* ================= FIX: TOPBAR DROPDOWN (Registration) =================
   Prevent overlap with main header by opening UP (drop-up).
   This targets only dropdowns inside .nd2-topbar.
*/
.nd2-topbar .nd2-dd-menu{
  top: auto;
  bottom: calc(100% + 10px);
}

/* Ensure topbar dropdown stays clickable above everything */
.nd2-topbar .nd2-dd-menu{
  z-index: 1100;
}

/* Small screens: keep inside viewport */
@media (max-width: 480px){
  .nd2-topbar .nd2-dd-menu{
    right: 0;
    left: auto;
    min-width: 200px;
  }
}
