:root {
  --bg-dark: #0f1113;
  --sidebar-bg: #1a1c20;
  --accent-main: #00faac; 
  --accent-blue: #00d1ff;
  --accent-gradient: linear-gradient(135deg, #00faac 0%, #00d1ff 100%);
  --text-main: #e0e0e0;
  --text-dim: #999;
  --card-bg: #25282c;
  --transition: all 0.3s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  overflow: hidden;
}

.app-container {
  display: flex;
  height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
  width: 260px;
  background-color: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  border-right: 1px solid #333;
  z-index: 1100 !important;
}

.sidebar-header {
  padding: 20px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #008f68 0%, #01eea3e5 100%);
}

.logo-icon {
  font-size: 1.8rem;
  color: var(--accent-main);
}

.sidebar-header h2 {
  font-size: 1.2rem;
  letter-spacing: 1px;
  font-weight: bold;
  -webkit-background-clip: text;
  background-clip: text;
  color: #e4fcf9;
}

#nav-menu ul {
  list-style: none;
  margin-bottom: 20px;
}

#nav-menu li a {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px 25px;
  color: var(--accent-main);
  text-decoration: none;
  transition: var(--transition);
  font-weight: 500;
}

#nav-menu li.active a,
#nav-menu li a:hover {
  background: rgba(0, 250, 172, 0.1);
  color: var(--accent-blue);
  border-left: 4px solid var(--accent-main);
}

/* --- Top Navigation Menu --- */
#top-nav-menu {
  display: flex;
  align-items: center;
  height: 100%;
}

#top-nav-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  height: 70px;
  color: var(--accent-main);
  text-decoration: none;
  transition: var(--transition);
  font-weight: 500;
  border-bottom: 4px solid transparent;
}

#top-nav-menu a.active,
#top-nav-menu a:hover {
  background: rgba(0, 250, 172, 0.1);
  color: var(--accent-blue);
  border-bottom: 4px solid var(--accent-main);
}

/* --- Main Content Layout --- */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.top-bar {
  height: 70px;
  background: var(--sidebar-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  border-bottom: 1px solid #333;
}

#menu-toggle {
  background: none;
  border: none;
  color: var(--accent-main);
  font-size: 1.2rem;
  cursor: pointer;
  display: none;
}

#page-title {
  font-size: 1.5rem;
  font-weight: 600;
}

#content-area {
  flex: 1;
  padding: 20px;
}

/* Responsive */
/* ==========================================================================
   スマホサイズ（画面幅 768px 以下）でのメニュー折り返し・最適化設定
   ========================================================================== */
@media (max-width: 768px) {
  .sidebar { position: fixed; left: -260px; }
  .sidebar.active { left: 0; }
  #menu-toggle { display: block; }
  /* top-bar自体の高さを自動伸縮にして溢れを防ぐ */
  .top-bar {
    height: auto !important;
    min-height: 100px;
    padding: 10px 20px 50px !important;
    flex-wrap: wrap; /* 要素が横に並びきらない場合に下へ流す */
    gap: 10px;
  }

  /* ページタイトルとメニューを上下2段に分ける設定 */
  #page-title {
    width: auto;
    font-size: 1.3rem; /* スマホ用に少し文字を小さく */
  }

  #top-nav-menu {
    width: 100%; /* メニュー全体を横いっぱいに広げて一段下に配置 */
    justify-content: space-around; /* メニューボタンを均等に配置 */
    border-top: 1px solid #333; /* 境界線を入れて見やすく */
    padding-top: 5px;
  }

  #top-nav-menu a {
    flex-direction: column; /* アイコンと文字を縦並び（一段下げる）にする */
    justify-content: center;
    gap: 4px;
    height: 60px; /* スマホ用のコンパクトな高さ */
    padding: 0 10px;
    font-size: 0.8rem; /* 文字がはみ出さないよう少し小さく */
    border-bottom: none;
  }

  /* スマホ版は下ライン発光ではなく、全体的な背景微発光でアクティブを表現 */
  #top-nav-menu a.active,
  #top-nav-menu a:hover {
    border-bottom: none;
    background: rgba(0, 250, 172, 0.15);
    border-radius: 6px;
  }
}
