/* ================================================================= */
/* DeWATT — Assignment additions (PIUG course)                       */
/* Scope: ro/index.html only (first pass)                            */
/* ================================================================= */

/* ── Task 1: Sticky header ── */
header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: #000;
}

/* ── Task 1: Active nav link ── */
nav ul li a.active,
header a.active {
  color: #FFD600;
  border-bottom: 2px solid #FFD600;
  padding-bottom: 2px;
}

/* ── Task 2: Search wrapper ── */
.search-wrapper {
  position: relative;
  margin: 0 12px;
}
#site-search {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid #333;
  color: #fff;
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 0.9rem;
  width: 180px;
  transition: width 0.2s, border-color 0.2s;
}
#site-search:focus {
  outline: none;
  border-color: #FFD600;
  width: 220px;
}
#site-search::placeholder { color: #888; }
#search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #1a1a1a;
  border: 1px solid #333;
  list-style: none;
  padding: 0;
  margin: 0;
  border-radius: 8px;
  max-height: 320px;
  overflow-y: auto;
  z-index: 1500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
#search-results:empty { display: none; }
/* Override nav ul flex so results stack vertically */
#search-results,
nav ul #search-results {
  display: block;
}
#search-results li,
nav ul #search-results li {
  display: block;
  border-bottom: 1px solid #2a2a2a;
  margin: 0;
}
#search-results li:last-child { border-bottom: none; }
#search-results li a {
  display: block;
  padding: 10px 14px;
  color: #fff;
  text-decoration: none;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#search-results li a:hover { background: #FFD600; color: #000; }
@media (max-width: 768px) {
  .search-wrapper { margin: 8px 0; }
  #site-search { width: 100%; }
}

/* ── Task 3: Components table ── */
.components-section {
  padding: 80px 20px;
  background: #0a0a0a;
  color: #fff;
}
.components-section .container {
  max-width: 1200px;
  margin: 0 auto;
}
.components-title {
  text-align: center;
  font-size: 2rem;
  margin: 0 0 12px;
  color: #fff;
}
.components-subtitle {
  text-align: center;
  color: #aaa;
  margin: 0 0 40px;
  font-size: 1rem;
}
.components-table-wrapper {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid #222;
}
.components-table {
  width: 100%;
  border-collapse: collapse;
  background: #111;
  font-size: 0.95rem;
}
.components-table thead { background: #FFD600; color: #000; }
.components-table th {
  padding: 14px 16px;
  text-align: left;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.components-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #222;
  color: #ddd;
}
.components-table tbody tr:hover { background: #1a1a1a; }
.components-table tbody tr:last-child td { border-bottom: none; }
@media (max-width: 768px) {
  .components-title { font-size: 1.5rem; }
  .components-table { font-size: 0.85rem; }
  .components-table th,
  .components-table td { padding: 10px 12px; }
}

/* ── Task 4: Form field wrapper (keeps grid intact) ── */
.form-field-wrap {
  display: flex;
  flex-direction: column;
}
.form-field-wrap input,
.form-field-wrap select {
  width: 100%;
}

/* ── Task 4: Form validation feedback ── */
.form-error {
  display: block;
  color: #ff5252;
  font-size: 0.85rem;
  margin-top: 4px;
  min-height: 1.1em;
}
.invalid-input {
  border: 2px solid #ff5252 !important;
  outline: none;
}

/* ── Task 5: Help button ── */
#help-btn {
  position: fixed;
  bottom: 160px;
  right: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #FFD600;
  color: #000;
  font-size: 24px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  z-index: 999;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s;
}
#help-btn:hover { transform: scale(1.1); }

/* ── Task 5: Help modal ── */
.help-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
}
.help-modal.hidden { display: none; }
.help-modal-content {
  background: #1a1a1a;
  color: #fff;
  padding: 32px 28px;
  border-radius: 14px;
  max-width: 520px;
  width: 100%;
  position: relative;
  border: 1px solid #333;
  max-height: 85vh;
  overflow-y: auto;
}
.help-modal-content h2 {
  margin: 0 0 18px;
  color: #FFD600;
  font-size: 1.4rem;
}
.help-modal-close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: none;
  border: none;
  color: #fff;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
}
.help-modal-close:hover { color: #FFD600; }
.help-list {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
}
.help-list li {
  padding: 10px 0;
  border-bottom: 1px solid #2a2a2a;
  font-size: 0.95rem;
  line-height: 1.5;
}
.help-list li:last-child { border-bottom: none; }
.help-list strong { color: #FFD600; }
.help-contact {
  margin: 16px 0 0;
  padding-top: 16px;
  border-top: 1px solid #333;
  color: #aaa;
  font-size: 0.9rem;
}
.help-contact a { color: #FFD600; text-decoration: none; }
.help-contact a:hover { text-decoration: underline; }

/* ── Task 6: Scroll buttons ── */
.scroll-buttons {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 999;
}
.scroll-buttons button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #FFD600;
  color: #000;
  border: none;
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s, opacity 0.3s;
}
.scroll-buttons button:hover { transform: scale(1.1); }
.scroll-buttons button.faded { opacity: 0.4; }
