/**
 * 給与明細チェッカー v2 のスタイルシート
 * /wp-content/themes/your-theme/inc/salary-checker-v2/style.css に保存
 */

.kyuyo-checker-container {
  max-width: 100%;
  padding: 0 10px;
  margin: 0 auto;
  font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
  color: #333;
}

.kyuyo-checker-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 15px;
  text-align: center;
}

.input-section {
  background: #f9f9f9;
  padding: 18px 15px;
  border-radius: 12px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 15px;
}

.form-control {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 18px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.radio-label {
  display: flex;
  align-items: center;
  font-size: 15px;
}

.radio-label input[type="radio"] {
  margin-right: 8px;
  width: 20px;
  height: 20px;
}

.btn {
  width: 100%;
  padding: 14px;
  background: #4285f4;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: background-color 0.3s;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn:hover {
  background: #3367d6;
}

.btn:active {
  transform: translateY(1px);
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.results-section {
  margin-top: 25px;
}

.results-section > h3 {
  font-size: 18px;
  margin-bottom: 15px;
  text-align: center;
}

.result-section {
  background: #f9f9f9;
  padding: 15px;
  border-radius: 12px;
  margin-bottom: 15px;
  box-shadow: 0 1px 8px rgba(0,0,0,0.05);
}

.highlight-section {
  background: #e8f0fe;
}

.section-title {
  font-size: 16px;
  margin-top: 0;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(0,0,0,0.1);
  padding-bottom: 5px;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 5px 10px;
  align-items: center;
}

/* サマリー情報用のグリッド（改善部分） */
.summary-grid {
  grid-template-columns: 1fr auto auto;
  border-top: 1px solid rgba(66, 133, 244, 0.2);
  padding-top: 5px;
  margin-top: 10px;
}

.summary-grid .result-row:first-child {
  border-bottom: 1px solid rgba(66, 133, 244, 0.2);
  padding-bottom: 5px;
  margin-bottom: 10px;
}

.result-row {
  display: contents;
}

.result-row-large {
  font-size: 1.2em;
  margin: 8px 0;
}

.result-row .label {
  font-weight: normal;
  color: #555;
  grid-column: 1;
  padding: 6px 0;
}

.result-row .value {
  font-weight: 600;
  color: #333;
  text-align: right;
  grid-column: 2;
}

.result-row .unit {
  color: #555;
  grid-column: 3;
  padding-left: 2px;
}

.result-row-large .value {
  font-size: 1.5em;
  font-weight: 700;
  color: #3367d6;
}

.value-large {
  font-size: 1.5em;
  font-weight: 700;
  color: #3367d6;
}

/* チャート関連のスタイル */
.display-controls {
  display: flex;
  justify-content: flex-end;
  margin: 5px 0 8px;
}

.toggle-switch-container {
  display: flex;
  align-items: center;
}

.toggle-label {
  margin-right: 8px;
  font-size: 14px;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .toggle-slider {
  background-color: #4285f4;
}

input:checked + .toggle-slider:before {
  transform: translateX(22px);
}

.graph-hint {
  text-align: center;
  font-size: 12px;
  color: #666;
  padding: 5px;
  background-color: rgba(0, 0, 0, 0.03);
  border-radius: 4px;
  width: 100%;
  margin: 0 0 15px 0;
}

.charts-section {
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding: 10px;
  position: relative;
}

.chart-container {
  background: white;
  padding: 10px;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  position: relative;
  height: auto;
  margin-bottom: 5px;
  cursor: pointer;
  transition: box-shadow 0.2s;
}

/* グラフコンテナ別の背景色（改善部分） */
.chart-income {
  background: linear-gradient(to bottom, #f8f9ff, #ffffff);
  border: 1px solid rgba(33, 150, 243, 0.1);
}

.chart-deduction {
  background: linear-gradient(to bottom, #fff9f8, #ffffff);
  border: 1px solid rgba(255, 82, 82, 0.1);
}

.chart-tax-usage {
  background: linear-gradient(to bottom, #f8fff9, #ffffff);
  border: 1px solid rgba(76, 175, 80, 0.1);
}

.chart-container:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.chart-container:active {
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.chart-container h4 {
  margin: 0 0 10px 0;
  text-align: center;
  color: #333;
  font-size: 15px;
  padding-bottom: 5px;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

/* モバイル用の凡例グリッド */
.legend-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 12px;
  margin: 10px 5px 5px 5px;
  font-size: 11px;
}

/* 凡例グリッドの区切り線 */
.legend-divider {
  grid-column: 1 / -1;
  height: 1px;
  background: rgba(0,0,0,0.05);
  margin: 3px 0;
}

.legend-item {
  display: flex;
  align-items: center;
  padding: 3px 5px;
  border-radius: 3px;
}

.legend-color-marker {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 5px;
  flex-shrink: 0;
}

.legend-label {
  flex-grow: 1;
  margin-right: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.legend-percent {
  font-weight: 600;
  color: #333;
  flex-shrink: 0;
}

/* Canvas要素の高さを制御 */
canvas {
  max-height: 250px;
  width: 100% !important;
  margin: 0 auto;
}

/* 使途グラフ用のCanvas高さ調整（モバイル用） */
.chart-tax-usage canvas {
  max-height: 300px;
}

@media (max-width: 767px) {
  .chart-tax-usage canvas {
    max-height: 320px; /* モバイルでは縦長表示のため高さを増加 */
  }
}

/* アコーディオン関連のスタイル */
.accordion-container {
  margin-top: 15px;
}

.accordion-item {
  margin-bottom: 10px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  background: #f9f9f9;
}

.accordion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  background: #f3f3f3;
  cursor: pointer;
  transition: background-color 0.3s;
}

.accordion-header:hover {
  background: #e9e9e9;
}

.accordion-header h4 {
  margin: 0;
  font-size: 15px;
}

.accordion-icon {
  position: relative;
  width: 14px;
  height: 14px;
}

.accordion-icon::before,
.accordion-icon::after {
  content: '';
  position: absolute;
  background-color: #555;
  transition: transform 0.3s ease;
}

/* 横線 */
.accordion-icon::before {
  top: 6px;
  left: 0;
  width: 14px;
  height: 2px;
}

/* 縦線 */
.accordion-icon::after {
  top: 0;
  left: 6px;
  width: 2px;
  height: 14px;
}

.accordion-active .accordion-icon::after {
  transform: rotate(90deg);
}

.accordion-content {
  display: none;
  padding: 12px 15px;
  background: white;
}

.accordion-active .accordion-content {
  display: block;
}

.tax-usage-content {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.tax-usage-block {
  background: #f9f9f9;
  padding: 12px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.tax-usage-block h5 {
  margin-top: 0;
  margin-bottom: 8px;
  color: #333;
  border-bottom: 1px solid #eee;
  padding-bottom: 5px;
  font-size: 14px;
}

/* 社会保障と財政ブロックの色分け（改善部分） */
.tax-usage-block:first-child {
  background: linear-gradient(to bottom, #f0f8ff, #f9f9f9);
  border: 1px solid rgba(33, 150, 243, 0.1);
}

.tax-usage-block:last-child {
  background: linear-gradient(to bottom, #fff8f0, #f9f9f9);
  border: 1px solid rgba(255, 152, 0, 0.1);
}

/* レスポンシブ対応（タブレット以上） */
@media (min-width: 768px) {
  .kyuyo-checker-container {
    max-width: 700px;
    padding: 0;
  }
  
  .kyuyo-checker-title {
    font-size: 24px;
  }
  
  .btn {
    width: auto;
    padding: 12px 30px;
  }
  
  .radio-group {
    flex-direction: row;
    gap: 30px;
  }
  
  .charts-section {
    flex-flow: row wrap;
  }
  
  .graph-hint {
    flex: 0 0 100%;
    order: -1; /* 必ず最初に表示 */
    margin-bottom: 15px;
  }
  
  .chart-income, .chart-deduction {
    flex: 0 0 calc(50% - 10px);
  }
  
  .chart-tax-usage {
    flex: 0 0 100%;
  }
  
  .tax-usage-content {
    flex-direction: row;
  }
  
  .tax-usage-block {
    flex: 1;
  }
}

@media (min-width: 1024px) {
  .kyuyo-checker-container {
    max-width: 900px;
  }
  
  .chart-container {
    padding: 15px;
  }
  
  canvas {
    max-height: 300px;
  }
}