/* ナビゲーションバーのスタイル */
.navbar-brand a {
    color: white !important;
    text-decoration: none;
}

.navbar-brand a:hover {
    color: rgba(255, 255, 255, 0.8) !important;
    text-decoration: none;
}

/* ヘッダー固定化のスタイル */
.navbar {
    transition: all 0.3s ease;
}

/* 画面高さが大きい場合のみヘッダーを固定化 */
@media (min-height: 600px) {
    .navbar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1030;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }

    /* ヘッダー固定時のメインコンテンツの調整 */
    body {
        padding-top: 76px; /* ナビゲーションバーの高さ分のパディング */
    }

    /* コンテナの上部マージンを調整 */
    .container-fluid.mt-3 {
        margin-top: 1rem !important;
    }
}

/* 画面高さが小さい場合はヘッダー固定化を無効にする */
@media (max-height: 599px) {
    .navbar {
        position: static;
    }

    body {
        padding-top: 0;
    }
}

/* コンテナの最大幅設定 */
.container-fluid {
    max-width: 1920px;
    margin: 0 auto;
    padding-left: 2rem;
    padding-right: 2rem;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* 大画面でのパディング調整 */
@media (min-width: 1400px) {
    .container-fluid {
        padding-left: 3rem;
        padding-right: 3rem;
    }

    .container {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

/* 超大画面でのパディング調整 */
@media (min-width: 1920px) {
    .container-fluid {
        padding-left: 4rem;
        padding-right: 4rem;
    }

    .container {
        padding-left: 3rem;
        padding-right: 3rem;
    }
}

/* カードヘッダーの新しいレイアウト対応 */
.card-header {
    padding: 1rem;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e0e7ef;
}

.card-header .card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
    line-height: 1.2;
}

.card-header .btn {
    font-size: 0.8rem;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
}

/* レスポンシブ対応 */
@media (max-width: 767.98px) {
    .card-header .card-title {
        font-size: 1rem;
    }

    .card-header .btn {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
}

.progress {
  height: 20px;
  margin-bottom: 8px;
  background-color: #f8f9fa;
  border-radius: 10px;
  overflow: hidden;
}

.progress-bar {
  transition: width 0.5s ease-in-out;
  font-size: 0.85rem;
  line-height: 20px;
  font-weight: 500;
}

.progress-label {
  font-size: 0.85rem;
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
  color: #6c757d;
}

.card {
  transition: transform 0.2s;
  background: #fff;
  border: 1px solid #e0e7ef;
  border-radius: 8px;
  margin-bottom: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.usage-info {
  font-family: monospace;
  white-space: pre-line;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 6px;
  border: 1px solid #e9ecef;
  font-size: 0.9rem;
}

.card-body {
  padding: 1rem;
}

.card-body h3 {
  color: #495057;
}

.card-body .h3 {
  color: #0d6efd;
  font-weight: 600;
}

.card-body h5 {
  font-size: 0.85rem;
  color: #6c757d;
}

.usage-stats {
  padding: 0.5rem;
}

.usage-tokens-stats {
  padding: 0.5rem;
}

.dashboard-container {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  margin-bottom: 1rem;
}

.dashboard-container .card {
  background: #fff;
  border: 1px solid #e0e7ef;
  border-radius: 8px;
  transition: transform 0.2s, box-shadow 0.2s;
  margin-bottom: 0.5rem;
}

.dashboard-container .card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.dashboard-container .card-body {
  padding: 1rem;
}

.dashboard-container .card-title {
  color: #495057;
  font-size: 1.25rem;
  margin-bottom: 1rem;
}

.dashboard-container .usage-info {
  background: rgba(255, 255, 255, 0.8);
  border-radius: 4px;
}

.dashboard-container .card-body .card {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border: 1px solid #e0e7ef;
  transition: transform 0.2s, box-shadow 0.2s;
}

.dashboard-container .card-body .card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.dashboard-container .card-body .card .card-body {
  padding: 0.75rem;
}

.usage-stats-summary {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.25rem 0;
}

.stat-label {
  font-size: 0.85rem;
  color: #6c757d;
  font-weight: 500;
}

.stat-value {
  font-size: 0.9rem;
  color: #0d6efd;
  font-weight: 600;
}

/* 統計カードのスタイル（新しいレイアウト用） */
.stat-card {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border: 1px solid #e0e7ef;
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s;
  height: 100%;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.stat-card .stat-label {
  font-size: 0.8rem;
  color: #6c757d;
  font-weight: 500;
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.stat-value-large {
  font-size: 1.2rem;
  color: #0d6efd;
  font-weight: 700;
  line-height: 1.2;
}

/* 前日との差のスタイル */
.stat-value small {
  font-size: 0.75rem;
  font-weight: 500;
  margin-left: 0.5rem;
}

.stat-value .text-success {
  color: #198754 !important;
}

.stat-value .text-danger {
  color: #dc3545 !important;
}

.stat-value .text-muted {
  color: #6c757d !important;
}

/* テーブルの幅を広げるスタイル（統合データ対応） */
.table-wide {
  width: 100%;
  min-width: 1400px;
  table-layout: auto;
}

.table-wide th,
.table-wide td {
  white-space: nowrap;
  padding: 0.75rem 0.5rem;
  vertical-align: middle;
  font-size: 0.85rem;
}

.table-wide th {
  background-color: #f8f9fa;
  font-weight: 600;
  color: #495057;
  border-bottom: 2px solid #dee2e6;
}

.table-wide td {
  border-bottom: 1px solid #dee2e6;
}

/* テーブルの列幅を最適化（統合データ対応） */
.table-wide th:nth-child(1),
.table-wide td:nth-child(1) {
  min-width: 120px;
  width: 120px;
}

.table-wide th:nth-child(2),
.table-wide td:nth-child(2) {
  min-width: 60px;
  width: 60px;
}

.table-wide th:nth-child(3),
.table-wide td:nth-child(3) {
  min-width: 100px;
  width: 100px;
}

.table-wide th:nth-child(4),
.table-wide td:nth-child(4) {
  min-width: 80px;
  width: 80px;
}

.table-wide th:nth-child(5),
.table-wide td:nth-child(5) {
  min-width: 60px;
  width: 60px;
}

.table-wide th:nth-child(6),
.table-wide td:nth-child(6) {
  min-width: 100px;
  width: 100px;
}

.table-wide th:nth-child(7),
.table-wide td:nth-child(7),
.table-wide th:nth-child(8),
.table-wide td:nth-child(8),
.table-wide th:nth-child(9),
.table-wide td:nth-child(9),
.table-wide th:nth-child(10),
.table-wide td:nth-child(10) {
  min-width: 120px;
  width: 120px;
}

.table-wide th:nth-child(11),
.table-wide td:nth-child(11) {
  min-width: 80px;
  width: 80px;
}

/* テーブルコンテナのスタイル */
.table-responsive {
  overflow-x: auto;
  border-radius: 0.375rem;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.chart-container {
  position: relative;
  height: 250px;
  margin-bottom: 1rem;
  background: #fff;
  border-radius: 6px;
  padding: 0.5rem;
  border: 1px solid #e9ecef;
}

/* 大きなグラフコンテナのスタイル */
.chart-container-large {
  position: relative;
  height: 400px;
  margin-bottom: 1rem;
  background: #fff;
  border-radius: 6px;
  padding: 1rem;
  border: 1px solid #e9ecef;
}

.chart-container canvas,
.chart-container-large canvas {
  width: 100% !important;
  height: 100% !important;
  cursor: pointer;
}

.chart-container:hover canvas,
.chart-container-large:hover canvas {
  cursor: crosshair;
}

/* グラフツールチップのスタイル */
.chartjs-tooltip {
  background: rgba(0, 0, 0, 0.8) !important;
  color: white !important;
  border-radius: 4px !important;
  padding: 8px 12px !important;
  font-size: 12px !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2) !important;
}

/* カードヘッダーのツールチップスタイル */
.card-header .btn[data-bs-toggle="tooltip"] {
  position: relative;
}

.card-header .btn[data-bs-toggle="tooltip"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

/* ツールチップのカスタムスタイル */
.tooltip {
  font-size: 0.875rem;
  max-width: 300px;
}

.tooltip-inner {
  background-color: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  line-height: 1.4;
}

/* モーダルのスタイル */
#graph-detail-modal .modal-content {
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#graph-detail-modal .modal-header {
  background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
  color: white;
  border-radius: 8px 8px 0 0;
}

#graph-detail-modal .modal-title {
  font-weight: 600;
}

#graph-detail-modal .modal-body {
  padding: 1.5rem;
}

#graph-detail-modal .modal-body p {
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

#graph-detail-modal .modal-body strong {
  color: #495057;
}

/* Usage Tokens 専用スタイル */
.usage-tokens-stats .stat-item {
  border-bottom: 1px solid #f8f9fa;
  padding: 0.5rem 0;
}

.usage-tokens-stats .stat-item:last-child {
  border-bottom: none;
}

.usage-tokens-stats .stat-value {
  color: #28a745;
  font-weight: 700;
}

#tokens-table {
  font-size: 0.85rem;
}

#tokens-table th {
  background-color: #f8f9fa;
  font-weight: 600;
  color: #495057;
}

#tokens-table td {
  vertical-align: middle;
}

.tokens-high {
  color: #dc3545;
  font-weight: 600;
}

.tokens-medium {
  color: #ffc107;
  font-weight: 600;
}

.tokens-low {
  color: #28a745;
  font-weight: 600;
}

/* 大画面でのレイアウト最適化 */
@media (min-width: 1400px) {
  .dashboard-container {
    padding: 1.5rem;
  }

  .card-body {
    padding: 1.25rem;
  }

  .chart-container {
    height: 300px;
  }

  .chart-container-large {
    height: 500px;
  }

  .stat-card {
    padding: 1.25rem;
  }

  .stat-value-large {
    font-size: 1.4rem;
  }
}

@media (min-width: 1920px) {
  .dashboard-container {
    padding: 2rem;
  }

  .card-body {
    padding: 1.5rem;
  }

  .chart-container {
    height: 350px;
  }

  .chart-container-large {
    height: 600px;
  }

  .stat-card {
    padding: 1.5rem;
  }

  .stat-value-large {
    font-size: 1.6rem;
  }
}

@media (max-width: 900px) {
  .dashboard-container {
    padding: 1rem;
  }

  .dashboard-container .row {
    margin: 0;
  }

  .dashboard-container .col-md-6 {
    padding: 0.5rem;
  }

  .dashboard-container .card-body {
    padding: 1rem;
  }

  .chart-container {
    height: 150px;
  }

  .chart-container-large {
    height: 300px;
  }
}

/*
レスポンシブレイアウト対応:
- 大画面（lg以上）: 3列横並び
- 中画面（md）: 2列横並び
- 小画面（sm以下）: 1列縦並び
*/
@media (max-width: 991.98px) {
  /* 中画面以下での調整 */
  .card {
    margin-bottom: 1rem;
  }

  .card-body {
    padding: 0.75rem;
  }

  .stat-item {
    padding: 0.25rem 0;
  }

  .stat-label {
    font-size: 0.8rem;
  }

  .stat-value {
    font-size: 0.85rem;
  }

  /* 統計カードのレスポンシブ対応 */
  .stat-card {
    padding: 0.75rem;
  }

  .stat-card .stat-label {
    font-size: 0.75rem;
  }

  .stat-value-large {
    font-size: 1rem;
  }

  /* 前日との差のスタイル調整 */
  .stat-value small {
    font-size: 0.7rem;
    margin-left: 0.25rem;
  }

  /* テーブルのレスポンシブ対応（統合データ対応） */
  .table-wide {
    min-width: 1200px;
  }

  .table-wide th:nth-child(1),
  .table-wide td:nth-child(1) {
    min-width: 110px;
    width: 110px;
  }

  .table-wide th:nth-child(2),
  .table-wide td:nth-child(2) {
    min-width: 50px;
    width: 50px;
  }

  .table-wide th:nth-child(3),
  .table-wide td:nth-child(3) {
    min-width: 90px;
    width: 90px;
  }

  .table-wide th:nth-child(4),
  .table-wide td:nth-child(4) {
    min-width: 70px;
    width: 70px;
  }

  .table-wide th:nth-child(5),
  .table-wide td:nth-child(5) {
    min-width: 50px;
    width: 50px;
  }

  .table-wide th:nth-child(6),
  .table-wide td:nth-child(6) {
    min-width: 90px;
    width: 90px;
  }

  .table-wide th:nth-child(7),
  .table-wide td:nth-child(7),
  .table-wide th:nth-child(8),
  .table-wide td:nth-child(8),
  .table-wide th:nth-child(9),
  .table-wide td:nth-child(9),
  .table-wide th:nth-child(10),
  .table-wide td:nth-child(10) {
    min-width: 100px;
    width: 100px;
  }

  .table-wide th:nth-child(11),
  .table-wide td:nth-child(11) {
    min-width: 70px;
    width: 70px;
  }
}

@media (max-width: 767.98px) {
  /* 小画面での調整 */
  .container-fluid {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  /* 小画面ではヘッダー固定化を無効にする */
  .navbar {
    position: static;
  }

  body {
    padding-top: 0;
  }

  .card-header {
    padding: 0.75rem;
  }

  .card-header .card-title {
    font-size: 1rem;
    margin-bottom: 0.375rem;
  }

  .card-header .btn {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
  }

  .card-body {
    padding: 0.5rem;
  }

  .usage-stats-summary {
    gap: 0.25rem;
  }

  .stat-item {
    padding: 0.2rem 0;
  }

  .stat-label {
    font-size: 0.75rem;
  }

  .stat-value {
    font-size: 0.8rem;
  }

  /* 統計カードの小画面対応 */
  .stat-card {
    padding: 0.5rem;
  }

  .stat-card .stat-label {
    font-size: 0.7rem;
    margin-bottom: 0.25rem;
  }

  .stat-value-large {
    font-size: 0.9rem;
  }

  /* 前日との差のスタイル調整 */
  .stat-value small {
    font-size: 0.65rem;
    margin-left: 0.2rem;
  }

  /* テーブルの小画面対応（統合データ対応） */
  .table-wide {
    min-width: 1000px;
    font-size: 0.75rem;
  }

  .table-wide th,
  .table-wide td {
    padding: 0.5rem 0.25rem;
  }

  .table-wide th:nth-child(1),
  .table-wide td:nth-child(1) {
    min-width: 100px;
    width: 100px;
  }

  .table-wide th:nth-child(2),
  .table-wide td:nth-child(2) {
    min-width: 45px;
    width: 45px;
  }

  .table-wide th:nth-child(3),
  .table-wide td:nth-child(3) {
    min-width: 80px;
    width: 80px;
  }

  .table-wide th:nth-child(4),
  .table-wide td:nth-child(4) {
    min-width: 60px;
    width: 60px;
  }

  .table-wide th:nth-child(5),
  .table-wide td:nth-child(5) {
    min-width: 45px;
    width: 45px;
  }

  .table-wide th:nth-child(6),
  .table-wide td:nth-child(6) {
    min-width: 80px;
    width: 80px;
  }

  .table-wide th:nth-child(7),
  .table-wide td:nth-child(7),
  .table-wide th:nth-child(8),
  .table-wide td:nth-child(8),
  .table-wide th:nth-child(9),
  .table-wide td:nth-child(9),
  .table-wide th:nth-child(10),
  .table-wide td:nth-child(10) {
    min-width: 85px;
    width: 85px;
  }

  .table-wide th:nth-child(11),
  .table-wide td:nth-child(11) {
    min-width: 60px;
    width: 60px;
  }

  .progress {
    height: 16px;
  }

  .progress-bar {
    font-size: 0.75rem;
    line-height: 16px;
  }

  .chart-container-large {
    height: 250px;
  }
}

/* 超小画面での調整 */
@media (max-width: 575.98px) {
  .container-fluid {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }

  .container {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }

  /* 超小画面ではヘッダー固定化を無効にする */
  .navbar {
    position: static;
  }

  body {
    padding-top: 0;
  }

  .dashboard-container {
    padding: 0.5rem;
  }

  .card-body {
    padding: 0.25rem;
  }

  .stat-card {
    padding: 0.25rem;
  }

  .chart-container {
    height: 120px;
  }

  .chart-container-large {
    height: 200px;
  }
}
