/* ===========================
   Header / Navigation Styles
   =========================== */

/* ── Wrapper ──────────────────────────────────────────────────────────────── */
.top-nav-wrapper {
  width: 100%;
  position: sticky;
  top: 0;
  z-index: 900;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  animation: nav-fadein 0.18s ease;
}

@keyframes nav-fadein {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: #5C6BC0;
  padding: 10px 24px;
  color: #fff;
  font-family: Arial, sans-serif;
  min-height: 56px;
}

/* ── Logo ──────────────────────────────────────────────────────────────────── */
.top-nav .logo { flex-shrink: 0; }
.top-nav .logo a {
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.3px;
  white-space: nowrap;
}
.top-nav .logo a:hover { opacity: 0.85; }

/* ── Search bar ───────────────────────────────────────────────────────────── */
.nav-search {
  flex: 1;
  min-width: 0;
  max-width: 440px;
  margin: 0 8px;
  position: relative;
}
.nav-search-inner {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.13);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 8px;
  height: 36px;
  overflow: visible;
  position: relative;
  transition: background 0.2s, border-color 0.2s;
}
.nav-search-inner:focus-within {
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.6);
}
.nav-search-type-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  background: rgba(0,0,0,0.15);
  border: none;
  border-right: 1px solid rgba(255,255,255,0.25);
  border-radius: 7px 0 0 7px;
  color: rgba(255,255,255,0.92);
  padding: 0 10px;
  height: 100%;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
  letter-spacing: 0.01em;
}
.nav-search-type-btn:hover { background: rgba(0,0,0,0.25); }
.nav-search-type-btn svg { flex-shrink: 0; }
.nav-search-type-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.18);
  min-width: 150px;
  z-index: 9999;
  overflow: hidden;
  padding: 4px 0;
}
.nav-search-type-menu.open { display: block; }
.nav-search-type-option {
  padding: 10px 16px;
  font-size: 0.85rem;
  color: #333;
  cursor: pointer;
  transition: background 0.15s;
}
.nav-search-type-option:hover { background: #f0f2fb; }
.nav-search-type-option.active { background: #eef2ff; color: #3949ab; font-weight: 600; }
.nav-search-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 0.85rem;
  padding: 0 10px;
  height: 100%;
  font-family: Arial, sans-serif;
}
.nav-search-input::placeholder { color: rgba(255,255,255,0.55); }
.nav-search-btn {
  flex-shrink: 0;
  background: transparent;
  border: none;
  border-left: 1px solid rgba(255,255,255,0.25);
  color: rgba(255,255,255,0.85);
  padding: 0 11px;
  height: 100%;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}
.nav-search-btn:hover { color: #fff; }

/* ── Nav links ────────────────────────────────────────────────────────────── */
#main-nav { flex-shrink: 0; }
.top-nav nav ul {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 0;
}
.top-nav nav ul li a,
.top-nav nav ul li .dropbtn {
  color: rgba(255,255,255,0.92);
  text-decoration: none;
  padding: 6px 11px;
  border-radius: 5px;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.18s, color 0.18s;
  display: inline-block;
  background: none;
  border: none;
  font-family: Arial, sans-serif;
}
.top-nav nav ul li a:hover,
.top-nav nav ul li .dropbtn:hover {
  background: rgba(255,255,255,0.18);
  color: #fff;
}
.top-nav nav ul li a.nav-upgrade,
.top-nav nav ul li .dropbtn.nav-upgrade {
  background: rgba(255,255,255,0.13);
  border: 1.5px solid rgba(255,255,255,0.6);
  color: #fff;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.83rem;
  letter-spacing: 0.01em;
  transition: background 0.18s, border-color 0.18s;
}
.top-nav nav ul li a.nav-upgrade:hover,
.top-nav nav ul li .dropbtn.nav-upgrade:hover {
  background: rgba(255,255,255,0.28);
  border-color: #fff;
}
.top-nav nav ul li a.nav-signin {
  background: #fff;
  color: #3949ab;
  font-weight: 700;
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 0.83rem;
  letter-spacing: 0.01em;
}
.top-nav nav ul li a.nav-signin:hover { background: #e8eaff; color: #3949ab; }

/* ── Dropdown ──────────────────────────────────────────────────────────────── */
li.dropdown { position: relative; }
li.dropdown .dropdown-content {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: #fff;
  min-width: 200px;
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.14);
  z-index: 9999;
  padding: 6px 0;
  overflow: hidden;
}
li.dropdown.upgrade-dropdown .dropdown-content { min-width: 240px; }
#nav-links li:last-child .dropdown-content,
#nav-links li.align-right .dropdown-content { left: auto; right: 0; }
li.dropdown .dropdown-content a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 16px;
  color: #2d2d3a;
  text-decoration: none;
  font-size: 0.88rem;
  transition: background 0.15s;
  gap: 12px;
}
li.dropdown .dropdown-content a:hover { background: #f0f2fb; color: #3949ab; }
li.dropdown .dropdown-content .dd-header {
  display: block;
  padding: 8px 16px 4px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #9fa8bc;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
li.dropdown .dropdown-content .dd-divider { height: 1px; background: #eef0f8; margin: 6px 0; }
.dd-meta { font-size: 0.78rem; color: #9fa8bc; font-weight: 400; flex-shrink: 0; }
li.dropdown .dropdown-content a:hover .dd-meta { color: #7986cb; }
li.dropdown:hover .dropdown-content,
li.dropdown .dropdown-content[style*="display: block"] { display: block; }
/* Hover bridge — fills gap so mouse can move between nav item and dropdown */
li.dropdown .dropdown-content::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 0;
  right: 0;
  height: 10px;
}

/* ── Hamburger ─────────────────────────────────────────────────────────────── */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 6px;
  flex-shrink: 0;
  z-index: 1100;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.22s, opacity 0.22s;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-search-row { display: none; }

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media screen and (max-width: 900px) {
  .nav-search { max-width: 260px; }
  .nav-search-type-btn { display: none; }
  .nav-search-inner { border-radius: 8px; }
  .nav-search-input { padding: 0 4px 0 12px; }
}
@media screen and (max-width: 768px) {
  .nav-search { display: none; }
  .hamburger { display: flex; }
  .top-nav { padding: 10px 16px; }
  #main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #5C6BC0;
    z-index: 1000;
    border-top: 1px solid rgba(255,255,255,0.15);
    box-shadow: 0 6px 16px rgba(0,0,0,0.22);
  }
  #main-nav.open { display: block; }
  .mobile-search-row {
    display: block;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
  }
  .mobile-search-row .nav-search { display: flex; max-width: 100%; margin: 0; }
  .mobile-search-row .nav-search-inner { border-radius: 8px; height: 40px; }
  .mobile-search-row .nav-search-type-btn { display: none; }
  .mobile-search-row .nav-search-input { padding: 0 12px; font-size: 0.9rem; }
  .top-nav nav ul { flex-direction: column; align-items: stretch; gap: 0; padding: 6px 0 10px; }
  .top-nav nav ul li a,
  .top-nav nav ul li .dropbtn { display: block; padding: 11px 20px; border-radius: 0; font-size: 0.92rem; font-weight: 500; }
  .top-nav nav ul li a.nav-upgrade,
  .top-nav nav ul li .dropbtn.nav-upgrade { margin: 8px 16px; border-radius: 8px; text-align: center; }
  .top-nav nav ul li a.nav-signin { margin: 8px 16px; border-radius: 8px; text-align: center; color: #3949ab; }
  li.dropdown .dropdown-content {
    position: static;
    box-shadow: none;
    border-radius: 0;
    background: rgba(0,0,0,0.14);
    padding: 0;
    min-width: 0;
  }
  li.dropdown .dropdown-content a { padding: 9px 20px 9px 34px; color: rgba(255,255,255,0.88); font-size: 0.85rem; }
  li.dropdown .dropdown-content a:hover { background: rgba(255,255,255,0.1); color: #fff; }
  li.dropdown .dropdown-content .dd-header { padding: 10px 20px 4px 34px; color: rgba(255,255,255,0.5); }
  li.dropdown .dropdown-content .dd-divider { background: rgba(255,255,255,0.15); }
  .dd-meta { color: rgba(255,255,255,0.5); }
  li.dropdown:hover .dropdown-content { display: none; }
}

/* =============================
   RESET & VARIABLES
   ============================= */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary-color:  #5C6BC0;  /* base periwinkle — hsl(224, 30%, 50%) */
  --primary-dark:   #3949AB;  /* darker periwinkle — buttons, CTAs      */
  --primary-darker: #2D3252;  /* deep indigo — hover states              */
  --secondary-color: #F4F0EB;
  --text-color: #2A2840;
  --link-color: var(--primary-dark);
  --link-hover-color: var(--primary-darker);
  --footer-bg: #5C6BC0;
  --footer-text: #ffffff;
  --card-bg: #fafafa;
  --border-light: #E6E2DA;
}

body {
  font-family: Arial, sans-serif;
  background-color: var(--secondary-color);
  color: var(--text-color);
  line-height: 1.6;
}

/* ── Header placeholder — reserves space + matches nav background colour
   so the page doesn't jump when the nav fetches and injects ─────────── */
#header-placeholder:empty {
  min-height: 56px;
  background: #5C6BC0;
}

/* =============================
   FORM INPUTS — LIGHT MODE BASE
   Always explicit so OS dark mode can't bleed through.
   ============================= */
input,
select,
textarea {
  background-color: #ffffff;
  color: #2A2840;
  border: 1.5px solid #E6E2DA;
  border-radius: 6px;
  font-family: inherit;
}

/* Chrome/Safari autofill override — light mode */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0px 1000px #ffffff inset !important;
  -webkit-text-fill-color: #2A2840 !important;
  transition: background-color 99999s ease-in-out 0s;
}

/* =============================
   TOP NAV / HEADER
   ============================= */
.top-nav {
  width: 100%;
  background-color: var(--primary-color);
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 25px;
}

.top-nav .logo a {
  color: #fff;
  text-decoration: none;
  font-weight: bold;
  font-size: 1.4rem;
}

.top-nav nav ul {
  list-style: none;
  display: flex;
  gap: 20px;
}

.top-nav nav ul li a,
.dropbtn {
  color: #fff;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.top-nav nav ul li a:hover,
.dropbtn:hover {
  background-color: rgba(255,255,255,0.2);
}

/* Dropdown */
.dropdown {
  position: relative;
}

.dropdown-content {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff;
  min-width: 180px;
  border-radius: 6px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  z-index: 1000;
  margin-top: -4px;
  padding-top: 4px;
}

/* Last nav dropdown (gear/account) aligns to the right so it doesn't overflow */
#nav-links li:last-child .dropdown-content {
  left: auto;
  right: 0;
}

.dropdown-content a {
  display: block;
  padding: 10px 15px;
  color: #333;
  text-decoration: none;
}

.dropdown-content a:hover {
  background-color: #f0f0f0;
}

.dropdown:hover .dropdown-content,
.dropdown .dropdown-content[style*="display: block"] {
  display: block;
}

/* =============================
   PAGE LAYOUT
   ============================= */
.page-wrapper {
  display: flex;
  gap: 20px;
  margin: 20px;
}

/* Sidebar */
.sidebar-nav {
  width: 220px;
  background-color: #f9f9f9;
  border-right: 1px solid var(--border-light);
  padding: 20px;
  border-radius: 6px;
  flex-shrink: 0;
}

.sidebar-nav h3 {
  font-size: 1.1rem;
  margin-bottom: 10px;
  border-bottom: 1px solid #ccc;
}

.sidebar-nav ul {
  list-style: none;
}

.sidebar-nav li {
  margin-bottom: 10px;
}

.sidebar-nav a {
  text-decoration: none;
  color: #333;
  font-weight: 500;
}

.sidebar-nav a:hover {
  color: var(--primary-color);
}

/* =============================
   PROJECT MAIN AREA
   ============================= */
.project-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.project-columns {
  display: flex;
  gap: 20px;
}

.left-col,
.right-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* =============================
   PROJECT INFO BOXES
   ============================= */
#main-project-info {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  background-color: var(--card-bg);
  padding: 15px;
  border-radius: 6px;
}

.project-detail {
  background-color: var(--card-bg);
  padding: 10px;
  border-radius: 6px;
  border: 1px solid #eee;
  display: flex;
  flex-direction: column;
}

.project-detail label {
  font-weight: 600;
  font-size: 0.9rem;
}

.project-detail span,
.project-detail a {
  font-size: 0.9rem;
  color: #555;
  word-break: break-word;
}

#project-fields {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
}

/* =============================
   MAP & IMAGES
   ============================= */
#project-map {
  width: 100%;
  height: 300px;
  border-radius: 6px;
  border: 1px solid #ccc;
}

.right-col img {
  width: 100%;
  height: 300px;
  object-fit: cover;
  border-radius: 6px;
}

/* =============================
   SIMILAR OPPORTUNITIES
   ============================= */
#similar-opportunities h3 {
  margin-bottom: 10px;
}

#similar-list {
  list-style: none;
  display: flex;
  gap: 15px;
  overflow-x: auto;
}

#similar-list li {
  min-width: 280px;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 12px;
}

#similar-list a {
  font-weight: bold;
  color: var(--link-color);
  text-decoration: none;
}

#similar-list a:hover {
  text-decoration: underline;
}

/* =============================
   BUTTONS
   ============================= */
button {
  background-color: var(--primary-color);
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 4px;
  cursor: pointer;
}

button:hover {
  background-color: var(--primary-darker);
}

/* =============================
   FOOTER
   ============================= */
footer {
  background-color: var(--footer-bg);
  color: var(--footer-text);
  text-align: center;
  padding: 20px;
  margin-top: 50px;
}

footer a {
  color: #cbd3f2;
}

/* ── Rightmove-style multi-column footer ── */
.ll-footer {
  background: #1a1f3c;
  color: #c5cae9;
  padding: 48px 0 0;
  margin-top: 0;
  text-align: left;
  font-size: 0.875rem;
}

.ll-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.ll-footer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
  padding-bottom: 40px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.ll-footer-col h3 {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #ffffff;
  margin: 0 0 14px;
}

.ll-footer-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ll-footer-col ul li a {
  color: #9fa8da;
  text-decoration: none;
  line-height: 1.4;
  transition: color 0.15s;
}

.ll-footer-col ul li a:hover {
  color: #ffffff;
}

.ll-footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
  font-size: 0.8rem;
  color: #7986cb;
  flex-wrap: wrap;
  gap: 8px;
}

.ll-footer-bottom-links {
  display: flex;
  gap: 20px;
}

.ll-footer-bottom-links a {
  color: #7986cb;
  text-decoration: none;
  transition: color 0.15s;
}

.ll-footer-bottom-links a:hover {
  color: #ffffff;
}

/* ── CLS prevention ────────────────────────────────────────────────────────────
   These :empty rules reserve layout space for async-injected header and footer
   so that when JS fetches and injects the HTML, the page doesn't shift.
   :empty stops matching once children are injected, so the actual content
   determines height from that point on.
   ─────────────────────────────────────────────────────────────────────────── */
#header-placeholder:empty {
  display: block;
  min-height: 56px;
  background: #5C6BC0; /* matches .top-nav background */
}
#footer-placeholder:empty {
  display: block;
  min-height: 280px;
}

@media (max-width: 900px) {
  .ll-footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 520px) {
  .ll-footer-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .ll-footer-bottom {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Dark mode — footer is already dark, just ensure link colours hold */
[data-theme="dark"] .ll-footer {
  background: #111526;
}

/* =============================
   RESPONSIVE
   ============================= */
@media (max-width: 1200px) {
  .project-columns {
    flex-direction: column;
  }

  #project-fields {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .page-wrapper {
    flex-direction: column;
    margin: 10px;
  }

  .sidebar-nav {
    display: none;
  }

  .top-nav nav ul {
    gap: 10px;
  }
}
