/* Google Fonts のインポート */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;700&display=swap');

/* --- 変数定義 --- */
:root {
    --primary-color: #0d6efd;
    --primary-hover-color: #0b5ed7;
    --secondary-color: #6c757d;
    --secondary-hover-color: #5a6268;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #fd7e14;
    --info-hover-color: #e66a00;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --text-color: #333;
    --bg-color: #f4f7f6;
    --border-color: #dee2e6;
    --sidebar-bg: #212529;
    --sidebar-text: #adb5bd;
    --sidebar-active-bg: #0d6efd;
}

/* --- 基本スタイル --- */
body {
    font-family: 'Noto Sans JP', sans-serif;
    color: var(--text-color);
    margin: 0;
    font-size: 16px;
}

body.login-style-background {
    background: linear-gradient(135deg, #00b3cb 0%, #0071c5 50%, #a700b0 100%);
    background-attachment: fixed;
}

a {
    color: var(--primary-color);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

h1 {
    font-size: 1.75rem;
    font-weight: 500;
}

h2 {
    font-size: 1.5rem;
    font-weight: 500;
}

/* --- 管理画面レイアウト --- */
.admin-container {
    display: flex;
}

.sidebar {
    width: 240px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    min-height: 100vh;
    padding: 20px 0;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 0 20px 20px 20px;
    text-align: center;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
}

.sidebar-nav li a {
    color: var(--sidebar-text);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    text-decoration: none;
    transition: all 0.2s ease-in-out;
}

.sidebar-nav li a:hover {
    background-color: #343a40;
    color: white;
    text-decoration: none;
}

.sidebar-nav li a.active {
    background-color: var(--sidebar-active-bg);
    color: white;
    font-weight: 500;
}

.sidebar-nav li a i {
    width: 20px;
    text-align: center;
}

.main-content {
    flex-grow: 1;
    padding: 30px;
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
    margin-bottom: 30px;
}

.platform-title {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--dark-color);
}

/* ★★★ ここを修正 ★★★ */
.platform-title .ai-highlight {
    color: var(--info-color);
}

.user-info {
    font-size: 0.9em;
    color: var(--secondary-color);
}

.user-info a {
    margin-left: 10px;
}

/* --- フォーム全般 --- */
.form-section {
    background: white;
    padding: 2em;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-bottom: 2em;
}

.form-section:last-child {
    margin-bottom: 0;
}

.form-group {
    margin-bottom: 1.5em;
}

label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5em;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 0.8em;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.25);
}

textarea {
    min-height: 100px;
    resize: vertical;
}

.form-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 1.5em;
    border-top: 1px solid var(--border-color);
}

/* --- ボタン全般 --- */
.btn {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.875em;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    text-align: center;
    margin-right: 8px;
    vertical-align: middle;
}

.btn:last-child {
    margin-right: 0;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover-color);
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-info {
    background-color: var(--info-color);
    color: white;
}

.btn-info:hover {
    background-color: var(--info-hover-color);
}

.btn-edit {
    background-color: var(--warning-color);
    color: #212529;
}

.btn-edit:hover {
    background-color: #ffca2c;
}

.btn-delete {
    background-color: var(--secondary-color);
    color: white;
}

.btn-delete:hover {
    background-color: var(--secondary-hover-color);
}

.btn-secondary {
    background-color: #f8f9fa;
    color: #333;
    border: 1px solid #dee2e6;
}

.btn-secondary:hover {
    background-color: #e9ecef;
}

.btn-stylish {
    padding: 0.6rem 1.2rem;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
    background: var(--primary-color, #007bff);
    color: #fff;
    border: none;
    display: inline-flex;
    align-items: center;
}

.btn-stylish:hover {
    transform: translateY(-2px);
}

.btn-stylish i {
    margin-right: 0.5rem;
}

.btn-sm {
    padding: 2px 8px;
    font-size: 0.8em;
}

.btn-sm i {
    margin-right: 3px;
}

/* --- テーブル --- */
.content-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    table-layout: fixed;
}

.content-table th,
.content-table td {
    border: 1px solid var(--border-color);
    padding: 12px 15px;
    vertical-align: middle;
}

.content-table th {
    background-color: var(--light-color);
    font-weight: 500;
    text-align: center;
}

.content-table td {
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.content-table .td-center {
    text-align: center;
    white-space: normal;
}

.thumbnail-img {
    width: 120px;
    height: 67px;
    border-radius: 4px;
    object-fit: cover;
}

.action-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

/* --- 検索フォーム --- */
.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.search-form {
    display: flex;
    gap: 10px;
}

.search-form input {
    width: 250px;
    padding: 8px 12px;
}

.search-form .btn {
    margin-right: 0;
}

/* --- 編集ページのレイアウト --- */
.edit-page-container {
    display: flex;
    gap: 2em;
    align-items: flex-start;
    flex-wrap: wrap;
}

.edit-main-column {
    flex: 2;
    min-width: 300px;
}

.edit-side-column {
    flex: 1;
    min-width: 300px;
    position: sticky;
    top: 30px;
}

#edit-form {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.video-player {
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: 8px;
    background-color: #000;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    display: none;
}

.ai-action-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* --- パスワード表示切り替え --- */
.password-wrapper {
    position: relative;
}

.password-wrapper input[type="password"],
.password-wrapper input[type="text"] {
    padding-right: 45px;
    box-sizing: border-box;
}

.toggle-password {
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--secondary-color);
}

/* --- video_edit.php の checkbox group --- */
.checkbox-group {
    border: 1px solid var(--border-color);
    padding: 1.5em;
    border-radius: 8px;
    column-count: 2;
    column-gap: 2em;
}

label.checkbox-label {
    font-weight: normal;
    display: flex;
    align-items: center;
    gap: 0.8em;
    cursor: pointer;
    margin-bottom: 1em;
    break-inside: avoid;
}

/* --- AI処理ステータス --- */
#ai-status,
.status-pending,
.status-processing,
.status-completed,
.status-failed {
    padding: 0.2em 0.6em;
    border-radius: 4px;
    font-size: 0.9em;
    font-weight: 500;
    text-transform: capitalize;
    display: inline-block;
    border: 1px solid transparent;
}

/* 各ステータスの色設定 */
.status-pending {
    background-color: #6c757d;
    color: white;
}

.status-processing {
    background-color: #fff3cd;
    /* 薄い黄色 */
    color: #664d03;
    border-color: #ffecb5;
}

.status-completed {
    background-color: #d1e7dd;
    /* 薄い緑色 */
    color: #0f5132;
    border-color: #badbcc;
}

.status-failed {
    background-color: #f8d7da;
    /* 薄い赤色 */
    color: #58151c;
    border-color: #f1c6ca;
}

/* --- ボタン内のアイコン --- */
.btn i {
    margin-right: 4px;
    font-size: 0.9em;
}

/* --- グループ管理: 所属管理者リストのスタイル --- */
.admin-list {
    margin: 0;
    padding-left: 0;
    list-style-type: none;
}

.admin-list-item {
    padding: 8px 0;
}

.admin-list-item:not(:last-child) {
    border-bottom: 1px solid #f0f0f0;
}

.admin-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    margin-bottom: 8px;
}

.admin-actions {
    text-align: right;
}

/* --- メッセージボックス --- */
.message-box {
    padding: 1em;
    margin-bottom: 1.5em;
    border-radius: 5px;
    color: white;
}

.message-box.success {
    background-color: var(--success-color);
}

.message-box.danger {
    background-color: var(--danger-color);
}

.message-box.info {
    background-color: var(--info-color);
}

/* プログレスバー */
.progress-bar-container {
    width: 100%;
    background-color: #e9ecef;
    border-radius: 5px;
    margin-top: 10px;
    display: none;
}

.progress-bar {
    width: 0%;
    height: 20px;
    background-color: var(--primary-color);
    border-radius: 5px;
    text-align: center;
    line-height: 20px;
    color: white;
    font-size: 0.8em;
    transition: width 0.4s ease;
}

.subtitle-actions-wrapper {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.spinner-sm {
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid #fff;
    border-radius: 50%;
    width: 1em;
    height: 1em;
    animation: spin 1s linear infinite;
    display: inline-block;
    margin-right: 8px;
}

/* --- 学習者画面 & 動画視聴ページ スタイル --- */
.learner-container,
.watch-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 30px 70px 30px;
    /* 余白をさらに増やしてゆとりを持たせる */
    background-color: #fff;
    min-height: 100vh;
}

.watch-container {
    max-width: 1000px;
    /* 少し幅を広げて窮屈さを軽減 */
    padding: 2em 30px;
    /* デスクトップ用に余白を増やす */
}

.learner-header,
.watch-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    /* 上部余白を増やす */
    border-bottom: none;
    margin-bottom: 1.5em;
    /* 間隔を広げる */
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    /* 間隔を広げる */
    color: var(--secondary-color);
    text-decoration: none;
    transition: color 0.2s;
    font-size: 0.9rem;
}

.back-link:hover {
    color: var(--primary-color);
}

a.logout-link {
    color: var(--secondary-color);
    text-decoration: none;
    font-size: 0.9rem;
}

a.logout-link:hover {
    color: var(--primary-color);
}

a.logout-link i {
    margin-right: 5px;
}

.welcome-message {
    text-align: center;
    padding: 2em 0;
    /* 余白を増やす */
    margin-bottom: 3em;
    /* 間隔を広げる */
}

.welcome-message h2 {
    margin: 0;
    font-size: 1.6rem;
    /* 少し大きくして印象を強める */
    font-weight: 700;
}

.welcome-message p {
    margin: 0.6em 0 0 0;
    color: var(--secondary-color);
    font-size: 1rem;
}

.video-section h3 {
    font-size: 1.4rem;
    /* 少し大きく */
    margin-bottom: 1.5em;
    /* 間隔を広げる */
    padding-bottom: 0.6em;
    border-bottom: 2px solid var(--primary-color);
}

.video-section h3 i {
    margin-right: 0.6em;
}

.no-content-message {
    text-align: center;
    padding: 4.5em 1em;
    /* 余白を増やす */
    background-color: var(--bg-color);
    border-radius: 8px;
    color: var(--secondary-color);
}

.video-grid {
    display: grid;
    gap: 30px;
    /* 間隔をさらに広げる */
    grid-template-columns: repeat(4, 1fr);
}

.video-card {
    display: block;
    text-decoration: none;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
}

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

.video-thumbnail {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    background-size: cover;
    background-position: center;
}

.play-icon-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 3rem;
    color: rgba(255, 255, 255, 0.8);
    opacity: 0;
    transition: opacity 0.2s;
}

.video-card:hover .play-icon-overlay {
    opacity: 1;
}

.video-card-title {
    padding: 1.5em;
    /* 間隔を広げる */
    font-weight: 500;
    line-height: 1.6;
    height: 4.5em;
    overflow: hidden;
}

.video-player-wrapper {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    background-color: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 2em;
    /* 下部に余白 */
}

.video-player-wrapper .video-player,
.video-player-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.video-watch-title {
    font-size: 1.4rem;
    /* 少し大きく */
    margin: 1.2em 0;
    /* 間隔を広げる */
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.6em;
}

.video-watch-title>span {
    flex-shrink: 1;
    min-width: 0;
}

.subtitle-badge {
    font-size: 0.8rem;
    /* 少し大きく */
    font-weight: 500;
    padding: 5px 10px;
    /* 余白を増やす */
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--secondary-color);
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    flex-shrink: 0;
}

.subtitle-badge i {
    color: var(--info-color);
}

.learning-content {
    margin-top: 2.5em;
    /* 上部に余白を増やす */
}

.learning-card {
    background-color: #fff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    /* 角を少し丸く */
    padding: 2.5em;
    /* 内部余白を増やす */
    margin-bottom: 2.5em;
    /* 下部に余白を増やす */
}

.summary-sentence {
    font-size: 1.2rem;
    /* 少し大きく */
    font-weight: 500;
    margin-top: 0;
    line-height: 1.7;
    /* 行間を広げる */
}

.summary-bullets {
    line-height: 1.7;
}

.summary-fulltext {
    line-height: 1.7;
    color: #555;
}

.questions-list .question-item {
    margin-bottom: 1.8em;
    /* 間隔を広げる */
}

.questions-list .question-item:last-child {
    margin-bottom: 0;
}

.question-title {
    display: flex;
    align-items: center;
    gap: 1em;
    /* 間隔を広げる */
    font-size: 1rem;
    /* 少し大きく */
    margin-bottom: 1em;
}

.question-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 1.5em;
    /* 少し大きく */
    height: 1.5em;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    line-height: 1;
    font-family: Arial, sans-serif;
    font-weight: bold;
    font-size: 0.8em;
}

.question-icon.new-question {
    background-color: #5bc0de;
}

.question-body {
    line-height: 1.7;
    padding-left: 2.5em;
    /* 少し余裕を持たせる */
    color: #333;
}

.ai-answer-trigger {
    text-align: right;
    margin-top: 1em;
}

.ai-answer-container {
    margin-top: 1.2em;
    /* 間隔を広げる */
    padding: 1.2em;
    /* 内部余白を増やす */
    background-color: var(--bg-color);
    border-radius: 8px;
    border-left: 4px solid var(--info-color);
    /* 少し太く */
    line-height: 1.7;
    color: #444;
}

.ai-answer-container .spinner-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    /* 間隔を広げる */
    min-height: 50px;
    color: var(--secondary-color);
}

.ai-answer-container .ai-answer-header {
    display: flex;
    align-items: center;
    gap: 10px;
    /* 間隔を広げる */
    font-weight: bold;
    font-size: 0.95em;
    /* 少し大きく */
    color: var(--primary-color);
    margin-bottom: 1em;
}

.ai-answer-container p:first-child {
    margin-top: 0;
}

.ai-answer-container p:last-child {
    margin-bottom: 0;
}

.ai-answer-container .error-message {
    color: var(--danger-color);
    font-weight: 500;
}

.free-question-title {
    font-size: 1.2rem;
    /* 少し大きく */
    margin-top: 0;
    margin-bottom: 1.2em;
    /* 間隔を広げる */
    display: flex;
    align-items: center;
    gap: 1em;
    /* 間隔を広げる */
    font-weight: 500;
    padding-bottom: 0.7em;
    border-bottom: 2px solid var(--primary-color);
}

.free-question-title i {
    width: 22px;
    /* 少し大きく */
    text-align: center;
    color: var(--primary-color);
}

#chat-log {
    margin-bottom: 1.5em;
    /* 間隔を広げる */
    max-height: 450px;
    /* デスクトップでさらにゆとりを持たせる */
    overflow-y: auto;
    padding: 1.2em;
    /* 内部余白を増やす */
    display: flex;
    flex-direction: column;
    gap: 1.2em;
    /* メッセージ間の間隔を広げる */
}

.chat-message-wrapper {
    display: flex;
    gap: 12px;
    /* 間隔を広げる */
    max-width: 85%;
    align-items: flex-end;
}

.chat-icon {
    width: 36px;
    /* 少し大きく */
    height: 36px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: white;
    font-size: 0.9rem;
    /* 少し大きく */
}

.user-wrapper .chat-icon {
    background-color: var(--success-color);
}

.ai-wrapper .chat-icon {
    background-color: var(--primary-color);
}

.chat-message-content {
    padding: 1em 1.5em;
    /* 内部余白を増やす */
    border-radius: 16px;
    /* 少し大きく */
    line-height: 1.7;
    position: relative;
    word-wrap: break-word;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    /* 影を少し強め */
}

.user-wrapper {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.user-wrapper .chat-message-content {
    background-color: #e2f0d9;
    border-top-right-radius: 6px;
}

.ai-wrapper {
    align-self: flex-start;
}

.ai-wrapper .chat-message-content {
    background-color: var(--bg-color);
    border-top-left-radius: 6px;
}

.thinking-indicator span {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #999;
    margin: 0 3px;
    /* 間隔を広げる */
    animation: bounce 1.4s infinite ease-in-out both;
}

.thinking-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.thinking-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1.0);
    }
}

.copy-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--secondary-color);
    font-size: 0.9em;
    /* 少し大きく */
    opacity: 0.5;
    transition: opacity 0.2s, color 0.2s;
    margin-top: 8px;
    /* 間隔を広げる */
    display: block;
    text-align: right;
}

.ai-wrapper .chat-message-content:hover .copy-btn {
    opacity: 1;
}

.copy-btn:hover {
    color: var(--primary-color);
}

.free-question-form {
    display: flex;
    gap: 15px;
    /* 間隔を広げる */
    width: 100%;
}

.free-question-form textarea {
    flex-grow: 1;
    height: 60px;
    /* さらに高さを増やす */
    min-height: 60px;
    resize: vertical;
    font-size: 1rem;
    /* 少し大きく */
    width: 100%;
}

.free-question-form .btn {
    flex-shrink: 0;
    font-size: 0.9rem;
    /* 少し大きく */
    padding: 0.7em 1.5em;
    /* ボタンのサイズを増やす */
}

.header-with-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5em;
    /* 間隔を広げる */
    padding-bottom: 0.6em;
    border-bottom: 1px solid var(--border-color);
}

.related-videos-section h4.free-question-title {
    padding-bottom: 0.7em;
    border-bottom: 2px solid var(--primary-color);
}

.related-videos-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    /* 間隔を広げる */
}

.related-video-item {
    display: flex;
    align-items: center;
    gap: 25px;
    /* 間隔を広げる */
    text-decoration: none;
    color: var(--text-color);
    padding: 20px;
    /* 内部余白を増やす */
    border-radius: 10px;
    /* 角を少し丸く */
    transition: background-color 0.2s;
}

.related-video-item:hover {
    background-color: #f4f7f6;
}

.related-video-thumbnail-small {
    width: 140px;
    /* 少し大きく */
    height: 78.75px;
    /* 比率を維持 */
    object-fit: cover;
    border-radius: 6px;
    /* 角を少し丸く */
    flex-shrink: 0;
}

.related-video-title-right {
    font-size: 1rem;
    /* 少し大きく */
    font-weight: 500;
    line-height: 1.7;
    white-space: normal;
    flex-grow: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- アコーディオン --- */
.accordion {
    border-top: 1px solid var(--border-color);
    margin-top: 2em;
    /* 間隔を広げる */
    padding-top: 1.5em;
}

.accordion .accordion-header {
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    padding: 12px 0;
    /* 間隔を広げる */
    border-radius: 5px;
    transition: background-color 0.2s;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.accordion .accordion-header:hover {
    background-color: #f8f9fa;
}

.accordion .accordion-title {
    display: flex;
    align-items: center;
    gap: 0.8em;
    /* 間隔を広げる */
    font-size: 1.1rem;
    /* 少し大きく */
    font-weight: 500;
}

.accordion .accordion-title i {
    width: 22px;
    /* 少し大きく */
    text-align: center;
    color: var(--primary-color);
}

.accordion .accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.accordion .accordion-content .accordion-inner-content {
    padding: 1.2em 0 0.6em 0;
    /* 間隔を広げる */
}

.accordion .accordion-header i.fa-chevron-down {
    transition: transform 0.3s ease-out;
}

.accordion.active .accordion-header i.fa-chevron-down {
    transform: rotate(180deg);
}

/* --- モーダル --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background-color: #fff;
    border-radius: 10px;
    /* 角を少し丸く */
    width: 90%;
    max-width: 950px;
    /* 少し広く */
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    /* 影を強め */
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5em 2em;
    /* 間隔を広げる */
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.3rem;
    /* 少し大きく */
}

.modal-close-btn {
    border: none;
    background: none;
    font-size: 2.2rem;
    /* 少し大きく */
    font-weight: 300;
    line-height: 1;
    color: #000;
    opacity: 0.5;
    cursor: pointer;
}

.modal-close-btn:hover {
    opacity: 1;
}

.modal-body {
    padding: 2em;
    /* 間隔を広げる */
    overflow-y: auto;
    flex-grow: 1;
}

.notes-reflection-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 2.5em;
    /* 間隔を広げる */
}

.notes-column {
    flex: 6;
    min-width: 0;
}

.reflection-column {
    flex: 4;
    min-width: 0;
}

#notes-list-container {
    max-height: 350px;
    /* 少し高く */
    overflow-y: auto;
    padding: 10px;
    /* 間隔を広げる */
    margin-bottom: 1.2em;
    background-color: #fdfdfd;
    border-radius: 6px;
    /* 角を少し丸く */
    border: 1px solid var(--border-color);
}

.note-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    /* 間隔を広げる */
    padding: 12px;
    /* 間隔を広げる */
    border-bottom: 1px solid #f0f0f0;
}

.note-item:last-child {
    border-bottom: none;
}

.note-timestamp {
    font-size: 0.85em;
    /* 少し大きく */
    font-weight: bold;
    color: var(--primary-color);
    background-color: #e3f2fd;
    padding: 4px 10px;
    /* 間隔を広げる */
    border-radius: 12px;
    /* 角を少し丸く */
    cursor: pointer;
    white-space: nowrap;
}

.note-content {
    flex-grow: 1;
    line-height: 1.7;
    font-size: 0.95em;
}

.note-actions {
    display: flex;
    gap: 6px;
    /* 間隔を広げる */
}

.note-actions button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--secondary-color);
    font-size: 0.95em;
    /* 少し大きく */
    padding: 5px;
    /* 間隔を広げる */
    border-radius: 4px;
}

.note-actions button:hover {
    background-color: #e9ecef;
    color: var(--dark-color);
}

#new-note-form {
    display: flex;
    gap: 12px;
    /* 間隔を広げる */
    align-items: center;
}

#new-note-form textarea {
    flex-grow: 1;
    min-height: 50px;
    /* 少し高く */
    height: 50px;
}

#new-note-form .btn {
    white-space: nowrap;
    flex-shrink: 0;
}

#reflection-log {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.2em;
    /* 間隔を広げる */
    max-height: 450px;
    /* 少し高く */
    overflow-y: auto;
}

#reflection-input-area {
    display: none;
    margin-top: 1.2em;
}

.card-header-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 1.8em;
    /* 間隔を広げる */
}

/* --- 著作権表示 --- */
.copyright-display {
    font-size: 0.75em;
    /* 少し大きく */
    color: var(--secondary-color);
    text-align: right;
    margin-top: -1em;
    /* 調整 */
    margin-bottom: 1.2em;
    padding-right: 5px;
}

/* --- SDGsアイコン --- */
.sdg-icons-area {
    margin-top: -0.6em;
    margin-bottom: 1.2em;
    display: flex;
    gap: 10px;
    /* 間隔を広げる */
    align-items: center;
}

.sdg-icon-badge {
    height: 36px;
    /* 少し大きく */
    width: auto;
    border-radius: 5px;
    /* 角を少し丸く */
}

/* --- レスポンシブ対応 --- */
@media (max-width: 992px) {
    .video-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .video-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .welcome-message h2 {
        font-size: 1.5rem;
    }

    .watch-container {
        max-width: 100%;
        padding: 0 15px;
    }

    .watch-header,
    .watch-main {
        padding-left: 10px;
        padding-right: 10px;
    }

    .video-player-wrapper {
        border-radius: 8px;
    }

    .learning-card {
        border-radius: 0;
        border-left: none;
        border-right: none;
        padding: 1.2em;
        margin-bottom: 1em;
    }

    .video-watch-title {
        font-size: 1.1rem;
        margin: 0.8em 0;
    }

    .subtitle-badge {
        font-size: 0.7rem;
        padding: 4px 8px;
    }

    .copyright-display {
        font-size: 0.7em;
        margin-top: -0.8em;
        margin-bottom: 1em;
    }

    .summary-sentence {
        font-size: 1.1rem;
    }

    .summary-bullets,
    .summary-fulltext {
        font-size: 0.95rem;
    }

    .question-title {
        font-size: 0.9rem;
    }

    .question-icon {
        width: 1.3em;
        height: 1.3em;
        font-size: 0.7em;
    }

    .question-body {
        font-size: 0.9rem;
        padding-left: 2em;
    }

    .free-question-title {
        font-size: 1rem;
    }

    .free-question-form {
        flex-direction: column;
        gap: 8px;
    }

    .free-question-form textarea {
        font-size: 0.9rem;
        height: 50px;
        min-height: 50px;
        width: 100%;
    }

    .free-question-form .btn {
        font-size: 0.85rem;
        padding: 6px 12px;
        width: 100%;
    }

    #chat-log {
        max-height: 250px;
        gap: 0.8em;
        padding: 0.8em;
    }

    .chat-message-wrapper {
        max-width: 95%;
        gap: 8px;
    }

    .chat-icon {
        width: 30px;
        height: 30px;
        font-size: 0.75rem;
    }

    .chat-message-content {
        padding: 0.6em 1em;
        font-size: 0.9rem;
    }

    .related-video-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .related-video-thumbnail-small {
        width: 100%;
        aspect-ratio: 16 / 9;
        object-fit: cover;
        height: auto;
    }

    .related-video-title-right {
        font-size: 0.9em;
    }

    .notes-reflection-wrapper {
        flex-direction: column;
        gap: 2em;
    }

    #notes-list-container {
        max-height: 250px;
    }
}

@media (max-width: 576px) {
    .header-main-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .platform-title-new {
        font-size: 0.95rem;
    }

    .header-with-actions {
        flex-direction: column;
        gap: 0.6em;
    }

    .header-with-actions .btn {
        width: 100%;
        font-size: 0.85em;
    }
}

/* 動画登録ページ用の追加スタイル */
.page-title i {
    margin-right: 0.6em;
    color: var(--primary-color);
}

.form-group>label>i {
    margin-right: 8px;
    width: 1.2em;
    text-align: center;
    color: var(--secondary-color);
}

.btn i {
    margin-right: 6px;
}

/* 参考サイト検索機能用のスタイル */
#reference-sites-container ul {
    list-style-type: none;
    padding-left: 0;
    margin-top: 0;
}

#reference-sites-container li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

#reference-sites-container li:last-child {
    border-bottom: none;
}

#reference-sites-container li::before {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    content: "\f0c1";
    color: var(--primary-color);
}

#find-sites-spinner {
    vertical-align: middle;
    margin-left: 10px;
    width: 16px;
    height: 16px;
    border-width: 2px;
}

.regenerate-questions-wrapper {
    text-align: center;
    margin-top: 2.5em;
    padding-top: 2em;
    border-top: 1px solid var(--border-color);
}

/* 並び替え機能のスタイル */
.sort-handle {
    cursor: move;
    color: #a9a9a9;
}

.sortable-ghost {
    opacity: 0.4;
    background-color: #e3f2fd;
}

.info-box {
    padding: 1.2em;
    margin-bottom: 1.2em;
    border-radius: 6px;
    background-color: #e7f3fe;
    border: 1px solid #d0e8fc;
    color: #31708f;
    font-size: 0.9em;
}

.info-box i {
    margin-right: 8px;
}

/* 所属管理者リストのレイアウト改善 */
.admin-list-clean {
    margin: 0;
    padding-left: 0;
    list-style-type: none;
}

.admin-list-clean li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
}

.admin-list-clean li:not(:last-child) {
    border-bottom: 1px solid #f0f0f0;
}

.admin-list-clean li>a:first-of-type {
    font-weight: 500;
    color: var(--text-color);
    text-decoration: none;
    flex-grow: 1;
}

.admin-list-clean li>a:first-of-type:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.action-icon-delete {
    color: var(--secondary-color);
    font-size: 0.9em;
    padding: 4px;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s;
}

.action-icon-delete:hover {
    color: var(--danger-color);
    background-color: #fbebee;
}

/* グループ管理ページの操作ボタンを一行に収めるための最終調整 */
.content-table .action-buttons {
    flex-wrap: nowrap;
}

.content-table .action-buttons .btn {
    padding: 6px 10px;
    font-size: 0.85em;
    flex-shrink: 0;
}

/* 学習記録の表示スタイル */
.progress-bar-table {
    width: 100%;
    min-width: 100px;
    background-color: #e9ecef;
    border-radius: .25rem;
    height: 20px;
    position: relative;
    overflow: hidden;
}

.progress-bar-table-inner {
    height: 100%;
    background-color: var(--primary-color);
    border-radius: .25rem;
    color: white;
    font-size: 0.75em;
    font-weight: 500;
    line-height: 20px;
    text-align: center;
    white-space: nowrap;
    transition: width 0.6s ease;
    position: absolute;
    left: 0;
    top: 0;
}

.progress-bar-table-text-external {
    font-size: 0.75em;
    padding-left: 5px;
    color: var(--secondary-color);
}

.status-note {
    color: var(--secondary-color);
    font-size: 0.85em;
}

/* 絞り込みフォーム用のスタイル */
.filter-section {
    padding: 1.5em 2em;
}

.filter-form .filter-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
}

.filter-form .filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-form label {
    font-size: 0.85em;
    font-weight: 500;
    margin-bottom: 0;
}

.filter-form select {
    min-width: 180px;
    padding: 0.5em;
}

.filter-form .filter-actions {
    padding-bottom: 2px;
}

/* ページネーション用のスタイル */
.pagination-wrapper {
    margin-top: 1.8em;
    display: flex;
    justify-content: center;
}

.pagination {
    display: flex;
    padding-left: 0;
    list-style: none;
    border-radius: .25rem;
}

.page-item .page-link {
    position: relative;
    display: block;
    padding: .5rem .75rem;
    margin-left: -1px;
    line-height: 1.25;
    color: var(--primary-color);
    background-color: #fff;
    border: 1px solid #dee2e6;
    text-decoration: none;
}

.page-item:first-child .page-link {
    margin-left: 0;
    border-top-left-radius: .25rem;
    border-bottom-left-radius: .25rem;
}

.page-item:last-child .page-link {
    border-top-right-radius: .25rem;
    border-bottom-right-radius: .25rem;
}

.page-item.active .page-link {
    z-index: 1;
    color: #fff;
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.page-item:not(.active) .page-link:hover {
    background-color: #e9ecef;
}

/* 統計モーダル用のスタイル */
#stats-modal-subtitle {
    font-size: 0.95em;
    color: var(--secondary-color);
    margin-top: 0;
    margin-bottom: 1.8em;
    border-left: 4px solid var(--info-color);
    padding-left: 1.2em;
}

.modal-body .spinner-wrapper {
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* メッセージ機能の追加スタイル */
.message-box-persistent {
    background-color: #fff;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    line-height: 1.6;
}

.attachment-list {
    list-style: none;
    padding: 0;
    margin: 6px 0 0 0;
}

.attachment-list li {
    padding: 4px 0;
}

.attachment-list i {
    margin-right: 6px;
    color: var(--secondary-color);
}

/* キーワード解説リストのスタイル */
.glossary-list {
    padding-top: 1em;
    margin: 0;
}

.glossary-list dt {
    font-weight: 700;
    color: var(--primary-color);
    margin-top: 1.2em;
}

.glossary-list dt:first-child {
    margin-top: 0;
}

.glossary-list dd {
    margin-left: 0;
    margin-top: 0.5em;
    padding-bottom: 1.2em;
    border-bottom: 1px solid #f0f0f0;
    line-height: 1.7;
}

.glossary-list dd:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

/* 議論テーマリストのスタイル */
.discussion-list {
    list-style-type: none;
    padding-left: 0;
    margin: 0;
}

.discussion-list li {
    background-color: var(--bg-color);
    padding: 1em 1.5em;
    border-radius: 10px;
    margin-bottom: 1em;
    line-height: 1.7;
    border-left: 4px solid var(--info-color);
}

.discussion-list li::before {
    content: 'Q.';
    font-weight: 700;
    color: var(--info-color);
    margin-right: 0.8em;
    font-family: 'Times New Roman', Times, serif;
}

/* グループ管理者が登録した動画のスタイル */
.row-group-admin-video {
    background-color: #fffbe6;
}

.content-table>tbody>tr:hover>td {
    background-color: #f8f9fa;
}

.row-group-admin-video:hover>td {
    background-color: #fff9d4;
}

/* 表示・非表示トグルスイッチ */
.visibility-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.visibility-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 26px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--success-color);
}

input:checked+.slider:before {
    transform: translateX(24px);
}

.video-row-hidden {
    opacity: 0.6;
    background-color: #f8f9fa;
}

.video-row-hidden:hover {
    opacity: 1;
}

/* SDGs編集フォーム用 */
.sdg-input-group {
    display: flex;
    gap: 1.2em;
    padding-bottom: 1.2em;
    margin-bottom: 1.2em;
    border-bottom: 1px solid #f0f0f0;
}

.sdg-input-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.sdg-input-group .form-group {
    flex: 1;
    margin-bottom: 0;
}

.sdg-input-group .form-group:first-child {
    flex-grow: 0;
    flex-basis: 130px;
}

/* YouTube手動完了ボタン用のスタイル */
.youtube-complete-section {
    margin-top: 1.5em;
    padding: 1.5em;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: #f8f9fa;
    text-align: center;
}

.youtube-complete-section p {
    margin: 0 0 1em 0;
    color: var(--text-light);
    font-size: 0.9em;
    line-height: 1.6;
}

.youtube-complete-section .btn {
    font-size: 1em;
    padding: 0.7em 1.5em;
}

.youtube-complete-section .btn:disabled {
    cursor: not-allowed;
    opacity: 0.8;
}

/* AIVICEチューターの回答ヘッダー */
.ai-answer-header {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: bold;
    font-size: 0.95em;
    color: var(--primary-color);
    margin-bottom: 1em;
}

/* AIVICEチューターのアバター画像 */
.ai-tutor-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* --- AIチャットのアバター表示用CSS --- */
.chat-icon .chat-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* --- AIVICEのルビ（ふりがな）表示用スタイル --- */
.platform-title ruby {
    line-height: 1.2;
    -webkit-ruby-position: over;
    /* Safari用の設定 */
    ruby-position: over;
}

.platform-title rt {
    font-size: 10px;
    /* 読みがなのフォントサイズ */
    font-weight: 500;
    /* 標準の太さ */
    color: var(--secondary-color);
    /* 基本の文字色 */
    letter-spacing: 0.05em;
    user-select: none;
    /* 選択不可に */
}

/* ログインページのタイトルに特化した色の調整 */
.login-container .platform-title rt {
    color: #0071c5;
    /* グラデーションのメインカラーに合わせる */
    opacity: 0.8;
}