/* Shared site header */
header {
  padding: 16px 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.01);
}

body {
  padding-top: 69px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.logo:focus-visible {
  outline: 3px solid rgba(79, 70, 229, 0.24);
  outline-offset: 4px;
  border-radius: 10px;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 18px;
}

.logo-text {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.logo-text span {
  color: var(--accent2);
}

.nav-wrapper {
  display: flex;
  align-items: center;
  gap: 24px;
}

.header-nav {
  display: flex;
  gap: 6px;
}

.header-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  padding: 8px 16px;
  border-radius: 8px;
  transition: all 0.2s;
  border: 1px solid transparent;
  font-weight: 500;
}

.header-nav a:hover {
  color: var(--accent);
  background: var(--surface2);
}

.admin-btn {
  color: var(--accent) !important;
  border-color: rgba(79, 70, 229, 0.2) !important;
  background: rgba(79, 70, 229, 0.04);
}

.admin-btn:hover {
  background: var(--accent) !important;
  color: #fff !important;
}

.menu-links {
  display: flex;
  gap: 6px;
  border-right: 1px solid var(--border);
  padding-right: 16px;
}

.menu-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s;
  font-weight: 500;
}

.menu-link:hover {
  background: var(--surface2);
  color: var(--accent);
}

.menu-link-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: 13px;
  flex-shrink: 0;
}

.ql-blue {
  background: rgba(59, 130, 246, 0.1);
  color: #1d4ed8;
}

.ql-green {
  background: rgba(16, 185, 129, 0.1);
  color: #047857;
}

.ql-purple {
  background: rgba(124, 58, 237, 0.1);
  color: #6d28d9;
}

.ql-amber {
  background: rgba(245, 158, 11, 0.1);
  color: #b45309;
}

/* 大樓外觀快速跳轉搜尋框 */
.header-bld-search {
  position: relative;
}

.header-bld-input-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface2, #f8fafc);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  padding: 6px 10px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.header-bld-input-wrap:focus-within {
  border-color: var(--accent, #4f46e5);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.header-bld-icon {
  font-size: 14px;
  flex-shrink: 0;
  opacity: 0.55;
}

.header-bld-input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 14px;
  width: 150px;
  color: var(--text, #1e293b);
  font-family: inherit;
}

.header-bld-input::placeholder {
  color: var(--muted, #94a3b8);
}

.header-bld-input-wrap.no-data {
  cursor: not-allowed;
  opacity: 0.62;
  pointer-events: none;
}

.header-bld-input-wrap.no-data .header-bld-input {
  cursor: not-allowed;
  color: var(--muted, #94a3b8);
}

.header-bld-clear {
  background: none;
  border: none;
  padding: 0 2px;
  cursor: pointer;
  font-size: 12px;
  color: var(--muted, #94a3b8);
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.15s;
}

.header-bld-clear:hover {
  color: var(--text, #1e293b);
}

.header-bld-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 240px;
  background: #fff;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  z-index: 300;
  max-height: 300px;
  overflow-y: auto;
  padding: 4px 0;
}

.header-bld-dropdown.open {
  display: block;
  animation: fadeUp 0.15s ease forwards;
}

.header-bld-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.12s;
}

.header-bld-option:hover,
.header-bld-option:focus {
  background: var(--surface2, #f8fafc);
  outline: none;
}

.header-bld-num {
  font-size: 11px;
  font-weight: 600;
  background: rgba(79, 70, 229, 0.08);
  color: #4f46e5;
  border-radius: 4px;
  padding: 1px 5px;
  flex-shrink: 0;
}

.header-bld-name {
  font-weight: 500;
  color: var(--text, #1e293b);
  flex: 1;
}

.header-bld-campus {
  font-size: 12px;
  color: var(--muted, #94a3b8);
  flex-shrink: 0;
}

.header-bld-option-close {
  cursor: not-allowed;
  opacity: 0.62;
  color: var(--muted, #94a3b8);
}

.header-bld-option-close:hover,
.header-bld-option-close:focus {
  background: none;
  color: var(--muted, #94a3b8);
}

.header-bld-no-photo {
  font-size: 11px;
  color: var(--muted, #94a3b8);
  flex-shrink: 0;
  margin-left: auto;
}

.header-bld-empty {
  padding: 12px 14px;
  color: var(--muted, #94a3b8);
  font-size: 14px;
  text-align: center;
}

@media (max-width: 1100px) {
  .header-bld-input { width: 100%; }
  .header-bld-dropdown { min-width: 100%; right: 0; left: 0; }
}

.menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 20px;
  color: var(--text);
  transition: all 0.2s;
}

.menu-toggle:hover {
  background: var(--surface2);
}

/* 非管理員登入提示 toast */
.login-denied-toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: #fffbeb;
  border: 1px solid #f59e0b;
  border-left: 4px solid #f59e0b;
  border-radius: 10px;
  padding: 0.9rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  z-index: 200;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  max-width: 480px;
  width: calc(100% - 32px);
  font-size: 14px;
  font-weight: 500;
  color: #78350f;
  animation: loginDeniedSlide 0.3s ease;
}

.login-denied-icon {
  font-size: 18px;
  flex-shrink: 0;
  color: #d97706;
}

.login-denied-msg {
  flex: 1;
  line-height: 1.5;
}

.login-denied-close {
  flex-shrink: 0;
  background: none;
  border: none;
  font-size: 20px;
  color: #92400e;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  opacity: 0.5;
  transition: opacity 0.2s;
}

.login-denied-close:hover {
  opacity: 1;
}

@keyframes loginDeniedSlide {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@media (max-width: 1100px) {
  .menu-toggle {
    display: block;
  }

  .nav-wrapper {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    padding: 20px;
    gap: 16px;
    display: none;
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.03);
  }

  .nav-wrapper.open {
    display: flex;
    animation: fadeUp 0.2s ease forwards;
  }

  .menu-links {
    flex-direction: column;
    border-right: none;
    padding-right: 0;
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
  }

  .header-nav {
    flex-direction: column;
  }
}
