/* =====================================================================
   components.css — pieces shared by several pages:
   header, menu, dark mode toggle, buttons, hero banners, section titles,
   cards, form fields, FAQ, badges, toast messages, footer.
   ===================================================================== */

/* ---------- Header & menu ---------- */

.site-header { background-color: var(--header-bg); box-shadow: var(--shadow); position: sticky; top: 0; z-index: 100; }
.header-container { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; }
.logo { font-size: 1.8rem; font-weight: 700; color: var(--primary-color); }
.nav-links { display: flex; align-items: center; list-style: none; gap: 25px; margin-left: auto; margin-right: 25px; }
.nav-links a { font-weight: 500; transition: color 0.3s ease; }
.nav-links a:hover, .nav-links .active { color: var(--primary-color); font-weight: 600; }
.header-right { display: flex; align-items: center; gap: 15px; }
.account-area { display: flex; align-items: center; gap: 10px; min-height: 36px; opacity: 0; transition: opacity 0.2s ease; }
.account-area.ready { opacity: 1; }

/* ---------- Dark mode toggle (lightbulb) ---------- */

/* Round button (same look as the owner's profile-page toggle) */
.dark-mode-toggle { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; flex-shrink: 0; border-radius: 50%; background: rgba(0, 0, 0, 0.05); }
.dark-mode-toggle:hover { background: rgba(0, 0, 0, 0.1); }
.dark-mode .dark-mode-toggle { background: rgba(255, 255, 255, 0.08); }
.dark-mode .dark-mode-toggle:hover { background: rgba(255, 255, 255, 0.15); }
.dark-mode-label { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; cursor: pointer; font-size: 1.1rem; color: #f5b301; }
.dark-mode-label i { transition: color 0.3s ease, opacity 0.3s ease; }
.dark-mode .dark-mode-label { color: #9aa0a6; }
.dark-mode .dark-mode-label i { opacity: 0.8; }
/* the checkbox covers the whole button: invisible but clickable and keyboard-accessible */
#dark-mode-checkbox { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; opacity: 0; cursor: pointer; }
.dark-mode-toggle:focus-within { outline: 2px solid var(--primary-color); outline-offset: 2px; }

/* Outline "Back" button (My Pickups, pickup form) */
.back-btn { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 18px; padding: 9px 16px; border-radius: 9px; border: 1px solid var(--primary-color); background: transparent; color: var(--primary-color); font-size: 0.95rem; font-weight: 600; cursor: pointer; }
.back-btn:hover { background: var(--primary-color); color: #fff; }

/* ---------- Buttons ---------- */

.btn { display: inline-block; background-color: var(--primary-color); color: #fff; padding: 8px 16px; border-radius: 4px; font-weight: 600; border: none; cursor: pointer; text-align: center; font-size: 0.9rem; transition: all 0.3s ease; }
.btn:hover { background-color: var(--primary-dark); transform: translateY(-2px); }
.btn-secondary { background-color: var(--secondary-color); }
.btn-secondary:hover { background-color: var(--secondary-dark); }
.btn-accent { background-color: var(--accent-color); }
.btn-accent:hover { background-color: var(--accent-dark); }
.btn-danger { background-color: #c62828; }
.btn-danger:hover { background-color: #a61f1f; }
.btn-outline { background: transparent; color: var(--primary-color); border: 2px solid var(--primary-color); padding: 6px 14px; }
.btn-outline:hover { background: var(--primary-color); color: #fff; }
.btn-large { padding: 16px 32px; font-size: 1.1rem; width: 100%; border-radius: 12px; }
.btn:disabled, .btn-disabled { background-color: #9e9e9e; color: #f0f0f0; cursor: not-allowed; opacity: 0.75; transform: none; }
.btn:disabled:hover, .btn-disabled:hover { background-color: #9e9e9e; transform: none; }

/* ---------- Hero banners ---------- */

.hero { background: var(--hero-gradient); color: #fff; text-align: center; padding: 20px 0; }
.hero h1 { font-size: 2.5rem; margin-bottom: 1rem; }
.hero p { font-size: 1.2rem; max-width: 700px; margin: 0 auto 1.5rem; }

/* Smaller banner used on account pages (pickups, dashboard, admin) */
.page-hero { background: var(--hero-gradient); color: #fff; text-align: center; padding: 30px 0; position: relative; overflow: hidden; }
.page-hero::before { content: ''; position: absolute; inset: 0; background: url('https://images.unsplash.com/photo-1620641788421-7a1c342ea42e?ixlib=rb-4.0.3&auto=format&fit=crop&w=1473&q=80') center/cover; opacity: 0.1; animation: slowZoom 20s infinite alternate; }
.page-hero .container { position: relative; z-index: 1; }
.page-hero h1 { font-size: 2.2rem; margin-bottom: 0.3rem; }
.page-hero p { font-size: 1rem; opacity: 0.9; }
@keyframes slowZoom { 0% { transform: scale(1); } 100% { transform: scale(1.05); } }

/* ---------- Section titles ---------- */

.section-title { text-align: center; margin-bottom: 3rem; }
.section-title h2 { font-size: 2.2rem; color: var(--primary-dark); }
.section-title p { color: var(--text-color); max-width: 600px; margin: 0 auto; }

/* ---------- Cards ---------- */

.card { background: var(--card-bg); border-radius: 16px; box-shadow: var(--shadow); padding: 30px; margin-bottom: 25px; }
.state-box { background: var(--card-bg); border-radius: 16px; padding: 40px 20px; text-align: center; box-shadow: var(--shadow); }
.state-box i { font-size: 2.5rem; color: var(--primary-color); margin-bottom: 12px; display: block; }

/* ---------- Form fields (simple stacked style) ---------- */

.field { margin-bottom: 22px; }
.field label { display: block; margin-bottom: 8px; font-weight: 600; color: var(--text-color); }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px; border-radius: 10px; border: 2px solid var(--border-color);
  font-size: 1rem; background-color: var(--input-bg); color: var(--text-color);
}
.field input[readonly] { background-color: var(--light-bg); color: var(--muted-text); cursor: default; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1); }
.field .hint { margin-top: 6px; font-size: 0.85rem; color: var(--muted-text); }
.field-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }

/* Area suggestions under a location box (map + pickup form) */
.suggest-wrap { position: relative; }
.search-suggestions { display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 500; background-color: var(--card-bg); border-radius: 6px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18); max-height: 260px; overflow-y: auto; }
.search-suggestions.active { display: block; }
.suggestion-item { padding: 10px 15px; cursor: pointer; font-size: 0.92rem; display: flex; align-items: center; gap: 8px; color: var(--text-color); }
.suggestion-item i { color: var(--primary-color); font-size: 0.85rem; }
.suggestion-item:hover, .suggestion-item.highlighted { background-color: var(--light-bg); }
.suggestion-item strong { color: var(--primary-color); font-weight: 700; }

/* ---------- Messages ---------- */

.alert { padding: 14px 16px; border-radius: 10px; margin: 16px 0; font-size: 0.95rem; }
.alert-error { background: var(--error-bg); color: var(--error); }
.alert-success { background: var(--success-bg); color: var(--success); }
.alert-info { background: var(--light-bg); color: var(--text-color); }

.badge { display: inline-block; padding: 4px 12px; border-radius: 20px; font-size: 0.8rem; font-weight: 700; white-space: nowrap; }
.badge-pending { background: var(--warning-bg); color: var(--warning-text); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--error-bg); color: var(--error); }

.spinner { display: inline-block; width: 18px; height: 18px; border: 3px solid rgba(255, 255, 255, 0.3); border-top-color: #fff; border-radius: 50%; animation: spin 1s infinite linear; vertical-align: middle; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast (js/core/utils.js → toast()) */
.toast { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%); z-index: 2000; width: min(92%, 460px); padding: 16px 44px 16px 20px; border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2); opacity: 0; pointer-events: none; transition: opacity 0.25s; background: var(--card-bg); color: var(--text-color); }
.toast.show { opacity: 1; pointer-events: auto; }
.toast-success { background: #dcfce7; color: #166534; }
.toast-error { background: #fef2f2; color: #991b1b; }
.toast-close { position: absolute; top: 8px; right: 12px; background: none; border: none; font-size: 1.3rem; cursor: pointer; color: inherit; line-height: 1; }

/* ---------- Tabs (rewards, dashboard, admin) ---------- */

.tab-row { display: flex; gap: 10px; margin-bottom: 15px; flex-wrap: wrap; }
.tab-row button { flex: 1; padding: 10px; border-radius: 10px; border: 2px solid var(--border-color); background: var(--card-bg); color: var(--text-color); font-weight: 600; cursor: pointer; }
.tab-row button.active { border-color: var(--primary-color); color: var(--primary-color); }
.count { display: inline-block; min-width: 22px; padding: 0 7px; margin-left: 6px; border-radius: 12px; background: var(--primary-color); color: #fff; font-size: 0.8rem; text-align: center; }

/* ---------- FAQ (js/components/faq.js) ---------- */

.faq-container { max-width: 800px; margin: 0 auto; }
.faq-item { margin-bottom: 15px; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background-color: var(--card-bg); }
.faq-question { width: 100%; padding: 20px; background-color: var(--card-bg); border: none; font-size: 1.05rem; font-weight: 600; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 15px; color: var(--text-color); text-align: left; }
.faq-question:hover { background-color: var(--light-bg); }
.faq-answer { padding: 0 20px; max-height: 0; overflow: hidden; transition: max-height 0.3s ease, padding 0.3s ease; color: var(--text-color); }
.faq-answer ul { margin: 10px 0 10px 20px; }
.faq-answer li { margin-bottom: 6px; }
.faq-item.active .faq-answer { padding: 0 20px 20px; max-height: 600px; }
.faq-toggle { transition: transform 0.3s ease; color: var(--primary-color); flex-shrink: 0; }
.faq-item.active .faq-toggle { transform: rotate(180deg); }

/* ---------- Footer ---------- */

.site-footer { background-color: var(--footer-bg); color: var(--footer-text); padding: 50px 0 20px; margin-top: auto; }
.footer-content { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1.6fr; gap: 30px; margin-bottom: 30px; }
.footer-column h3 { font-size: 1.2rem; margin-bottom: 1.5rem; color: var(--primary-light); }
.footer-links { list-style: none; }
.footer-links li { margin-bottom: 10px; word-break: break-word; }
.footer-links a { transition: color 0.3s ease; }
.footer-links a:hover { color: var(--primary-light); }
.copyright { text-align: center; padding-top: 20px; border-top: 1px solid #333; font-size: 0.9rem; color: #aaa; }

/* ---------- Responsive ---------- */

@media (max-width: 1024px) {
  .nav-links { gap: 20px; margin-right: 20px; }
  .header-right { gap: 12px; }
  .footer-content { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  /* The stacked header is tall on phones, so it scrolls away instead of covering the page */
  .site-header { position: static; }
  .header-container { flex-direction: column; gap: 12px; }
  .nav-links { margin: 0 auto; gap: 15px; flex-wrap: wrap; justify-content: center; }
  .header-right { order: 1; width: 100%; justify-content: center; flex-wrap: wrap; }
  .account-area { flex-wrap: wrap; justify-content: center; }
  .hero h1 { font-size: 2rem; }
  .page-hero h1 { font-size: 1.8rem; }
  .field-row { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .hero h1, .section-title h2 { font-size: 1.8rem; }
  .nav-links { gap: 10px; }
  .card { padding: 22px 18px; }
  .footer-content { grid-template-columns: 1fr; }
}
