/* 全体のスタイル */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #333;
  min-height: 100vh;
  padding: 20px;
}

/* 960px以上のウィンドウでコンテンツをセンタリング */
.container {
  max-width: 960px;
  margin: 0 auto;
}

@media (min-width: 961px) {
  body {
    padding: 40px 20px;
  }
}

/* ヘッダーセクション */
#head {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 15px;
  padding: 30px;
  text-align: center;
  margin-bottom: 30px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

#head h1 {
  color: #2c3e50;
  font-size: 2.2em;
  margin-bottom: 15px;
  font-weight: 700;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

#head p {
  color: #555;
  font-size: 1.1em;
  line-height: 1.6;
}

/* 使い方セクション */
#instructions {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  padding: 25px;
  margin-bottom: 25px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

#instructions h2 {
  color: #34495e;
  font-size: 1.5em;
  margin-bottom: 20px;
  border-bottom: 2px solid #3498db;
  padding-bottom: 8px;
}

#instructions ol {
  padding-left: 25px;
}

#instructions li {
  margin-bottom: 12px;
  font-size: 1.05em;
  line-height: 1.5;
  color: #555;
}

#instructions p {
  margin-bottom: 15px;
  font-size: 1.05em;
  line-height: 1.6;
  color: #555;
}

/* 計算セクション */
#calculation {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  padding: 30px;
  margin-bottom: 25px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* ファイル入力 */
#fileInput {
  background: #fff;
  border: 2px dashed #3498db;
  border-radius: 8px;
  padding: 15px;
  width: 100%;
  margin-bottom: 20px;
  font-size: 1em;
  cursor: pointer;
  transition: all 0.3s ease;
}

#fileInput:hover {
  border-color: #2980b9;
  background: #f8f9fa;
}

#fileInput:focus {
  outline: none;
  border-color: #2980b9;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

/* 計算ボタン */
#calcButton {
  background: linear-gradient(45deg, #3498db, #2980b9);
  color: white;
  border: none;
  border-radius: 25px;
  padding: 12px 30px;
  font-size: 1.1em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
  margin-bottom: 25px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

#calcButton:hover {
  background: linear-gradient(45deg, #2980b9, #1f5f8b);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

#calcButton:active {
  transform: translateY(0);
}

/* 結果表示 */
#result {
  background: rgba(46, 204, 113, 0.1);
  border-left: 4px solid #2ecc71;
  border-radius: 6px;
  padding: 20px;
  margin-bottom: 25px;
  font-size: 1.2em;
  font-weight: 600;
  color: #27ae60;
  display: block; /* 結果が表示されるように変更 */
}

/* 結果が空の場合は非表示にする */
#result:empty {
  display: none;
}

/* completedGPAの書式設定 */
#completedGPA {
  background: rgba(155, 89, 182, 0.1);
  border-left: 4px solid #9b59b6;
  border-radius: 6px;
  padding: 20px;
  margin-bottom: 25px;
  font-size: 1.2em;
  font-weight: 600;
  color: #8e44ad;
  display: block;
}

/* completedGPAが空の場合は非表示にする */
#completedGPA:empty {
  display: none;
}

/* テーブルスタイル */
#gradeTable {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 15px;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  border: none;
}

#gradeTable thead {
  background: linear-gradient(45deg, #34495e, #2c3e50);
  color: white;
}

#gradeTable th {
  padding: 15px 12px;
  text-align: center;
  font-weight: 600;
  font-size: 1em;
}

#gradeTable td {
  padding: 12px;
  text-align: center;
  border: none; /* ブラウザ標準のボーダーを削除 */
  border-bottom: 1px solid #ecf0f1;
  transition: background-color 0.2s ease;
}

/* summaryTableの書式設定 */
#summaryTable {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  border: none;
}

#summaryTable thead {
  background: linear-gradient(45deg, #16a085, #2ecc71);
  color: white;
}

#summaryTable th {
  padding: 15px 12px;
  text-align: center;
  font-weight: 600;
  font-size: 1em;
}

#summaryTable td {
  padding: 12px;
  text-align: center;
  border: none;
  border-bottom: 1px solid #ecf0f1;
  transition: background-color 0.2s ease;
}

#summaryTable tbody tr:hover {
  background-color: #f8f9fa;
}

#summaryTable tbody tr:nth-child(even) {
  background-color: #fafbfc;
}

/* GPが空白のセルの行の文字はグレーにする */
#gradeTable td.empty-gp {
  color: #bdc3c7;
  font-style: italic;
}

/*"compulsory", "elective", "elective-compulsory" のクラス名を持つセルのスタイル */
td.compulsory {
  background: linear-gradient(to right, #e74c3c 0px, #e74c3c 5px, transparent 5px, transparent 100%);
}
td.elective {
  background: linear-gradient(to right, #f1c40f 0px, #f1c40f 5px, transparent 5px, transparent 100%);
}
td.elective-compulsory {
  background: linear-gradient(to right, #2ecc71 0px, #2ecc71 5px, transparent 5px, transparent 100%);
}

#gradeTable tbody tr:hover {
  background-color: #f8f9fa;
}

#gradeTable tbody tr:nth-child(even) {
  background-color: #fafbfc;
}

/* テーブル下の説明文 */
#calculation small {
  color: #7f8c8d;
  font-size: 0.9em;
  line-height: 1.4;
  display: block;
  margin-top: 10px;
}

/* フッター */
.container > small {
  display: block;
  text-align: center;
  color: rgba(255, 255, 255, 0.8);
  margin-top: 30px;
  font-size: 0.9em;
  width: 100%;
  overflow: hidden;
}

.container > small a {
  color: #3498db;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
}

.container > small a:hover {
  color: #2980b9;
  text-decoration: underline;
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
  body {
    padding: 15px;
  }
  
  #head {
    padding: 20px;
  }
  
  #head h1 {
    font-size: 1.8em;
  }
  
  #instructions, #calculation {
    padding: 20px;
  }
  
  #gradeTable th, #gradeTable td {
    padding: 10px 8px;
    font-size: 0.9em;
  }
}

@media (max-width: 480px) {
  #head h1 {
    font-size: 1.5em;
  }
  
  #gradeTable th, #gradeTable td {
    padding: 8px 6px;
    font-size: 0.85em;
  }
  
  #calcButton {
    width: 100%;
    padding: 15px;
  }
}

/* アニメーション効果 */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#head, #instructions, #calculation {
  animation: fadeIn 0.6s ease-out;
}

/* テーブル行のアニメーション */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

#gradeTable tbody tr {
  animation: slideIn 0.3s ease-out;
}