@import url(../../../stylesheets/application.css);

body, #wrapper { background-color:#EEEEEE; }
#header, #top-menu { margin: 0px 10px 0px 11px; }
#main { background: #EEEEEE; margin: 8px 10px 0px 10px; }
#content, #main.nosidebar #content { background: #fff; border-right: 1px solid #bbb; border-bottom: 1px solid #bbb; border-left: 1px solid #d7d7d7; border-top: 1px solid #d7d7d7; }
#footer { background-color:#EEEEEE; border: 0px; }

/* Headers */
h2, h3, h4, .wiki h1, .wiki h2, .wiki h3 {border-bottom: 0px;}

/* Menu */
#main-menu li a { background-color: #507AAA; font-weight: bold;}
#main-menu li a:hover { background: #507AAA; text-decoration: underline; }
#main-menu li a.selected, #main-menu li a.selected:hover { background-color:#EEEEEE; }
#main-menu li a.new-object { background-color:#507AAA; text-decoration: none; }

#main-menu .menu-children {
  border-right: 1px solid #507AAA;
  border-bottom: 1px solid #507AAA;
  border-left: 1px solid #507AAA;
}
#main-menu .menu-children li a:hover { background-color: #507AAA;}


/* Tables */
table.list tbody td, table.list tbody tr:hover td { border: solid 1px #d7d7d7; }
table.list thead th {
    border-width: 1px;
    border-style: solid;
    border-top-color: #d7d7d7;
    border-right-color: #d7d7d7;
    border-left-color: #d7d7d7;
    border-bottom-color: #999999;
}

/* Issues grid styles by priorities (provided by Wynn Netherland) */
table.list tr.issue a { color: #666; }

tr.odd.priority-highest, table.list tbody tr.odd.priority-highest:hover { color: #900; font-weight: bold; }
tr.odd.priority-highest { background: #ffc4c4; }
tr.even.priority-highest, table.list tbody tr.even.priority-highest:hover { color: #900; font-weight: bold; }
tr.even.priority-highest { background: #ffd4d4; }
tr.priority-highest a, tr.priority-5:hover a { color: #900; }
tr.odd.priority-highest td, tr.even.priority-highest td { border-color: #ffb4b4; }

tr.odd.priority-high2, table.list tbody tr.odd.priority-high4:hover { color: #900; }
tr.odd.priority-high2 { background: #ffc4c4; }
tr.even.priority-high2, table.list tbody tr.even.priority-high4:hover { color: #900; }
tr.even.priority-high2 { background: #ffd4d4; }
tr.priority-high2 a { color: #900; }
tr.odd.priority-high2 td, tr.even.priority-high4 td { border-color: #ffb4b4; }

tr.odd.priority-high3, table.list tbody tr.odd.priority-high3:hover { color: #900; }
tr.odd.priority-high3 { background: #fee; }
tr.even.priority-high3, table.list tbody tr.even.priority-high3:hover { color: #900; }
tr.even.priority-high3 { background: #fff2f2; }
tr.priority-high3 a { color: #900; }
tr.odd.priority-high3 td, tr.even.priority-high3 td { border-color: #fcc; }

tr.odd.priority-lowest, table.list tbody tr.odd.priority-lowest:hover { color: #559; }
tr.odd.priority-lowest { background: #eaf7ff; }
tr.even.priority-lowest, table.list tbody tr.even.priority-lowest:hover { color: #559; }
tr.even.priority-lowest { background: #f2faff; }
tr.priority-lowest a { color: #559; }
tr.odd.priority-lowest td, tr.even.priority-lowest td { border-color: #add7f3; }

/* Buttons */
input[type="button"], input[type="submit"], input[type="reset"] { background-color: #f2f2f2; color: #222222; border: 1px outset #cccccc; }
input[type="button"]:hover, input[type="submit"]:hover, input[type="reset"]:hover { background-color: #ccccbb; }

/* Fields */
input[type="text"], input[type="password"], textarea, select { border: 1px solid #d7d7d7; }
input[type="text"]:focus, input[type="password"]:focus, textarea:focus, select:focus { border: 1px solid #888866; }
option { border-bottom: 1px dotted #d7d7d7; }

/* Misc */
.box { background-color: #fcfcfc; }

/* ---------------------------------------------------------------
   チケット一覧で「高」「緊急」の優先度を赤くして目立たせる。
   Redmine は行に priority-<優先度ID> のクラスを付ける。
   この環境の優先度は 低=1 / 普通=2 / 高=3 / 緊急=5。
   （priority-default は全行に付いてしまい判定に使えないため ID で指定する）
   --------------------------------------------------------------- */
table.list tbody tr.issue.priority-3 td.priority,
table.list tbody tr.issue.priority-3:hover td.priority,
table.list tbody tr.issue.priority-5 td.priority,
table.list tbody tr.issue.priority-5:hover td.priority {
  color: #d0021b;
  font-weight: bold;
}

/* ---------------------------------------------------------------
   期日を過ぎているチケットは行全体を薄い赤にする。
   Redmine は期日超過の行に overdue クラスを付ける。
   縞模様（odd / even）より後に書いて上書きする。
   --------------------------------------------------------------- */
table.list tbody tr.issue.overdue td,
table.list tbody tr.issue.overdue.odd td,
table.list tbody tr.issue.overdue.even td {
  background-color: #fdecea;
}
table.list tbody tr.issue.overdue:hover td,
table.list tbody tr.issue.overdue.odd:hover td,
table.list tbody tr.issue.overdue.even:hover td {
  background-color: #fbdcd8;
}

/* --- ヘッダーの高さ配分 ---------------------------------------------
   一番上の帯（ホーム／マイページ／プロジェクト／管理／メンション）は
   よく使うのに狭く押しにくいため大きくし、
   その下のプロジェクト名と検索窓の帯は余白を詰めて全体の高さを抑える。 */
#top-menu {
  height: auto;
  font-size: 0.95em;
  padding-top: 5px;
  padding-bottom: 5px;
  line-height: 1.9;
}
#top-menu a { margin-right: 14px; }
#top-menu #loggedas { line-height: 1.9; }

#header {
  min-height: 0;
  padding-top: 6px;
  /* タブ（#main-menu）はこの中に position:absolute; bottom:0 で置かれるので、
     その高さぶんを下に空けておかないとプロジェクト名に重なる */
  padding-bottom: 36px;
}
#header h1 { margin: 0; line-height: 1.35; }
/* 上位プロジェクトの表示はプロジェクト名の上ではなく、左に並べて1行に収める */
#header h1 .breadcrumbs { display: inline; font-size: .55em; font-weight: normal; margin-right: .5em; }
#quick-search { margin-top: 2px; }

/* --- ヘッダーを常に画面上部に表示する（2026-08-18） -------------------
   長いチケット一覧や本文をスクロールしても、上の帯（ホーム／マイページ／
   プロジェクト／管理／…）とプロジェクト名・タブ（チケット／概要／Wiki／…）
   が画面から消えないようにする。

   #wrapper には overflow:hidden が入っており、そのままだと中の要素の
   position:sticky が効かない。overflow は #main-menu の右方向のはみ出し
   （margin-right:-500px）を隠す役目があるので、切り取りだけ行いスクロール
   コンテナを作らない overflow:clip に差し替える。
   未対応の古いブラウザはこの宣言を無視するので、従来どおり固定されない
   だけで表示は崩れない。
   スマホ幅（899px以下）は上の帯とタブがフライアウトメニューに入って
   そもそも表示されないため、対象外にする。 */
@media screen and (min-width: 900px) {
  #wrapper { overflow: clip; }

  #top-menu {
    position: sticky;
    top: 0;
    z-index: 101;
  }

  #header {
    position: sticky;
    /* 上の帯の実際の高さは theme.js が --hii-top-menu-h に入れる */
    top: var(--hii-top-menu-h, 34px);
    z-index: 100;
  }

  /* ヘッダーと本文の間（#main の margin-top ぶん）の隙間から本文が
     透けて見えるのを防ぎ、境界に軽い影を落とす */
  #header::after {
    content: "";
    position: absolute;
    top: 100%;
    left: -11px;   /* テーマが #header に付けている左右マージンぶん外へ広げる */
    right: -10px;
    height: 8px;
    background-color: #EEEEEE;
    box-shadow: 0 4px 5px -3px rgba(0, 0, 0, .25);
    pointer-events: none;
  }

  /* #note-12 などアンカー付きのリンクで飛んだときに、
     飛び先がヘッダーの裏に隠れないようにする */
  html { scroll-padding-top: calc(var(--hii-sticky-h, 100px) + 8px); }
}

/* --- チケット画面：見出しを固定し、右の欄を隠す（2026-08-23 / #179301） ---
   長いチケットを下まで読んでも、チケット番号・件名・登録者が画面上部に
   残るようにする。あわせて右側の欄（カスタムクエリ／チケットテンプレート／
   コメント用テンプレート／ウォッチャー）を隠し、本文を画面いっぱいに使う。

   固定するバー #hii-issue-sticky は theme.js が #wrapper の直下に作り、
   見出しをそこへ移している。#content には overflow-x:auto が入っていて
   スクロールの入れ物になるため、その中の position:sticky は効かない。 */

/* 右の欄はチケットを開いた画面でだけ隠す。
   #main は flex なので、隠せば本文が空いた幅をそのまま使う。
   スマホ幅ではもともと本文の下に回り込む作りなので、そちらも隠す。 */
body.controller-issues.action-show #sidebar { display: none; }

#hii-issue-sticky {
  background-color: #fff;
  padding: 2px 16px 6px;
}
/* 中の .contextual が float:right なので、高さに含めるために回り込みを解除する */
#hii-issue-sticky::after { content: ""; display: block; clear: both; }
#hii-issue-sticky h2 { margin-top: 4px; margin-bottom: 0; }
/* 移した見出しは黄色の枠を持たせない（枠は属性から下の本体だけに残す） */
#hii-issue-sticky div.issue {
  background: transparent;
  border: 0;
  padding: 0;
  margin: 4px 0 0 0;
  min-height: 0;
}
#hii-issue-sticky div.issue p.author { margin-bottom: 0; }
/* 見出しを抜いたぶん、本体の属性欄が上に空きすぎないようにする */
body.controller-issues.action-show #content div.issue.details > .attributes { margin-top: 0.5em; }

@media screen and (min-width: 900px) {
  /* バーがプロジェクト名・タブのすぐ下に付くので、ヘッダー側の影は重ねない */
  body.controller-issues.action-show #header::after { display: none; }

  #hii-issue-sticky {
    position: sticky;
    /* 上の帯とプロジェクト名・タブのぶんだけ下げる */
    top: var(--hii-sticky-h, 110px);
    z-index: 99;
    border-bottom: 1px solid #d7d7d7;
    box-shadow: 0 4px 5px -3px rgba(0, 0, 0, .25);
  }

  /* #note-12 などのアンカーで飛んだとき、飛び先がこのバーの裏に隠れないようにする */
  html { scroll-padding-top: calc(var(--hii-sticky-h, 100px) + var(--hii-issue-bar-h, 0px) + 8px); }
}

/* スマホ幅では固定しない。画面が狭く、固定すると本文がほとんど残らないため。
   ただし #header がこの幅では position:fixed になり、その高さぶんは
   #main の padding-top で空けられている。バーは #main の外（手前）に
   あってその padding が効かないので、バー側で同じだけ空ける。 */
@media screen and (max-width: 899px) {
  body.controller-issues.action-show #hii-issue-sticky { padding-top: 64px; }
  body.controller-issues.action-show #main { padding-top: 0; }
}
