/*
Theme Name: _nuaportal
Theme URI: https://nuaportal.org.uk
Author: Your Name
Description: Full theme stylesheet for NUA Portal — responsive sidebar, header, and dashboard UI.
Version: 2.0
*/

/* ==============================================
   BASE STRUCTURE
   ============================================== */
html, body {
  height: 100%;
  margin: 0;
  overflow-x: hidden;
  background-color: #f9f9f9;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

#nua-layout {
  display: flex;
  flex-direction: row;
  min-height: 100vh;
  width: 100%;
}

.main-wrapper {
  flex: 1;
  min-height: 100vh;
  background-color: #f9f9f9;
  overflow-x: hidden;
}

/* ==============================================
   SIDEBAR
   ============================================== */
#sidebar {
  width: 300px;
  background: linear-gradient(100deg, #00468C, #111) !important;
  color: #FFF !important;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: relative; /* Not fixed, scrolls with page */
  height: auto;
  min-height: 100%;
  transition: transform .3s ease, width .2s ease;
  z-index: 10;
}

.sidebar-inner {
  padding: 20px;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.sidebar-header {
  text-align: left !important;                     /* was center */
  border-bottom: 1px solid rgba(255,255,255,0.18);
  padding-bottom: 12px;
  word-wrap: normal;                                /* was break-word */
  word-break: normal;                               /* was break-all */
  overflow: visible;                                /* was hidden */
  max-width: 100%;
}

.sidebar_data {
  margin-top: 12px;
  word-wrap: normal;                                /* was break-word */
  word-break: normal;                               /* was break-all */
  text-align: left !important;                     /* was center */
  overflow: visible;                                /* was hidden */
  max-width: 100%;
}

/* icons in header area forced to white */
.sidebar-header .bi,
.sidebar-header i,
.sidebar-header svg,
.sidebar_data .bi,
.sidebar_data i,
.sidebar_data svg {
  color: #fff !important;
  fill: #fff !important;
}



.sidebar-logo {
  width: 80%;
  max-width: 200px;
}


.sidebar_data h5,
.sidebar_data p,
.sidebar_data small {
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  display: block;
  width: 100%;
}

@media (max-width: 767.98px) {
  .sidebar_data h5,
  .sidebar_data p,
  .sidebar_data small {
    white-space: normal; /* wrap text on mobile */
  }
}

.sidebar_data i {
  color: #4DA3FF;
  margin-right: 6px;
}

.sidebar-body {
  flex-grow: 1;
  overflow-y: auto;
}

/* Sidebar nav links */
#sidebar .nav .nav-link {
  display: block;
  color: #FFF !important;
  background: transparent;
  border-radius: 6px;
  padding: 10px 14px;
  margin: 6px 0;
  transition: background .2s ease, color .2s ease;
}

#sidebar .nav .nav-link:hover {
  background: #FFF;
  color: #00468C !important;
}

#sidebar .nav .nav-link.active {
  background: #FFF !important;
  color: #00468C !important;
}

/* ==============================================
   DESKTOP COLLAPSE
   ============================================== */
.sidebar-hamburger { display: none; }

body.sidebar-collapsed #sidebar {
  width: 0;
  overflow: hidden;
}

body.sidebar-collapsed .sidebar-hamburger {
  display: inline-flex !important;
}

/* ==============================================
   MOBILE SIDEBAR – FULL HEIGHT + SCROLLABLE
   ============================================== */
@media (max-width: 767.98px) {
  #sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 300px;
    height: 100%;
    min-height: 100vh;
    background: linear-gradient(100deg, #00468C, #111);
    color: #fff;
    transform: translateX(-100%);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transition: transform 0.3s ease;
  }

  body.sidebar-open #sidebar {
    transform: translateX(0);
  }

  html, body {
    height: 100%;
    overflow-x: hidden;
  }
}


/* ==============================================
   HEADER (FULL, CLEAN, WITH FIXES)
   ============================================== */
#nua-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
}

#nua-header .header-inner {
  display: grid;
  /* prevent middle column from stretching weirdly */
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
}

/* Left: brand/logo + optional hamburger */
.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

/* HARD-LOCK logo size so globals can't blow it up */
#nua-header .brand-img {
  height: 36px !important;
  width: auto !important;
  max-width: none !important;
  display: block;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ----------------------------------------------
   Center: Search (centered, unchanged layout)
   ---------------------------------------------- */
#nua-header .header-search {
  justify-self: center;       /* centers in the middle grid column */
  display: flex;
  align-items: center;
  position: relative;         /* anchor for suggestions dropdown */
}

#nua-header .header-search input {
  width: 360px;
}

@media (max-width: 991.98px) {
  #nua-header .header-search input {
    width: 260px;
  }
}

@media (max-width: 767.98px) {
  #nua-header .header-search {
    display: none !important; /* keep your original mobile rule */
  }
}

/* Suggestions dropdown (if JS is enabled) */
#nua-header .search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1000;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: .5rem;
  margin-top: .25rem;
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
  overflow: hidden;
  display: none;              /* JS toggles to block */
}

#nua-header .search-suggestions .item {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .75rem;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#nua-header .search-suggestions .item:hover,
#nua-header .search-suggestions .item.active {
  background: #f3f4f6;
}

#nua-header .search-suggestions .type {
  font-size: .75rem;
  color: #6b7280;
  margin-left: auto;
}

/* Right area (kept as-is) */
.header-right {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.sidebar-hamburger.btn {
  padding: 6px 10px;
}

/* ==============================================
   GLOBAL LINKS
   ============================================== */
:root {
  --link:#0d6efd;
  --link-hover:#0a58ca;
  --nav-active-bg:#FFF;
  --nav-active-text:#00468C;
}

main a,
body a:not(#sidebar a) {
  color: var(--link);
  text-decoration: none;
}

main a:hover,
body a:not(#sidebar a):hover {
  color: var(--link-hover);
  text-decoration: none;
}

.header .nav .nav-link,
#topnav .nav .nav-link {
  padding: 8px 12px;
  transition: background .2s ease, color .2s ease;
  color: #FFF;
  margin: 10px 0;
}

.header .nav .nav-link:hover,
#topnav .nav .nav-link:hover {
  background: #FFF;
  color: var(--nav-active-text) !important;
}

.header .nav .nav-link.active,
#topnav .nav .nav-link.active {
  background: var(--nav-active-bg) !important;
  color: var(--nav-active-text) !important;
  border-radius: 6px;
}

/* Focus */
#sidebar .nav .nav-link:focus-visible,
.header .nav .nav-link:focus-visible,
#topnav .nav .nav-link:focus-visible,
main a:focus-visible {
  outline: 2px solid #FFF;
  outline-offset: 2px;
}

/* ==============================================
   CARDS + FORMS
   ============================================== */
.nua-shell {
  padding: 24px;
  margin: 0;
  max-width: none;
  width: 100%;
}

.nua-title {
  font-size: clamp(26px, 2.2vw, 34px);
  font-weight: 700;
  margin: 0 0 16px;
  color: #111;
}

.nua-notice {
  border-radius: 10px;
  padding: 10px 12px;
  margin: 0 0 16px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  color: #111827;
}

.nua-notice.success {
  border-color: #34d399;
  background: #ecfdf5;
  color: #065f46;
}

.nua-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 4px 18px rgba(16,24,40,.06);
  padding: 22px;
  margin-bottom: 24px;
}

/* ACF forms */
.nua-form .acf-form { margin:0; }
.nua-form .acf-fields { border:0; padding:0; }
.nua-form .acf-fields > .acf-field { border-top:0 !important; padding:10px 0 !important; }
.nua-form .acf-label label { font-weight:600; color:#111827; margin-bottom:6px; }
.nua-form .acf-input input[type="text"],
.nua-form .acf-input input[type="email"],
.nua-form .acf-input input[type="number"],
.nua-form .acf-input input[type="url"],
.nua-form .acf-input select,
.nua-form .acf-input textarea {
  width:100%;
  border:1px solid #e5e7eb;
  border-radius:10px;
  padding:10px 12px;
  background:#fff;
  outline:none;
  transition:border-color .15s, box-shadow .15s;
  box-shadow:0 1px 0 rgba(0,0,0,.02) inset;
}

.nua-form .acf-input textarea { min-height:120px; }

.nua-form .acf-input :focus {
  border-color:#93c5fd;
  box-shadow:0 0 0 4px rgba(59,130,246,.15);
}

@media (min-width: 768px) {
  .nua-form .acf-fields {
    display:grid;
    grid-template-columns:repeat(2, minmax(0,1fr));
    column-gap:22px;
  }

  .nua-form .acf-field-wysiwyg,
  .nua-form .acf-field[data-name="notes"] {
    grid-column:1 / -1;
  }
}

.nua-form .acf-form-submit { margin-top:14px; }

.nua-form .acf-form-submit input[type="submit"] {
  border:0;
  border-radius:10px;
  padding:12px 16px;
  font-weight:600;
  cursor:pointer;
  background:#2563eb;
  color:#fff;
  box-shadow:0 6px 14px rgba(37,99,235,.22);
  transition:transform .04s, box-shadow .15s, background .15s;
}

.nua-form .acf-form-submit input[type="submit"]:hover {
  background:#1d4ed8;
  box-shadow:0 8px 18px rgba(29,78,216,.28);
}

.nua-form .acf-form-submit input[type="submit"]:active {
  transform: translateY(1px);
}

/* ==============================================
   BUTTONS
   ============================================== */
.btn.btn_blue {
  color: #fff !important;
  background: linear-gradient(100deg,#6ac4e6,#00a4e2) !important;
  border: none !important;
}

.btn.btn_blue:hover {
  color: #fff !important;
  background: linear-gradient(100deg,#6ac4e6,#16b7f4) !important;
}

.btn.btn_red {
  color: #fff !important;
  background: linear-gradient(100deg,#FF2626,#FF4D4D) !important;
  border: none !important;
}

.btn.btn_red:hover {
  color: #fff !important;
  background: linear-gradient(100deg,#FF2626,#FF7373) !important;
}

.btn.btn-red {
  background:#ce473d !important;
  border: 1px solid #ce473d !important;
  color: white !important;
}

.btn.btn-red:hover {
  background:#fff !important;
  border: 1px solid #ce473d !important;
  color:#ce473d !important;
}

.btn_green {
    color: #fff !important;
    background: linear-gradient(100deg,#5fc9a1,#24b47e);
}

a.btn--nweb { color: #fff !important; }

/* ==============================================
   UTILITIES
   ============================================== */
.box-shadow {
  box-shadow: 0px 0px 25px 0px rgba(0, 0, 0, 0.03);
  transition: all 0.3s ease;
}

.boxed p {
  margin-top: 20px;
  margin-bottom: 20px;
}

.boxed {
  position: relative;
  overflow: hidden;
  padding: 30px !important;
  margin-bottom: 30px;
  border-radius: 6px;
}

/* ==============================================
   USER MENU
   ============================================== */
.user-menu .btn {
  border: none;
  font-weight: 600;
  color: #333;
}

.user-menu .btn:hover {
  background-color: #f3f3f3;
}

.user-menu .dropdown-menu {
  border-radius: 10px;
  padding: 0;
  overflow: hidden;
}
