/* CSSファイル */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: Arial, sans-serif;
  background-color: #f5f5f5;
  transition: all 0.2s ease;
}

/* ページ読み込み時のフェードイン効果（高速化） */
.content {
  opacity: 1;
  transition: opacity 0.2s ease-in-out;
}

/* ページ遷移時のスムーズ効果（高速化） */
.page-transition {
  opacity: 0;
  transition: opacity 0.15s ease-out;
}

/* メインコンテナ */
.container {
  display: flex;
  min-height: 100vh;
}

/* 左側サイドバー */
.sidebar {
  width: 250px;
  background-color: #2c3e50;
  color: white;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-header {
  padding: 20px;
  background-color: #34495e;
  border-bottom: 1px solid #3b4d63;
}

.sidebar-header h2 {
  font-size: 18px;
  font-weight: bold;
}

/* ユーザー情報セクション */
.user-info {
  display: flex;
  align-items: center;
  padding: 15px 20px;
  background-color: #34495e;
  border-bottom: 1px solid #3b4d63;
  margin-bottom: 10px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  background-color: #3498db;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  color: white;
  font-size: 18px;
}

.user-details {
  flex: 1;
  overflow: hidden;
}

.user-name {
  font-size: 14px;
  font-weight: 600;
  color: #ecf0f1;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-username {
  font-size: 12px;
  color: #bdc3c7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logout-btn {
  width: 32px;
  height: 32px;
  border-radius: 5px;
  background-color: transparent;
  color: #bdc3c7;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: all 0.3s ease;
}

.logout-btn:hover {
  background-color: #e74c3c;
  color: white;
  transform: scale(1.05);
}

/* メニューナビゲーション */
.sidebar-nav {
  padding: 20px 0;
}

.menu {
  list-style: none;
}

.menu-item {
  margin-bottom: 5px;
  transition: all 0.15s ease;
}

.menu-item a {
  display: block;
  padding: 12px 20px;
  color: #ecf0f1;
  text-decoration: none;
  transition: all 0.15s ease-in-out;
  border-left: 3px solid transparent;
}

.menu-item a:hover {
  background-color: #3b4d63;
  border-left-color: #3498db;
  transform: translateX(2px);
}

.menu-item.active a {
  background-color: #3498db;
  color: white;
  border-left-color: #2980b9;
}

/* サブメニューのスタイル */
.menu-toggle {
  position: relative;
  cursor: pointer;
}

.toggle-icon {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  transition: transform 0.3s ease;
  font-size: 12px;
}

.menu-item.expanded .toggle-icon {
  transform: translateY(-50%) rotate(180deg);
}

.submenu {
  list-style: none;
  max-height: 500px !important;
  overflow: visible !important;
  transition: max-height 0.3s ease;
  background-color: #1a252f;
  padding: 0;
  margin: 0;
  opacity: 1 !important;
  visibility: visible !important;
}

.menu-item.expanded .submenu {
  max-height: 500px;
  opacity: 1;
  visibility: visible;
}

.submenu-item {
  margin: 0;
}

.submenu-item a {
  padding: 10px 20px 10px 50px;
  font-size: 13px;
  border-left: 3px solid transparent;
  color: #bdc3c7;
}

.submenu-item a:hover {
  background-color: #34495e;
  border-left-color: #3498db;
  color: #ecf0f1;
}

.submenu-item.active a {
  background-color: #3498db;
  color: white;
  border-left-color: #2980b9;
}

.submenu-item a i {
  margin-right: 8px;
  width: 14px;
  text-align: center;
}

/* メインコンテンツエリア */
.main-content {
  margin-left: 250px;
  flex: 1;
  padding: 30px;
}

.content {
  background-color: white;
  padding: 30px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.content h1 {
  color: #2c3e50;
  margin-bottom: 20px;
  font-size: 28px;
}

.content p {
  color: #7f8c8d;
  line-height: 1.6;
  font-size: 16px;
}

/* ボタンスタイル */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  margin-right: 10px;
  margin-bottom: 10px;
  text-decoration: none;
  display: inline-block;
}

.btn-primary {
  background-color: #3498db;
  color: white;
}

.btn-primary:hover {
  background-color: #2980b9;
  color: white;
  text-decoration: none;
}

.btn-secondary {
  background-color: #95a5a6;
  color: white;
}

.btn-secondary:hover {
  background-color: #7f8c8d;
  color: white;
  text-decoration: none;
}

/* 統計グリッド */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.stat-card h3 {
  margin: 0 0 10px 0;
  color: #7f8c8d;
  font-size: 14px;
  font-weight: normal;
}

.stat-number {
  font-size: 32px;
  font-weight: bold;
  color: #2c3e50;
  margin-bottom: 5px;
}

.stat-change {
  font-size: 12px;
  font-weight: bold;
}

.stat-change.positive {
  color: #27ae60;
}

.stat-change.negative {
  color: #e74c3c;
}

/* テーブルコンテナ */
.table-container {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  margin-bottom: 30px;
}

.table-container h2 {
  padding: 20px 20px 0 20px;
  margin: 0;
  color: #2c3e50;
  font-size: 18px;
}

/* データテーブル */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 15px;
}

.data-table th,
.data-table td {
  padding: 12px 20px;
  text-align: left;
  border-bottom: 1px solid #ecf0f1;
}

.data-table th {
  background-color: #f8f9fa;
  font-weight: bold;
  color: #2c3e50;
}

.data-table tr:hover {
  background-color: #f8f9fa;
}

/* 管理者専用メニューのスタイル */
.menu-item.admin-only {
  border-top: 1px solid #3b4d63;
  margin-top: 10px;
  padding-top: 10px;
}

.menu-item.admin-only a {
  color: #e74c3c;
  font-weight: bold;
}

.menu-item.admin-only a:hover {
  background-color: #c0392b;
  color: white;
}

.menu-item.admin-only.active a {
  background-color: #e74c3c;
  color: white;
}

/* ハンバーガーメニューボタン（デフォルトで非表示） */
.hamburger-menu {
  display: none;
  position: fixed;
  top: 15px;
  left: 15px;
  z-index: 1001;
  background-color: #2c3e50;
  border: none;
  color: white;
  width: 45px;
  height: 45px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
}

.hamburger-menu:hover {
  background-color: #34495e;
  transform: scale(1.05);
}

.hamburger-menu:active {
  transform: scale(0.95);
}

/* サイドバーオーバーレイ（デフォルトで非表示） */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* レスポンシブデザイン: 1300px以下でハンバーガーメニューを表示 */
@media (max-width: 1300px) {
  /* ハンバーガーメニューボタンを表示 */
  .hamburger-menu {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* サイドバーをデフォルトで非表示にし、左側に配置 */
  .sidebar {
    position: fixed;
    left: -250px;
    top: 0;
    height: 100vh;
    width: 250px;
    z-index: 1000;
    transition: left 0.3s ease;
  }

  /* サイドバーがアクティブな時に表示 */
  .sidebar.active {
    left: 0;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
  }

  /* メインコンテンツの調整 */
  .main-content {
    margin-left: 0;
    width: 100%;
    padding: 70px 15px 15px 15px; /* 上部にハンバーガーメニュー分のスペースを確保 */
  }

  /* サイドバーが開いている時のbodyスクロール防止 */
  body.sidebar-open {
    overflow: hidden;
  }
}

/* 1301px超でサイドバーを常に表示 */
@media (min-width: 1301px) {
  .sidebar {
    left: 0 !important;
  }

  .hamburger-menu {
    display: none !important;
  }

  .sidebar-overlay {
    display: none !important;
  }
}