/* ============================================
   JIN5G - Site Header & Navigation
   Dark theme: #050C40 main color
   ============================================ */

:root {
  --id-main: #050C40;
  --id-main-light: #0a1655;
  --id-main-dark: #030820;
  --id-primary: #F05325;
  --id-primary-dark: #c9441e;
  --id-primary-light: rgba(240, 83, 37, 0.2);
  --id-text: #e8e8e8;
  --id-text-muted: #b8c4d4;
  --id-text-bright: #ffffff;
  --id-border: rgba(255, 255, 255, 0.15);
  --id-card-bg: rgba(255, 255, 255, 0.06);
  --id-card-bg-hover: rgba(255, 255, 255, 0.1);
  --id-header-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  --id-nav-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

/* Global dark theme - site-wide */
body {
  background: var(--id-main) !important;
  color: var(--id-text) !important;
}
body .text-muted { color: var(--id-text-muted) !important; }
body .form-control,
body .form-select { background: var(--id-card-bg); border-color: var(--id-border); color: var(--id-text); }
body .form-control::placeholder { color: var(--id-text-muted); }
body .form-control:focus,
body .form-select:focus { background: var(--id-card-bg-hover); border-color: var(--id-primary); color: var(--id-text); }
body .card { background: var(--id-card-bg); border-color: var(--id-border); color: var(--id-text); }
body .table { color: var(--id-text); }
body .table th,
body .table td { border-color: var(--id-border); }
body .table-hover tbody tr:hover { background: var(--id-card-bg-hover); }
body h1, body h2, body h3, body h4, body h5, body h6 { color: var(--id-text-bright); }
body a { color: var(--id-text); }
body a:hover { color: var(--id-primary); }
body .bg-light { background: var(--id-card-bg) !important; }
body .bg-white { background: var(--id-card-bg) !important; }
body .border { border-color: var(--id-border) !important; }
body .form-label { color: var(--id-text) !important; }

/* ----- Top bar (contact strip) ----- */
.id-topbar {
  background: var(--id-main-light);
  color: rgba(255, 255, 255, 0.95);
  font-size: 0.8125rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.id-topbar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.id-topbar-welcome {
  font-weight: 500;
  letter-spacing: 0.02em;
}

.id-topbar-contact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem;
}

.id-topbar-contact a {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.id-topbar-contact a:hover {
  color: #fff;
  opacity: 0.9;
}

.id-topbar-contact i {
  font-size: 0.9rem;
  opacity: 0.9;
}

@media (max-width: 576px) {
  .id-topbar {
    font-size: 0.7rem;
    padding: 0.35rem 0;
  }
  .id-topbar-inner {
    justify-content: center;
    text-align: center;
    padding: 0 0.75rem;
    gap: 0.5rem 1rem;
  }
  .id-topbar-welcome {
    font-size: 0.7rem;
    line-height: 1.35;
  }
  .id-topbar-contact {
    justify-content: center;
    gap: 0.75rem;
  }
  .id-topbar-contact a {
    font-size: 0.7rem;
  }
}

/* ----- Main header (logo + welcome + primary nav + account) ----- */
.id-main-header {
  background: linear-gradient(180deg, var(--id-main-light) 0%, var(--id-main) 100%);
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--id-border);
  box-shadow: var(--id-header-shadow), var(--id-nav-shadow);
  position: relative;
  z-index: 1020;
}

.id-main-header-inner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  grid-template-areas: "brand welcome nav actions";
  align-items: center;
  gap: 0.65rem 1rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Logged-out: no account column */
.id-main-header-inner:not(.id-main-header-inner--has-actions) {
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "brand welcome nav";
}

/* Logo row — single grid cell (desktop); centered on mobile */
.id-header-row-brand {
  grid-area: brand;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 0.75rem;
  min-width: 0;
  width: 100%;
}

.id-header-row-brand .id-logo-wrap {
  flex: 0 1 auto;
  min-width: 0;
  text-align: left;
}

@media (min-width: 992px) {
  .id-header-row-brand {
    width: auto;
  }
}

/* Welcome + mobile menu: one row on small screens; display:contents on lg+ for grid */
.id-header-mobile-row2 {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
  width: 100%;
}

@media (min-width: 992px) {
  .id-header-mobile-row2 {
    display: contents;
  }
}

.id-header-mobile-row2 .id-header-welcome {
  flex: 1;
  min-width: 0;
  text-align: left;
}

@media (min-width: 992px) {
  .id-header-mobile-row2 .id-header-welcome {
    flex: unset;
    text-align: center;
  }
}

.id-header-mobile-row2 .id-mobile-menu-btn {
  flex-shrink: 0;
}

.id-logo-wrap {
  flex-shrink: 0;
}

.id-header-welcome {
  grid-area: welcome;
  margin: 0;
  padding: 0 0.35rem;
  min-width: 0;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.92);
  text-align: center;
  justify-self: stretch;
}

.id-header-welcome-text {
  display: block;
}

/* Primary nav: right-aligned next to logo + centered welcome */
.id-header-primary-nav {
  grid-area: nav;
  min-width: 0;
  align-self: center;
  padding: 0;
  justify-self: end;
}

/* Mobile menu trigger (offcanvas) — in .id-header-mobile-row2 on small screens */
.id-mobile-menu-btn {
  align-self: center;
}

.id-header-actions {
  grid-area: actions;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

@media (max-width: 991.98px) {
  /* Hide top contact strip on mobile */
  .id-topbar {
    display: none !important;
  }

  /*
   * Stack brand row, then welcome, then actions (must beat desktop
   * .id-main-header-inner:not(.id-main-header-inner--has-actions) which is 3 columns).
   */
  .id-main-header-inner:not(.id-main-header-inner--has-actions) {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem 0.75rem;
    grid-template-columns: unset;
    grid-template-rows: unset;
    grid-template-areas: none;
  }

  .id-main-header-inner.id-main-header-inner--has-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem 0.75rem;
    grid-template-columns: unset;
    grid-template-rows: unset;
    grid-template-areas: none;
  }

  .id-header-row-brand {
    width: 100%;
    flex: 0 0 auto;
    justify-content: center;
    align-items: center;
    margin-bottom: 0.65rem;
  }

  .id-header-row-brand .id-logo-wrap {
    text-align: center;
  }

  .id-header-row-brand .id-logo-wrap img {
    object-position: center center;
  }

  .id-header-mobile-row2 {
    flex: 0 0 auto;
    width: 100%;
  }

  .id-header-welcome {
    font-size: 0.8125rem;
    line-height: 1.35;
    text-align: left;
    padding-left: 0;
    padding-right: 0;
    min-width: 0;
  }

  .id-header-actions {
    flex: 0 0 auto;
    width: 100%;
    justify-content: center;
    padding-top: 0.15rem;
  }
}

@media (max-width: 576px) {
  .id-header-welcome {
    font-size: 0.75rem;
  }
}

@media (max-width: 400px) {
  .id-header-welcome {
    font-size: 0.7rem;
    line-height: 1.3;
  }
}

.id-logo-wrap a {
  display: block;
  line-height: 0;
}

.id-logo-wrap img {
  height: 72px;
  width: auto;
  max-width: 320px;
  object-fit: contain;
  object-position: left center;
}

/* Inline login form: compact and professional */
.id-login-form {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 0;
  height: 36px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--id-border);
  background: var(--id-card-bg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Icon + input wrapper */
.id-login-form .id-input-wrap {
  display: inline-flex;
  align-items: center;
  position: relative;
  flex: 0 0 auto;
}

.id-login-form .id-input-wrap i {
  position: absolute;
  left: 0.7rem;
  color: var(--id-text-muted);
  font-size: 0.95rem;
  pointer-events: none;
  z-index: 1;
  transition: color 0.2s ease;
}

.id-login-form .id-input-wrap:focus-within i {
  color: var(--id-primary);
}

.id-login-form .id-input-wrap:first-of-type {
  border-right: 1px solid var(--id-border);
}

.id-login-form .form-control {
  width: 150px;
  min-width: 0;
  font-size: 0.8125rem;
  border: none !important;
  border-radius: 0;
  padding: 0 0.75rem 0 2.15rem;
  height: 100%;
  background: var(--id-card-bg);
  color: var(--id-text);
}

.id-login-form .form-control:focus {
  box-shadow: none;
  outline: none;
}

.id-login-form .form-control::placeholder {
  color: var(--id-text-muted);
}

.id-login-form .id-btn-login {
  height: 100%;
  border-radius: 0;
  padding: 0 1rem;
  font-size: 0.8125rem;
  white-space: nowrap;
}

.id-btn-login {
  background: var(--id-primary) !important;
  color: #fff !important;
  border: none;
  font-weight: 600;
  font-size: 0.8125rem;
  padding: 0 1rem;
  height: 36px;
  line-height: 1;
  border-radius: 6px;
  transition: background 0.2s ease, color 0.2s ease;
}

.id-btn-login:hover {
  background: var(--id-primary-dark) !important;
  color: #fff !important;
}

.id-btn-account {
  background: var(--id-primary) !important;
  color: #fff !important;
  border: none;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  text-decoration: none;
  display: inline-block;
  transition: background 0.2s ease, transform 0.15s ease;
}

.id-btn-account:hover {
  background: var(--id-primary-dark) !important;
  color: #fff !important;
  transform: translateY(-1px);
}

.id-btn-logout {
  background: #dc3545 !important;
  color: #fff !important;
  border: none;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  text-decoration: none;
  display: inline-block;
  transition: background 0.2s ease, opacity 0.2s ease;
}

.id-btn-logout:hover {
  background: #bb2d3b !important;
  color: #fff !important;
}

@media (max-width: 768px) {
  .id-main-header {
    padding: 0.65rem 0;
  }
  .id-main-header-inner {
    padding: 0 0.75rem;
    gap: 0.5rem 0.75rem;
  }
  .id-logo-wrap img {
    max-height: 80px;
  }
  .id-login-form {
    width: auto;
    max-width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }
  .id-login-form .id-input-wrap {
    flex: 0 0 auto;
  }
  .id-login-form .form-control {
    width: 130px;
    min-width: 120px;
  }
}

@media (max-width: 576px) {
  .id-main-header {
    padding: 0.5rem 0;
  }
  .id-main-header-inner {
    padding: 0 0.6rem;
    gap: 0.5rem;
  }
  .id-logo-wrap img {
    max-height: 88px;
    max-width: min(100%, 280px);
  }
  .id-btn-account, .id-btn-logout {
    font-size: 0.8rem;
    padding: 0.4rem 0.75rem;
  }
}

@media (max-width: 400px) {
  .id-login-form {
    flex-direction: column;
    height: auto;
    width: 100%;
  }
  .id-login-form .id-input-wrap {
    width: 100%;
    border-right: none !important;
    border-bottom: 1px solid var(--id-border);
  }
  .id-login-form .id-input-wrap:last-of-type {
    border-bottom: none;
  }
  .id-login-form .form-control {
    width: 100% !important;
    max-width: 100%;
    height: 36px;
    flex: 1;
  }
  .id-login-form .id-btn-login {
    width: 100%;
  }
  .id-header-actions .d-flex {
    flex-direction: column;
    width: 100%;
  }
  .id-header-actions .d-flex a,
  .id-header-actions .d-flex .btn {
    width: 100%;
  }
}

/* ----- Primary navigation (inline in main header) ----- */
.id-navbar {
  padding: 0;
  min-height: 0;
}

/* Mobile hamburger — matches header theme */
.id-mobile-menu-btn {
  border: none;
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
  background: rgba(255, 255, 255, 0.15);
  transition: background 0.2s ease;
  line-height: 0;
  flex-shrink: 0;
}

.id-mobile-menu-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.id-mobile-menu-btn:focus {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
  outline: none;
}

.id-mobile-menu-btn .navbar-toggler-icon {
  display: inline-block;
  width: 1.35rem;
  height: 1.1rem;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 20' fill='none' stroke='rgba(255,255,255,0.95)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='M2 4h20M2 10h20M2 16h20'/%3e%3c/svg%3e");
  background-size: 1.35rem 1.1rem;
  background-repeat: no-repeat;
  background-position: center;
}

@media (max-width: 576px) {
  .id-mobile-menu-btn {
    padding: 0.45rem 0.55rem;
  }
  .id-mobile-menu-btn .navbar-toggler-icon {
    width: 1.25rem;
    height: 1rem;
    background-size: 1.25rem 1rem;
  }
}

.id-navbar .navbar-nav {
  gap: 0;
}

.id-navbar .nav-link {
  color: rgba(255, 255, 255, 0.95) !important;
  font-weight: 500;
  font-size: 0.9375rem;
  padding: 0.85rem 1rem !important;
  letter-spacing: 0.02em;
  border-bottom: 3px solid transparent;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.id-navbar .nav-link:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff !important;
  border-bottom-color: rgba(255, 255, 255, 0.5);
}

/* Highlight: Submit Your Business (theme orange) */
.id-navbar .nav-link.id-nav-link-cta {
  color: var(--id-primary) !important;
  font-weight: 600;
}

.id-navbar .nav-link.id-nav-link-cta:hover,
.id-navbar .nav-link.id-nav-link-cta:focus {
  color: #fff !important;
  background: var(--id-primary) !important;
  border-bottom-color: transparent;
}

.id-navbar .nav-link.dropdown-toggle::after {
  margin-left: 0.35em;
  vertical-align: 0.2em;
}

.id-navbar .dropdown-menu {
  border: 1px solid var(--id-border);
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  padding: 0.35rem 0;
  margin-top: 0;
  min-width: 220px;
  background: var(--id-main-light);
}

.id-navbar .dropdown-item {
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  color: var(--id-text);
  transition: background 0.15s ease, color 0.15s ease;
}

.id-navbar .dropdown-item:hover {
  background: var(--id-primary-light);
  color: var(--id-primary);
}

.id-navbar .dropdown-item:active {
  background: var(--id-primary-light);
}

/* Mobile nav */
.id-navbar .navbar-collapse {
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

@media (min-width: 992px) {
  .id-navbar .navbar-collapse {
    border-top: none;
  }
  .id-navbar .navbar-nav {
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
  }
  .id-header-primary-nav .nav-link {
    padding: 0.55rem 0.7rem !important;
    border-bottom: none;
    border-radius: 6px;
  }
  .id-header-primary-nav .nav-link:hover {
    border-bottom-color: transparent;
  }
  .id-header-primary-nav .nav-link.id-nav-link-cta:hover,
  .id-header-primary-nav .nav-link.id-nav-link-cta:focus {
    border-bottom-color: transparent;
  }
}

@media (max-width: 991px) {
  .id-main-header-inner {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  .id-navbar .nav-link {
    padding: 0.75rem 1rem !important;
    border-bottom: none;
    border-left: 3px solid transparent;
  }
  .id-navbar .nav-link:hover {
    border-left-color: rgba(255, 255, 255, 0.6);
  }
  .id-navbar .nav-link.id-nav-link-cta:hover,
  .id-navbar .nav-link.id-nav-link-cta:focus {
    border-left-color: var(--id-primary);
    color: #fff !important;
    background: var(--id-primary) !important;
  }
  .id-navbar .dropdown-menu {
    margin-left: 1rem;
    margin-bottom: 0.25rem;
    border-radius: 6px;
    min-width: 200px;
  }
}

/* ----- Mobile offcanvas navigation ----- */
.id-nav-offcanvas {
  width: min(100vw - 2.5rem, 20rem);
  background: linear-gradient(180deg, var(--id-main-light) 0%, var(--id-main) 100%);
  border-right: 1px solid var(--id-border);
  color: var(--id-text);
  box-shadow: 8px 0 32px rgba(0, 0, 0, 0.45);
}

.id-nav-offcanvas .offcanvas-header {
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--id-border);
  padding: 1rem 1.1rem;
}

.id-offcanvas-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid var(--id-border);
  background: rgba(255, 255, 255, 0.06);
}

.id-offcanvas-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--id-text-bright);
  margin: 0;
}

.id-offcanvas-close {
  opacity: 0.85;
  flex-shrink: 0;
}

.id-offcanvas-close:focus {
  box-shadow: 0 0 0 2px rgba(240, 83, 37, 0.5);
}

.id-nav-offcanvas .offcanvas-body {
  padding: 1rem 1.1rem 1.5rem;
  min-height: calc(100% - 4.5rem);
}

.id-offcanvas-nav .nav-link {
  color: rgba(255, 255, 255, 0.95) !important;
  font-weight: 500;
  font-size: 1rem;
  padding: 0.75rem 1rem !important;
  border-radius: 8px;
  border-left: 3px solid transparent;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.id-offcanvas-nav .nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
  border-left-color: rgba(255, 255, 255, 0.55);
  color: #fff !important;
}

.id-offcanvas-link-cta {
  color: var(--id-primary) !important;
  font-weight: 600 !important;
}

.id-offcanvas-link-cta:hover {
  background: var(--id-primary) !important;
  color: #fff !important;
  border-left-color: transparent !important;
}

.id-offcanvas-account {
  border-top: 1px solid var(--id-border);
}

.id-offcanvas-account-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--id-text-muted);
  margin: 0 0 0.65rem 0;
}

.id-offcanvas-account-btn {
  width: 100%;
  justify-content: center;
}

/* Error message in header */
.id-header-error {
  font-size: 0.875rem;
  margin-top: 0.5rem;
}
