/* ==============================
   GLOBAL STYLES
   ============================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(180deg, #071024 0%, #071a2a 100%);
  color: #e0e6ef;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
main {
  flex: 1; /* take all remaining space */
  margin-left: var(--sidebar-collapsed-width);
}
h2, h3 {
  padding-bottom: 1rem;
}
@media (max-width: 768px) {
  /* Remove left margin on small screens */
  main,
  .content {
    margin-left: 0 !important;
    width: 100%;
  }
  /* Full-width headers */
  .page-header,
  .page-subheader {
    white-space: normal;      /* ensures normal wrapping */
    overflow-wrap: normal;    /* no breaking inside words */
    word-break: normal;       /* no forced breaking */
    max-width: 100%;          /* allows shrink-to-fit */
  }
}


/* ==============================
   SIDEBAR
   ============================== */
:root {
  --sidebar-collapsed-width: 80px;
  --sidebar-expanded-width: 260px;
}
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: var(--sidebar-collapsed-width);
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 1rem;
  transition: width 0.3s ease, background 0.3s ease;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  overflow-y: auto;
  scrollbar-width: none; /* hide scrollbar for cleaner look */
  flex-shrink: 0; /* sidebar doesn’t shrink */
  z-index: 1000;
}
.sidebar::-webkit-scrollbar {
  display: none;
}
.sidebar:hover {
  width: var(--sidebar-expanded-width);
  background: rgba(0, 0, 0, 0.45);
background: rgba(16, 24, 42, 0.95);

}
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: center; /* centers content horizontally */
  position: relative;      /* for absolute centering trick if needed */
  width: 100%;
  padding: 1rem 1rem;
}
.sidebar:hover .sidebar-header .title,
.sidebar.expanded .sidebar-header .title {
  margin-left: 1rem;  /* adjust spacing as needed */
}
.sidebar-header .title {
  color: #ffffff;              /* keep it white */
  font-size: 2rem;             /* larger for prominence */
  font-weight: 700;            /* bold */
  letter-spacing: 1px;         /* slight spacing for readability */
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  white-space: nowrap;
  position: absolute;
  left: 100%;                  /* move out of view when collapsed */
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4); /* subtle depth */
  text-align: center;
}
/* Expanded state */
.sidebar:hover .sidebar-header .title {
  opacity: 1;
  position: static;
  pointer-events: auto;
  transform: none;
}
/* Hover/expanded state */
.sidebar:hover .sidebar-header {
  justify-content: flex-start;
  padding: 1rem;
}
.sidebar:hover .sidebar-header .title {
  opacity: 1;
  position: static;
  pointer-events: auto;
}
/* Remove underline / focus border from the EngLab link */
.sidebar-header a,
.sidebar-header a:visited,
.sidebar-header a:hover,
.sidebar-header a:focus {
  color: white;
  text-decoration: none;     /* removes underline */
  outline: none;             /* removes focus border */
  box-shadow: none;          /* removes any purple/blue focus ring */
}
.sidebar ul {
  list-style: none;
  padding: 2rem 0 0 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center; /* Centers icons horizontally */
}
.sidebar ul li {
  width: 100%;
  display: flex;
  justify-content: center; /* Centers icon in collapsed state */
}
.sidebar ul li a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: clamp(0.5rem, 1.5vh, 1rem);
  gap: clamp(0.5rem, 1vh, 1rem);
  color: white;
  text-decoration: none;
  transition: background 0.3s, justify-content 0.3s, padding-left 0.3s;
  white-space: nowrap;
}
.sidebar ul li a:hover {
  background: rgba(255,255,255,0.1);
}
.sidebar ul li a .icon {
  text-align: center;
  font-size: 2rem; /* larger when collapsed */
  transition: font-size 0.3s ease, transform 0.3s ease, margin 0.3s ease;
}
.sidebar ul li a:hover .icon {
  transform: scale(1.15);
}
.sidebar:hover ul li a {
  justify-content: flex-start; /* Align icons + text when expanded */
}
.sidebar:hover ul li a .icon {
  font-size: 1.6rem; /* normal size when expanded */
}
.sidebar .text {
  display: none;
  opacity: 0;
  transition: opacity 0.3s;
}
.sidebar:hover .text {
  display: inline;
  opacity: 1;
}
.sidebar.expanded {
  width: var(--sidebar-expanded-width);
background: rgba(16, 24, 42, 0.95);
}
.sidebar.expanded .title,
.sidebar.expanded .text {
  opacity: 1;
}
.sidebar-search {
  position: relative;
  width: 100%;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
}
.sidebar-search input {
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  border: none;
  font-size: 0.95rem;
  outline: none;
  transition: all 0.3s;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  box-shadow: inset 0 0 6px rgba(255, 255, 255, 0.15);
}
.sidebar-search input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}
.sidebar-search .search-icon {
  position: absolute;
  left: 12px;
  font-size: 1.2rem;
  color: rgba(255, 255, 255, 0.8);
  pointer-events: none;
  transition: opacity 0.3s;
}
.sidebar.collapsed .sidebar-search input {
  width: 0;
  opacity: 0;
  pointer-events: none;
}
.sidebar.collapsed .sidebar-search .search-icon {
  opacity: 1;
}
.sidebar:hover .sidebar-search input,
.sidebar.expanded .sidebar-search input {
  width: 100%;
  opacity: 1;
  pointer-events: auto;
}
.sidebar:hover .sidebar-search .search-icon,
.sidebar.expanded .sidebar-search .search-icon {
  opacity: 0;
}
/* Sidebar search results dropdown */
.sidebar-search-results {
  position: absolute;
  top: 100%; /* directly below the search input */
  left: 0; 
  width: 100%; /* match search input width */
  background: #1e293b; /* dark theme */
  color: white;
  list-style: none;
  margin: 0;   
  padding: 0;  
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  z-index: 1100;
  max-height: 300px;
  overflow-y: auto; 
  overflow-x: hidden; /* prevent horizontal scroll */
  white-space: normal; /* allow wrapping */
  word-break: break-word; /* break long words if needed */
  text-align: left; /* left align text inside the list */
  display: none;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.sidebar-search-results.show { /* use JS to add this class when showing results */
  display: block;
  visibility: visible;
  opacity: 1;
}
.sidebar-search-results li {
  padding: 0.4rem 0.8rem; /* compact padding */
  cursor: pointer;
  display: block; /* full width items */
  font-size: 0.85rem; /* slightly smaller text */
}
.sidebar-search-results li,
.sidebar-search-results li * {
  display: block !important;   /* prevent flex centering */
  text-align: left !important; /* force text left */
}
.sidebar-search-results li:hover {
  background: rgba(255,255,255,0.1);
}
.sidebar-search-results li.no-match {
  cursor: default;
  color: rgba(255,255,255,0.6);
}
/* MOBILE SPECIFIC OVERRIDES */
@media (max-width: 768px) {
  /* Sidebar hidden by default */
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-expanded-width); /* full width */
  }

  /* Expanded state: visible and fully expanded */
  .sidebar.expanded {
    transform: translateX(0);
    width: var(--sidebar-expanded-width);
    background: rgba(16,24,42,0.95);
  }

  /* Disable hover styles */
  .sidebar:hover {
    width: var(--sidebar-expanded-width);
    background: rgba(16,24,42,0.95);
  }

  /* Always show text and align icons/text in expanded state */
  .sidebar.expanded .text,
  .sidebar.expanded .sidebar-header .title {
    opacity: 1;
    display: inline;
    position: static;
    pointer-events: auto;
  }

  .sidebar.expanded ul li a {
    justify-content: flex-start;
  }

  .sidebar.expanded ul li a .icon {
    font-size: 1.6rem;
  }

  .sidebar.expanded .sidebar-header {
    justify-content: flex-start;
    padding: 1rem;
  }

  .sidebar.expanded .sidebar-header .logo {
    position: static;
    transform: none;
    width: auto;
    margin-right: 1.5rem;
  }

  /* Sidebar search input fully visible */
  .sidebar.expanded .sidebar-search input {
    width: 100%;
    opacity: 1;
    pointer-events: auto;
  }
  .sidebar.expanded .sidebar-search .search-icon {
    opacity: 0;
  }
}
#mobileSidebarToggle {
  position: fixed;
  top: 15px;
  left: 15px;         /* initial position */
  width: 60px;         
  height: 60px;
  font-size: 2.2rem;
  background: rgba(16, 24, 42, 0.95);
  color: white;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  cursor: pointer;
  transition: transform 0.3s ease, opacity 0.3s ease, left 0.3s ease;
  opacity: 1;
}
/* Hide toggle when sidebar is open */
.sidebar.expanded ~ #mobileSidebarToggle {
  opacity: 0;
  pointer-events: none;
  top: -80px;  /* move off-screen smoothly */
}
/* Hide mobile toggle on larger screens */
@media (min-width: 769px) {
  #mobileSidebarToggle {
    display: none !important;
  }
}
/* Header logo (outside sidebar) */
.site-logo img {
  height: 40px;        /* adjust as needed */
  width: auto;
  display: block;
}




/* ==============================
   MAIN CONTENT & SECTIONS
   ============================== */
.content {
  flex: 1; /* take all remaining space */
  margin-left: var(--sidebar-collapsed-width);
  transition: margin-left 0.3s ease;
}
section,
.main-content {
  width: 75%;
  margin: 2rem auto;
  margin-left: 2rem;
  padding: 1.5rem;
  text-align: left;
  box-sizing: border-box;
  /* Unified glassy background */
  background: #10182a;
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 12px;
  /* Depth + color harmony */
  box-shadow: 0 8px 25px rgba(2, 6, 23, 0.6);
  color: #e6eef6;
  /* Smooth interactions */
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Normalize list spacing inside main content */
.main-content ul,
.main-content ol {
  padding-left: 1.25rem;  /* prevent browser default deep indent */
  margin-top: 1rem;
  margin-bottom: 1rem;
}

.main-content li {
  line-height: 1.6;
}


section a {
  color: #ffffff;
  text-decoration: underline;
}

section a:hover,
section a:focus {
  color: #00b4d8;
  text-decoration: underline;
  opacity: 0.9; /* optional subtle hover feedback */
}
/* Add padding + better layout on smaller screens */
@media (max-width: 768px) {
  section,
  .main-content {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    margin-top: 1rem;
    margin-bottom: 2rem; /* <-- This ensures a gap between sections */
    padding: 1.25rem;
  }

  .content {
    margin-left: 0;
    padding: 1rem;
  }
}



.page-header {
  text-align: left;
  font-size: 2.25rem;
  font-weight: 700;
  width: 75%;
  margin: 2rem auto;
  margin-left: 2rem;
  color: #f0f4ff;
  }
.page-subheader {
  font-size: 1.25rem;
  font-weight: 400;
  color: #b0bccf;
  line-height: 1.4;
  width: 75%;
  text-align: left;
  margin: 2rem auto;
  margin-left: 2rem;
}
/* Back link */
.back-link {
  margin: 2rem auto;
  margin-left: 2rem;

}
.back-link a {
  text-decoration: none;
  font-size: 0.95rem;
  color: #00b4d8;
}
.back-link a:hover {
  text-decoration: underline;
  color: #90e0ef;
}
/* Back To Top */
#backToTop {
  position: fixed;
  bottom: 2%;
  right: 2%;
  display: none;
  z-index: 100000;
  width: 50px;
  height: 50px;
  background-color: #0077b6;
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s, transform 0.3s;
}
#backToTop:hover {
  background-color: #00b4d8;
  transform: translateY(-2px);
}


/* ==============================
   CONTENT LIST ITEMS
   ============================== */
  
/* Content List as uniform cards */
.content-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); /* same as .cards */
  gap: 1.5rem;
  margin: 2rem auto 0 auto;
}

.content-list a.content-item {
  text-decoration: none;
  color: inherit;
  display: block;
}

.content-item {
  background: rgba(25, 40, 70, 0.9);
  padding: 2rem; /* same as .card */
  border-radius: 15px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  transition: transform 0.3s, background 0.3s;
  display: flex;
  flex-direction: column;
  justify-content: flex-start; /* or center if you want vertically centered content */
  text-align: center; /* matches cards */
  color: #e0e6ef;
}

.content-item:hover {
  transform: translateY(-8px);
  background: rgba(30, 50, 90, 0.95);
}
/* Disable hover effects on touch devices */
@media (hover: none) {
  .content-item:hover {
    transform: none;
    background: rgba(25, 40, 70, 0.9); /* original background */
  }
}
.icon {
  font-size: 2rem;
}
/* Optional icon styling (like .card-icon) */
.content-item .content-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  font-size: 1.5rem;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem auto;
  background: linear-gradient(135deg, #0077b6, #00b4d8);
}
/* Titles and descriptions */
.content-item h3 {
  margin-bottom: 0.5rem;
  color: #fff;
}
.content-item p {
  color: #b8c1d6;
  font-size: 1rem;
}
/* View All Buttons */
.view-all-container {
  margin-top: 1.5rem;
  text-align: center;
}
.view-all-btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: #0077b6;
  color: white;
  border-radius: 25px;
  font-weight: bold;
  text-decoration: none;
  transition: background 0.3s;
}
.view-all-btn:hover {
  background: #00a6ff;
  color: white;
  text-decoration: none;
  font-size: 1.05rem;
}




/* ==============================
   TABLE OF CONTENTS STYLES
   ============================== */
.header-row {
  display: flex;
  justify-content: space-between; /* header left, search box right */
  align-items: center;
  flex-wrap: wrap; /* allows wrapping on smaller screens */
  margin-bottom: 1.5rem;
}
/* Search Box */
.search-box {
  display: flex;
  align-items: center;
  margin-top: 0; /* remove extra spacing for small screens */
  position: relative;
}
.search-box input {
  padding: 0.5rem 1rem;
  border-radius: 8px 0 0 8px;
  border: 1px solid #334155;
  border-right: none;
  background: #0f172a;
  color: #e0e6ef;
  width: 100%;
  max-width: 100%;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.search-box input:focus {
  transform: scale(1.02);
  outline: none; /* remove default browser outline */
}
.search-box button {
  padding: 0.5rem 1rem;
  background: #0077b6;
  color: white;
  border: 1px solid #0077b6;
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  transition: background 0.3s, transform 0.2s;
}
.search-box button:hover {
  background: #00b4d8;
  transform: scale(1.05);
}
/* Responsive: stack header and search on small screens */
@media (max-width: 600px) {
  .header-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .search-box {
    margin-top: 0.8rem;
    width: 100%;
  }
  .search-box input {
    flex: 1;
    width: auto;
  }
}
#toc {
  list-style: none; /* removes bullets */
  padding: 0;       /* removes default padding */
  margin: 0;        /* removes default margin */
  flex-wrap: wrap;
  gap: 1rem;
}
#toc li {
  margin: 0.5rem 0;
}
#toc a {
  color: #00b4d8;
  text-decoration: none;
}
#toc a:hover {
  text-decoration: underline;
  color: #90e0ef;
}
/* Search results dropdown */
.search-results {
  list-style: none;
  margin: 0.25rem 0 0 0;
  background: #1e293b; /* dark background to match theme */
  border: 1px solid #334155;
  border-radius: 8px;
  max-height: 300px; /* prevent huge dropdown */
  overflow-y: auto;
  position: absolute;
  width: 100%;
  z-index: 1000; /* appear above other content */
  display: none; /* hidden by default */
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  width: 100%;
  left: 0;
  top: 100%; /* align exactly with bottom of input */
}
.search-results li {
  padding: 0.5rem 1rem;
  cursor: pointer;
  color: #e0e6ef;
  transition: background 0.2s, color 0.2s;
}
.search-results li:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}
.search-results li.no-match {
  cursor: default;
  color: #888;
  background: #1e293b;
}

/* ==============================
   CALCULATOR PAGES SECTION
   ============================== */
/* Input list: clean vertical layout */
.input-list {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 500px;
  width: 100%;
  box-sizing: border-box;
  align-items: flex-start;
}
.input-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.75rem;
  width: 100%;
  box-sizing: border-box;
  flex-wrap: wrap; /* allow wrapping on small screens */
}
/* Label */
.input-row label {
  flex: 0 0 150px;
  text-align: left;
  font-weight: 600;
  color: #e0e6ef;
}
/* Inputs and selects */
.input-row input,
.input-row select {
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  border: 1px solid #334155;
  border-radius: 6px;
  background: #0f172a;
  color: #e0e6ef;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}
/* ✅ Input + unit combination widths */
.input-row input {
  flex: 1 1 auto;
  min-width: 120px; /* ensures input is not too narrow */
  text-align: left;
}
.input-row select {
  flex: 0 0 90px;
}
/* Focus style */
.input-row input:focus,
.input-row select:focus {
  border-color: #00b4d8;
  box-shadow: 0 0 4px rgba(0, 180, 216, 0.4);
  outline: none;
}


/* ==============================
   TABLE STYLES
   ============================== */
.table-container {
  overflow-x: auto;
  margin: 1rem 0;
}
.property-table {
  width: 100%;
  border-collapse: collapse;
  text-align: center;
  font-size: 0.95rem;
  background: #0b1220;
  color: #e0e6ef;
}
.property-table th,
.property-table td {
  border: 1px solid #334155;
  padding: 0.5rem;
}
.property-table th {
  background-color: #0077b6;
  color: white;
  position: sticky;
  top: 0;
}
.property-table tr:nth-child(even) {
  background-color: #111a2d;
}


/* ==============================
   UNIT CONVERTER PAGES SECTION
   ============================== */
.converter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: flex-start;
  margin: 1.5rem 0;
  color: #e0e6ef;
}
/* Ensure input and select look similar */
.converter-form input,
.converter-form select {
  flex: 1;
  min-width: 160px;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  border: 1px solid #334155;
  border-radius: 6px;
  outline: none;
  text-align: center;
  background: #0f172a;
  color: #e0e6ef;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
/* On small screens, stack and make same width */
@media (max-width: 600px) {
  .converter-form {
    flex-direction: column;
    align-items: stretch;
  }

  .converter-form label {
    margin-bottom: 0.25rem;
  }

  .converter-form input,
  .converter-form select {
    width: 100%;
    min-width: 0;
  }
}
.converter-form label {
  font-weight: 600;
}
.converter-form input:focus,
.converter-form select:focus {
  border-color: #00b4d8;
  box-shadow: 0 0 4px rgba(0, 180, 216, 0.4);
}
/* Conversion Table */
.converter-result table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  background: #0b1220;
  color: #e0e6ef;
}
.converter-result th,
.converter-result td {
  border: 1px solid #334155;
  padding: 0.75rem;
  text-align: left;
}
.converter-result th {
  background-color: #0077b6;
  font-weight: 600;
  color: white;
}
.converter-result tr:nth-child(even) {
  background-color: #111a2d;
}


/* ==============================
   FEEDBACK FORM
   ============================== */
#feedback form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  color: #e0e6ef;
}
#feedback label {
  font-weight: 500;
}
#feedback input,
#feedback select,
#feedback textarea {
  padding: 0.75rem;
  border-radius: 8px;
  border: 1px solid #334155;
  font-size: 1rem;
  width: 100%;
  background: #0f172a;
  color: #e0e6ef;
  transition: border-color 0.3s, box-shadow 0.3s;
}
#feedback input:focus,
#feedback select:focus,
#feedback textarea:focus {
  border-color: #00b4d8;
  box-shadow: 0 0 6px rgba(0,180,216,0.4);
}
#feedback textarea#message {
  min-height: 150px;
  resize: vertical;
}
#feedback button {
  padding: 0.75rem 1.5rem;
  background: #0077b6;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s;
}
#feedback button:hover {
  background: #00b4d8;
}
#feedback input::placeholder,
#feedback select::placeholder,
#feedback textarea::placeholder {
  color: #94a3b8;
  font-size: 1rem;
}


/* ==============================
   FOOTER
   ============================== */
footer {
  background: #0a0f1c;
  color: #bbb;
  text-align: center;
  padding: 1.5rem;
  margin-top: 3rem;
  z-index: 500;
  margin-left: var(--sidebar-collapsed-width);
}
footer .footer-links a {
  color: #00b4d8;
  text-decoration: none;
  margin: 0 0.5rem;
}
footer .footer-links a:hover {
  text-decoration: underline;
  color: #90e0ef;
}
@media (max-width: 768px) {
   footer {
    margin: 0;
    width: 100%;
  }
}
