@import url(./common.css);

.global-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 3;
  background-color: var(--primary);
  height: 60px;
  padding: 0 24px;
  position: fixed;
  width: 100%;
}

/* --- ロゴエリア --- */
.header-logo {
  width: 150px;
}

.logo-text {
  display: inline-block;
  background-color: #ffffff;
  color: var(--tertiary);
  padding: 6px 16px;
  font-weight: bold;
  font-size: 15px;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* --- 検索バーエリア --- */
.header-search {
  flex-grow: 1;
  display: flex;
  justify-content: center;
  gap: 10px;
}

.search-input {
  width: 40%;
  min-width: 280px;
  padding: 8px 16px;
  font-size: 14px;
  background-color: #f9fafb;
  color: #333;
  border: 1px solid transparent;
  border-radius: 6px;
  outline: none;
  transition: all 0.2s ease-in-out;
}

.search-input:focus {
  background-color: #ffffff;
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(108, 106, 45, 0.2);
}

/* --- 通知エリア --- */
.header-notification {
  width: 150px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  position: relative;
}

.notification-wrapper {
  position: relative;
  display: inline-flex;
  cursor: pointer;
}

.notification-icon {
  width: 28px;
  height: 28px;
  transition: opacity 0.2s ease;
}

.notification-wrapper:hover .notification-icon {
  opacity: 0.7;
}

.notification-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  background-color: #ef4444;
  border-radius: 50%;
  border: 2px solid var(--primary);
}

/* 通知モーダルエリア */
.notification-modal {
  display: none;
  /* 初期状態は非表示 */
  position: absolute;
  top: 50px;
  right: 0;
  width: 320px;
  background-color: #ffffff;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  overflow: hidden;
}

/* JavaScriptでこのクラスを付与して表示させる */
.notification-modal.is-active {
  display: block;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
}

.modal-header h3 {
  margin: 0;
  font-size: 14px;
  color: #333;
}

.close-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #999;
  line-height: 1;
}

.close-btn:hover {
  color: #333;
}

.notification-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 300px;
  overflow-y: auto;
}

.notification-item {
  padding: 12px 16px;
  border-bottom: 1px solid #f9fafb;
  font-size: 13px;
  color: #444;
  cursor: pointer;
}

.notification-item:hover {
  background-color: #f9fafb;
}

/* 未読のお知らせ用の薄い青背景 */
.notification-item.unread {
  background-color: #f0f7ff;
}

.notification-item p {
  margin: 0 0 4px 0;
  line-height: 1.4;
}

.notification-item .time {
  display: block;
  font-size: 11px;
  color: #888;
}


@media screen and (max-width: 767px) {
  .global-header {
    height: 56px;
    padding: 0 12px;
    gap: 8px;
    box-sizing: border-box;
  }

  .header-logo,
  .header-notification {
    width: auto;
    display: flex;
    align-items: center;
  }

  .header-logo {
    flex: 0 0 auto;
    min-width: 64px;
    max-width: 120px;
    padding-right: 8px;
    padding-left: 6px;
    overflow: visible;
  }

  .logo-text {
    display: inline-block;
    padding: 4px 10px;
    font-size: 14px;
    line-height: 1.1;
    white-space: normal;
    word-break: break-word;
    overflow: visible;
  }

  .header-search {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    min-width: 0;
  }

  .search-input {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    margin: 0 8px;
    padding: 6px 10px;
    font-size: 14px;
    border-radius: 6px;
    background-color: #f9fafb;
    box-sizing: border-box;
  }

  .header-search .btn {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    padding: 0 10px;
    min-width: 44px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: transform 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
    -webkit-tap-highlight-color: transparent;
    line-height: 1;
    font-size: 14px;
    text-align: center;
    flex: 0 0 auto;
  }

  .header-search .btn::before {
    display: none;
  }

  .header-search .btn:focus {
    outline: none;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
    transform: translateY(-1px);
  }

  .header-search .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
  }

  .header-search .btn:active {
    transform: translateY(0);
  }

  .header-notification {
    width: auto;
    margin-left: 8px;
  }

  .notification-icon {
    width: 26px;
    height: 26px;
  }

  .notification-modal {
    position: fixed;
    top: 56px;
    right: 8px;
    left: 8px;
    width: auto;
  }
}