/* ==========================================================================
   ベース設定 (Typography & Colors)
   学習に集中できるよう、読みやすさを最優先にした設定
   ========================================================================== */
:root {
    --primary-color: #1A73E8;       /* メインカラー（リンク、見出し） */
    --primary-light: #e8f0fe;       /* 薄い背景用（選択状態など） */
    --text-main: #202124;           /* 本文 */
    --text-muted: #5f6368;          /* 補足情報 */
    --border-color: #dadce0;        /* 境界線 */
    --bg-body: #f5f7fa;             /* 全体の背景（少しグレーを入れる） */
    --bg-content: #ffffff;          /* 記事部分の背景（白） */
    --code-bg: #2d2d2d;             /* コードブロック背景 */
}

body {
    font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0; /* 全体の余白はレイアウト側で調整 */
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.8; /* 読むストレスを減らすため少し広めに */
    -webkit-font-smoothing: antialiased;
}
/* ▼▼▼ 追加: 通常（PC）時はハンバーガーボタンを隠す ▼▼▼ */
.menu-toggle {
    display: none; 
}
/* リンク */
a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}
a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   レイアウト (Container & Flexbox)
   ========================================================================== */
.content-container {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    min-height: 100vh;
}

/* ==========================================================================
   サイドバー (Menu)
   学習の進捗がわかりやすい「コース目次」風デザイン
   ========================================================================== */
/* content2.css の .content-menu 部分を書き換え */
.content-menu {
    width: 320px;      /* 280px -> 320px に変更 */
    min-width: 320px;  /* 280px -> 320px に変更 */
    height: 100vh;
    overflow-y: auto;
    position: sticky;
    top: 0;
    background-color: #fff;
    border-right: 1px solid var(--border-color);
    padding: 20px 0;
    font-size: 0.9rem;
    
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Chrome, Safari, Opera 用のスクロールバー非表示設定 */
.content-menu::-webkit-scrollbar {
    display: none;
}

.content-menu h2 {
    font-size: 1.1rem;
    padding: 0 20px 15px;
    margin: 0 0 10px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-muted);
    font-weight: 700;
}

.content-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.content-menu ul li {
    margin: 0;
}

.content-menu ul li a {
    display: flex;
    align-items: flex-start;
    /* ▼▼▼ 修正: 左の隙間（padding）を減らしました (20px -> 15px) ▼▼▼ */
    padding: 10px 15px; 
    color: var(--text-main);
    border-left: 4px solid transparent;
    text-decoration: none;
    line-height: 1.5;
}

/* 学習完了済み（チェックマーク）のスタイル */
.content-menu ul li a span.check {
    color: #34A853; /* Google Green */
    margin-right: 8px;
    font-weight: bold;
}

/* ホバー時 */
.content-menu ul li a:hover {
    background-color: var(--bg-body);
    color: var(--primary-color);
}

/* アクティブ（現在地） */
.content-menu ul li a.active {
    background-color: var(--primary-light);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    font-weight: 700;
}

/* ==========================================================================
   メインコンテンツエリア
   ========================================================================== */
.content-main {
    flex-grow: 1;
    padding: 40px 60px; /* 余白をたっぷりとって読みやすく */
    background-color: var(--bg-content);
    max-width: 900px; /* 1行が長くなりすぎないように制限 */
    margin: 0 auto;   /* 中央寄せ */
}

/* 記事タイトル */
.content-main h1 {
    font-size: 2rem;
    margin-top: 0;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    line-height: 1.4;
}

/* メタ情報（作成日など） */
.content-main p:nth-child(2),
.content-main p:nth-child(3) {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

/* ==========================================================================
   記事本文のスタイル (Typography)
   ========================================================================== */

/* --- 見出し --- */
.content-main h2 {
    font-size: 1.6rem;
    margin-top: 3rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-color); /* 下線で区切り */
    color: var(--text-main);
}

.content-main h3 {
    font-size: 1.3rem;
    margin-top: 2.5rem;
    margin-bottom: 1.2rem;
    padding-left: 12px;
    border-left: 5px solid var(--primary-color); /* 左線で強調 */
    color: #444;
}

.content-main h4 {
    font-size: 1.1rem;
    margin-top: 2rem;
    font-weight: bold;
    color: #555;
}

/* --- 段落 --- */
.content-main p {
    margin-bottom: 1.5rem;
    text-align: justify; /* 日本語の端を揃える */
}

/* --- リスト --- */
.content-main ul, 
.content-main ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}
.content-main li {
    margin-bottom: 0.5rem;
}

/* --- 引用 (Point / Note) --- */
/* 勉強系サイトらしく「重要ポイント」として目立たせる */
.content-main blockquote {
    margin: 2rem 0;
    padding: 1.5rem;
    background-color: #f8f9fa;
    border-left: 5px solid #FBC02D; /* 黄色で注意喚起 */
    border-radius: 4px;
    color: #444;
    font-style: normal; /* 斜体にしない */
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.content-main blockquote p:last-child {
    margin-bottom: 0;
}

/* --- 画像 --- */
.content-main img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    margin: 1.5rem 0;
}
figure.image {
    text-align: center;
    margin: 2rem 0;
}

/* ==========================================================================
   【修正箇所】テーブルデザイン
   Markdownの裸のtableタグとCKEditorのfigure.table両方に対応
   ========================================================================== */
.content-main table {
    width: 100%;
    border-collapse: collapse; /* 枠線を重ねて1本にする */
    margin: 2rem 0;
    font-size: 0.95rem;
    border: 1px solid var(--border-color); /* 外枠 */
}

/* テーブルヘッダー */
.content-main table th {
    background-color: #f1f3f4;
    color: #333;
    font-weight: bold;
    padding: 12px 15px;
    border: 1px solid var(--border-color); /* 全てのセルに枠線 */
    text-align: left;
    white-space: nowrap; /* ヘッダーの折り返し防止（任意） */
}

/* テーブルデータ */
.content-main table td {
    padding: 12px 15px;
    border: 1px solid var(--border-color); /* 全てのセルに枠線 */
    vertical-align: top;
}

/* 縞模様（読みやすくする） */
.content-main table tr:nth-child(even) {
    background-color: #fbfbfb;
}

/* CKEditor用のラッパー調整 */
figure.table {
    margin: 2rem 0;
    overflow-x: auto; /* 横スクロール対応 */
}
/* CKEditorのテーブルも上記スタイルを引き継ぐが、リセットが必要な場合のみ記述 */


/* ==========================================================================
   コードブロック (Programming / Math)
   ========================================================================== */
pre {
    background-color: var(--code-bg);
    color: #f8f8f8;
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 2rem 0;
    position: relative;
    box-shadow: 0 4px 6px rgba(0,0,0,0.15);
}

/* コピーボタンの装飾 */
pre::before {
    content: "Copy";
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255,255,255,0.1);
    color: #ccc;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}
pre:hover::before {
    opacity: 1;
}

code {
    font-family: 'Consolas', monospace;
    background-color: rgba(27,31,35,0.05); /* 薄いグレー */
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-size: 0.9em;
    color: #d63384; /* インラインコードを目立たせる色 */
}

pre code {
    background-color: transparent; /* ブロック内のコードは背景なし */
    color: inherit;
    padding: 0;
}


/* ==========================================================================
   完了ボタン・ナビゲーション・コメント
   ========================================================================== */
#progressForm {
    background-color: #e8f0fe;
    padding: 20px;
    border-radius: 8px;
    margin: 40px 0;
    display: flex;
    align-items: center;
    gap: 15px;
    border: 1px solid #d2e3fc;
}

#progressForm input[type="checkbox"] {
    transform: scale(1.5);
    cursor: pointer;
}

.content-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.content-navigation a {
    display: inline-block;
    padding: 10px 20px;
    background-color: #fff;
    border: 1px solid var(--primary-color);
    border-radius: 30px;
    font-weight: bold;
    transition: all 0.2s;
}

.content-navigation a:hover {
    background-color: var(--primary-color);
    color: #fff;
    text-decoration: none;
}

/* コメント欄 */
.content-main form textarea {
    width: 100%;
    min-height: 100px;
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    margin-bottom: 10px;
    box-sizing: border-box; /* 枠からはみ出し防止 */
}

.content-main form button {
    background-color: var(--primary-color);
    color: white;
    padding: 10px 25px;
    border: none;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}
.content-main form button:hover {
    background-color: #1557b0;
}
/* ==========================================================================
   トースト通知 (Snackbar)
   ========================================================================== */
#snackbar {
    visibility: hidden; /* 最初は隠しておく */
    min-width: 250px;
    margin-left: -125px; /* 真ん中に配置するための調整 */
    background-color: #333; /* 背景色 */
    color: #fff;
    text-align: center;
    border-radius: 50px; /* 丸みをつけてモダンに */
    padding: 16px;
    position: fixed;
    z-index: 2000; /* 最前面に表示 */
    left: 50%;
    bottom: 30px;
    font-size: 1rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

/* 表示する時のクラス */
#snackbar.show {
    visibility: visible;
    -webkit-animation: fadein 0.5s, fadeout 0.5s 2.5s;
    animation: fadein 0.5s, fadeout 0.5s 2.5s;
}

/* アニメーション設定 (フェードイン・アウト) */
@-webkit-keyframes fadein {
    from {bottom: 0; opacity: 0;} 
    to {bottom: 30px; opacity: 1;}
}

@keyframes fadein {
    from {bottom: 0; opacity: 0;}
    to {bottom: 30px; opacity: 1;}
}

@-webkit-keyframes fadeout {
    from {bottom: 30px; opacity: 1;} 
    to {bottom: 0; opacity: 0;}
}

@keyframes fadeout {
    from {bottom: 30px; opacity: 1;}
    to {bottom: 0; opacity: 0;}
}
/* ==========================================================================
   レスポンシブ (Mobile)
   ========================================================================== */
@media (max-width: 768px) {
    .content-container {
        flex-direction: column;
    }
    
    /* メニュー本体：最初は画面外（左）に隠しておく */
    .content-menu {
        position: fixed;
        left: -300px;
        width: 260px;
        height: 100%; /* 全画面高さ */
        z-index: 1000;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
        transition: left 0.3s ease;
        padding-top: 60px; /* ★上部にボタン分の余白を空ける */
    }
    
    /* クラスがついたら表示 */
    .content-menu.open {
        left: 0;
    }

    .content-main {
        padding: 60px 20px 20px; /* ★上部にボタン分の余白を空ける */
        margin-left: 0;
    }

    .content-main h1 {
        font-size: 1.6rem;
    }
    
    /* ▼▼▼ 追加: ハンバーガーボタンを画面左上に固定 ▼▼▼ */
    .menu-toggle {
        display: flex;       /* ここで display: none を上書きして表示させる */
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 10px;
        left: 10px;
        width: 45px;
        height: 45px;
        background-color: var(--primary-color);
        color: white;
        border-radius: 4px;
        box-shadow: 0 2px 5px rgba(0,0,0,0.2);
        z-index: 1100;
        cursor: pointer;
        font-size: 1.5rem;
        line-height: 1;
    }
    
    /* ボタンにマウスが乗った時 */
    .menu-toggle:hover {
        background-color: #1557b0;
    }
}