/* --- 基本設定と変数 --- */
:root {
    --primary-color: #00A8FF;
    --secondary-color: #3B429F;
    --accent-color: #E845A3;
    --bg-dark: #0F172A;
    --text-light: #F8F9FA;
    --text-dark: #E2E8F0;
    --border-color: rgba(255, 255, 255, 0.1);
    --card-bg: rgba(255, 255, 255, 0.05);
}

body {
    background-color: var(--bg-dark);
    color: var(--text-light);
    font-family: 'Poppins', 'Noto Sans JP', sans-serif;
    margin: 0;
    padding-top: 80px; /* 固定ヘッダー分の余白 */
    line-height: 1.7;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --- ヘッダー --- */
.site-header {
    padding: 20px 0;
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 100;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.3s ease;
}
.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.site-logo {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--primary-color);
    text-decoration: none;
}
.account-nav {
    display: flex;
    align-items: center;
    gap: 15px; /* ボタン間の隙間 */
}
.username-display {
    font-size: 0.9rem;
    color: var(--text-dark);
}

/* --- ボタン --- */
.btn {
    display: inline-block;
    padding: 8px 18px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.3s ease;
}
.btn-primary {
    background-color: var(--primary-color);
    color: #fff;
}
.btn-primary:hover {
    background-color: #0081cc;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 168, 255, 0.3);
}
.btn-secondary {
    background-color: transparent;
    color: var(--primary-color);
    border-color: var(--primary-color);
}
.btn-secondary:hover {
    background-color: var(--primary-color);
    color: #fff;
}

/* --- フッター --- */
.site-footer {
    padding: 30px 0;
    border-top: 1px solid var(--border-color);
    font-size: 0.9rem;
}
.site-footer .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.footer-nav a {
    color: var(--text-dark);
    text-decoration: none;
    margin-left: 20px;
    transition: color 0.3s;
}
.footer-nav a:hover {
    color: var(--primary-color);
}

/* --- ヒーローセクション --- */
.hero {
    position: relative;
    height: calc(100vh - 80px); /* ヘッダーの高さを引く */
    min-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    overflow: hidden;
}
.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}
.hero-content {
    position: relative;
    z-index: 2;
}
.hero h1 {
    font-size: 3.2rem;
    font-weight: 600;
    margin-bottom: 1rem;
    line-height: 1.3;
}
.hero p {
    font-size: 1.2rem;
    color: var(--text-dark);
    max-width: 600px;
    margin: 0 auto 2rem;
}
.btn-large {
    padding: 12px 28px;
    font-size: 1.1rem;
}

/* --- サイト紹介セクション --- */
.tool-section {
    padding: 80px 0;
}
.tool-section h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 60px;
    color: var(--primary-color);
}
.tool-card {
    display: flex;
    background: var(--card-bg);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    margin-bottom: 40px;
    flex-direction: column; /* スマホでは縦並び */
}
.tool-card-image {
    flex-basis: 45%;
    background-color: #000; /* 画像がない場合の背景 */
}
.tool-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.tool-card-content {
    flex-basis: 55%;
    padding: 40px;
}
.tool-card-content h3 {
    font-size: 1.8rem;
    margin-top: 0;
    margin-bottom: 15px;
}
.tool-description {
    color: var(--text-dark);
}
.tool-link-notice {
    color: var(--text-dark);
    font-style: italic;
    margin-top: 20px;
    font-size: 0.9rem;
}

/* --- アニメーション --- */
.animate-on-load {
    animation: fadeIn 1s ease-out forwards;
    opacity: 0;
}
.delay-1 { animation-delay: 0.2s; }
.delay-2 { animation-delay: 0.4s; }

.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.animate-on-scroll.is-visible {
    opacity: 1;
    transform: translateY(0);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- レスポンシブ対応 --- */
@media (min-width: 768px) {
    .tool-card {
        flex-direction: row; /* PCでは横並び */
    }
    .tool-card:nth-child(even) .tool-card-image {
        order: 2; /* 偶数番目のカードは画像を右に */
    }
}
@media (max-width: 600px) {
    .hero h1 { font-size: 2.5rem; }
    .hero p { font-size: 1rem; }
    .tool-card-content { padding: 30px; }
}

/* --- 汎用ページコンテナ --- */
.page-container {
    max-width: 700px;
    margin: 40px auto;
    padding: 20px;
}
.page-title {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 40px;
}

/* --- フォーム関連 --- */
.form-container {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}
.styled-form .form-group {
    margin-bottom: 25px;
}
.styled-form label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-dark);
}
.styled-form input[type="email"],
.styled-form input[type="password"],
.styled-form input[type="text"] {
    width: 100%;
    padding: 12px;
    background-color: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    color: var(--text-light);
    font-size: 1rem;
    box-sizing: border-box; /* paddingを含めてwidth 100%にする */
    transition: border-color 0.3s, box-shadow 0.3s;
}
.styled-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 168, 255, 0.3);
}
.form-actions {
    text-align: center;
    margin-top: 30px;
}
.form-link {
    text-align: center;
    margin-top: 25px;
    font-size: 0.9rem;
}
.form-link a {
    color: var(--primary-color);
    text-decoration: none;
}
.form-link a:hover {
    text-decoration: underline;
}

/* --- メッセージ表示 --- */
.message {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
    border: 1px solid;
}
.error-message {
    background-color: rgba(255, 0, 85, 0.1);
    border-color: rgba(255, 0, 85, 0.5);
    color: #ff8c8c;
}
.error-message ul {
    margin: 0;
    padding-left: 20px;
}
.success-message {
    background-color: rgba(0, 255, 136, 0.1);
    border-color: rgba(0, 255, 136, 0.5);
    color: #9affd9;
    text-align: center;
}

/* --- ヘッダーのナビゲーションアイコン --- */
.nav-user-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

/* --- プロフィールページ --- */
.profile-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 40px;
}
.profile-section {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}
.profile-section h2 {
    margin-top: 0;
    color: var(--primary-color);
    font-size: 1.5rem;
}
.icon-preview {
    text-align: center;
    margin-bottom: 20px;
}
.icon-preview img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border-color);
}
.styled-form input[readonly] {
    background-color: #2c3e50;
    cursor: not-allowed;
}
.styled-form small {
    display: block;
    margin-top: 5px;
    font-size: 0.8rem;
    color: var(--text-dark);
}

/* PC表示用のグリッドレイアウト */
@media (min-width: 768px) {
    .profile-container {
        grid-template-columns: 1fr 1.5fr;
    }
}

/* --- プロフィールページの区切り線 --- */
.form-divider {
    border: 0;
    height: 1px;
    background-color: var(--border-color);
    margin: 40px 0;


/* --- 危険な操作のボタン --- */
.btn-danger {
    background-color: #dc3545;
    color: #fff;
    border-color: #dc3545;
}
.btn-danger:hover {
    background-color: #c82333;
    border-color: #bd2130;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.4);
}

/* --- アカウント削除セクション --- */
.danger-zone {
    margin-top: 40px;
    padding: 30px;
    border-radius: 10px;
    border: 2px solid #dc3545;
}
.danger-zone h2 {
    margin-top: 0;
    color: #ff8c8c;
}
.danger-zone p {
    color: var(--text-dark);
}
/* --- ツール紹介セクションの改修 --- */
.tool-categories-container {
    margin-top: 40px;
}
.category-group {
    margin-bottom: 20px;
}
.category-header {
    background: var(--card-bg);
    padding: 15px 25px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.3s ease;
    border: 1px solid var(--border-color);
}
.category-header:hover {
    background: rgba(255, 255, 255, 0.1);
}
.category-toggle-icon {
    width: 12px;
    height: 12px;
    border-right: 2px solid var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    transform: rotate(45deg);
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}
.category-header.is-open .category-toggle-icon {
    transform: rotate(-135deg);
}

/* --- 開閉アニメーションのコンテナ --- */
.tool-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    
    /* 高さを0にして隠す */
    max-height: 0;
    padding-top: 0; /* 開閉時にpaddingもアニメーションさせる */
    overflow: hidden;
    transition: max-height 0.5s ease-out, padding-top 0.5s ease-out;
}
.tool-cards-grid.is-open {
    padding-top: 25px;
    max-height: 1000px; /* 十分な高さを確保 */
    transition: max-height 1s ease-in, padding-top 1s ease-in;
}

/* --- ツールカード自体のスタイル --- */
.tool-card {
    margin-bottom: 0;
    flex-direction: column;
    text-align: left;
    
    /* アニメーションの初期状態をopacity: 0に */
    opacity: 0;
    transform: translateY(20px);
    /* transitionに遅延(delay)を追加 */
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
    transition-delay: var(--delay-in);
}

/* カテゴリが開いたときにカードのアニメーションを開始 */
.category-group.is-open .tool-card {
    opacity: 1;
    transform: translateY(0);
    /* calc()を使ってHTMLで設定したカスタムプロパティから遅延時間を計算 */
    transition-delay: calc(0.1s * var(--delay-index));
}


.tool-card-content h4 {
    font-size: 1.3rem; margin-top: 0; margin-bottom: 10px;
}
.tool-tags {
    margin: 15px 0;
}
.tag {
    display: inline-block; background-color: rgba(0, 168, 255, 0.15); color: var(--primary-color); padding: 4px 10px; border-radius: 15px; font-size: 0.8rem; margin-right: 8px; margin-bottom: 8px;
}

/* 生徒認証メッセージ */
.auth-required-message {
    background: rgba(255, 255, 255, 0.03); border-radius: 8px; padding: 30px; text-align: center; grid-column: 1 / -1;
    opacity: 0;
    transition: opacity 0.5s ease-out 0.2s; /* 少し遅れて表示 */
}
.category-group.is-open .auth-required-message {
    opacity: 1;
}

/* --- 静的ページ (プライバシーポリシーなど) --- */
.static-page {
    background: var(--card-bg);
    padding: 30px 40px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}
.static-page h2 {
    color: var(--primary-color);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
    margin-top: 40px;
    margin-bottom: 20px;
}
.static-page ol {
    padding-left: 25px;
}

/* --- フッターのナビゲーションアイテム --- */
.footer-nav-item {
    display: inline-flex;
    align-items: center;
    color: var(--text-dark);
    text-decoration: none;
    margin-left: 20px;
    transition: color 0.3s;
    position: relative;
}
.footer-nav-item:hover {
    color: var(--primary-color);
}

/* --- 通知バッジ --- */
.notification-badge {
    position: absolute;
    top: -5px;
    right: -10px;
    background-color: #dc3545; /* 赤色 */
    color: #fff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 0.7rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    border: 2px solid var(--bg-dark); /* フッターの背景色 */
}/* --- ヘッダーのナビゲーションアイコン (最終版) --- */
/* ヘッダー内のプロフィールリンクに含まれる、nav-user-iconクラスを持つ画像にスタイルを適用 */
.header-nav-item.profile-link .nav-user-icon {
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    background-color: #ffffff !important;
    padding: 2px !important;
    border: 1px solid var(--border-color) !important;
    box-sizing: content-box !important;
    max-width: none !important;
}

/* --- ヘッダーのナビゲーションアイコン (背景デザイン改善版) --- */

/* ヘッダー内のプロフィールリンクに含まれる、nav-user-iconクラスを持つ画像にスタイルを適用 */
.header-nav-item.profile-link .nav-user-icon {
    /* サイズと形状 */
    width: 34px;
    height: 34px;
    border-radius: 50%; /* 完全な円形 */
    object-fit: cover;
    box-sizing: content-box;

    /* ★★★ ここからがデザインの核心 ★★★ */

    /* 1. 背景色: サイトのダークブルーに馴染む、少し明るいグレー */
    background-color: #2c3e50; /* 例: Slate Gray */

    /* 2. 内側の余白: アイコンと背景の間に隙間を作る */
    padding: 2px;

    /* 3. 外側の枠線: アイコンをさらに際立たせるアクセント */
    border: 1px solid rgba(255, 255, 255, 0.2); /* 半透明の白 */

    /* 4. 影: アイコンが少し浮き出て見えるような効果を追加 */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    
    /* 5. ホバーエフェクト: マウスを乗せたときに少し反応するように */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* マウスを乗せたときのスタイル */
.header-nav-item.profile-link:hover .nav-user-icon {
    transform: scale(1.1); /* 少し拡大 */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}