/* ============================================
   CP Community Platform - Stylesheet
   白背景・シンプル・信頼感・スマホファースト
   ============================================ */

/* --- リセット & ベース --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #1F4E79;
    --primary-light: #2F6FA8;
    --primary-pale: #E8F0F8;
    --accent: #E67E22;
    --text: #333333;
    --text-light: #666666;
    --text-muted: #999999;
    --bg: #FFFFFF;
    --bg-light: #F8F9FA;
    --border: #E0E0E0;
    --border-light: #F0F0F0;
    --success: #27AE60;
    --danger: #C0392B;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --radius-sm: 4px;
    --font: 'メイリオ', 'Hiragino Sans', 'Noto Sans JP', sans-serif;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg-light);
    line-height: 1.7;
    min-height: 100vh;
    padding-bottom: 70px; /* モバイルナビ分 */
}

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

img {
    max-width: 100%;
    height: auto;
}

/* --- ヘッダー --- */
.site-header {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 800px;
    margin: 0 auto;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.site-logo {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.site-logo-icon-img {
    width: 28px;
    height: 28px;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-user-name {
    font-size: 0.85rem;
    color: var(--text-light);
}

.header-logout {
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.header-logout:hover {
    background: var(--bg-light);
    color: var(--text);
}

/* ヘッダー上段の単発アイコン（ヘルプ・設定など） */
.header-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    line-height: 1;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    color: var(--text-light);
    text-decoration: none;
    transition: background-color 0.15s;
}
.header-icon:hover {
    background: var(--bg-light);
}

/* --- デスクトップナビ --- */
.desktop-nav {
    display: none;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.desktop-nav-inner {
    display: flex;
    gap: 0;
}

.desktop-nav a {
    padding: 0.6rem 1.25rem;
    font-size: 0.9rem;
    color: var(--text-light);
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
}

.desktop-nav a:hover,
.desktop-nav a.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* --- モバイルナビ（下部タブ） --- */
.mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg);
    border-top: 1px solid var(--border);
    display: flex;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}

.mobile-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 0;
    font-size: 0.65rem;
    color: var(--text-muted);
    transition: color 0.2s;
    gap: 0.2rem;
}

.mobile-nav a:hover,
.mobile-nav a.active {
    color: var(--primary);
}

.mobile-nav .nav-icon {
    font-size: 1.3rem;
    line-height: 1;
}

/* --- コンテナ --- */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
}

/* --- カード --- */
.card {
    background: var(--bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

/* --- アバター --- */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-pale);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1rem;
    flex-shrink: 0;
}

.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: 0.85rem;
}

.avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* --- 投稿 --- */
.post-meta {
    display: flex;
    flex-direction: column;
}

.post-author {
    font-weight: bold;
    font-size: 0.9rem;
    color: var(--text);
}

.post-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.post-content {
    line-height: 1.8;
    white-space: pre-wrap;
    word-break: break-word;
}

.post-image {
    margin-top: 0.75rem;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.post-image img {
    display: block;
    width: 100%;
    max-height: 400px;
    object-fit: cover;
}

.post-actions {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-light);
}

.post-action-btn {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: var(--text-light);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.3rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: color 0.15s, background-color 0.15s;
}

.post-action-btn:hover {
    color: var(--primary);
    background: var(--bg-light);
}

.post-action-btn.liked {
    color: var(--danger);
}

.post-action-btn .action-icon {
    font-size: 1.05rem;
    line-height: 1;
}

.post-action-edit:hover {
    color: var(--primary);
    background: var(--primary-pale);
}

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

/* --- 画像アップロード --- */
.image-upload-label {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-light);
    color: var(--text-light);
    font-size: 0.8rem;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.image-upload-label:hover {
    background: var(--primary-pale);
    border-color: var(--primary-light);
    color: var(--primary);
}
.image-upload-icon {
    font-size: 1.1rem;
    line-height: 1;
}

/* --- 絵文字パレット --- */
.emoji-btn-wrapper {
    position: relative;
    display: inline-block;
}
.emoji-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.3rem 0.5rem;
    line-height: 1;
    color: var(--text-light);
    transition: background-color 0.15s;
}
.emoji-btn:hover {
    background: var(--bg-light);
}
.emoji-palette {
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 0.35rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    z-index: 200;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 0.25rem;
    width: max-content;
    max-width: calc(100vw - 1rem);
}
@media (max-width: 600px) {
    .emoji-palette {
        grid-template-columns: repeat(6, 1fr);
    }
}
.emoji-item {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.3rem;
    padding: 0.3rem;
    border-radius: var(--radius-sm);
    line-height: 1;
}
.emoji-item:hover {
    background: var(--bg-light);
}

/* --- メッセージ操作ボタン（編集・削除） --- */
.dm-delete-btn,
.dm-edit-btn {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1.05rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.25rem 0.4rem;
    border-radius: var(--radius-sm);
    opacity: 0.85;
    transition: opacity 0.15s, background-color 0.15s, color 0.15s;
}
.dm-delete-btn:hover {
    opacity: 1;
    color: #fff;
    background: var(--danger);
}
.dm-edit-btn:hover {
    opacity: 1;
    color: #fff;
    background: var(--primary);
}

/* --- リアクション --- */
.reaction-wrapper {
    position: relative;
}

.reaction-picker {
    position: absolute;
    bottom: 100%;
    left: 0;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 0.3rem 0.4rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    gap: 0.15rem;
    z-index: 50;
    white-space: nowrap;
}

.reaction-option {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0.2rem 0.35rem;
    border-radius: 50%;
    transition: transform 0.15s, background 0.15s;
    line-height: 1;
}

.reaction-option:hover {
    transform: scale(1.3);
    background: var(--bg-light);
}

.reaction-summary {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
    min-height: 0;
}

.reaction-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    background: var(--bg-light);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 0.15rem 0.5rem;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.15s;
}

.reaction-badge:hover {
    background: var(--primary-pale);
}

.reaction-badge.mine {
    background: var(--primary-pale);
    border-color: var(--primary);
}

.pinned-badge {
    display: inline-block;
    background: var(--accent);
    color: white;
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    border-radius: var(--radius-sm);
    margin-left: 0.5rem;
}

/* --- コメント --- */
.comments-section {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-light);
}

.comment {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem 0;
}

.comment-body {
    flex: 1;
    background: var(--bg-light);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
}

.comment-author {
    font-weight: bold;
    font-size: 0.8rem;
}

.comment-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-left: 0.5rem;
}

.comment-form {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.comment-form input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.85rem;
    font-family: var(--font);
    outline: none;
}

.comment-form input:focus {
    border-color: var(--primary);
}

.comment-form button {
    padding: 0.5rem 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
}

/* --- 投稿フォーム --- */
.post-form {
    margin-bottom: 1rem;
}

.post-form textarea {
    width: 100%;
    min-height: 80px;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 0.95rem;
    resize: vertical;
    outline: none;
    line-height: 1.7;
}

.post-form textarea:focus {
    border-color: var(--primary);
}

.post-form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
}

.post-form-actions label {
    font-size: 0.85rem;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* --- イベント --- */
.event-card {
    border-left: 4px solid var(--primary);
}

.event-date {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--primary);
    font-weight: bold;
    margin-bottom: 0.25rem;
}

.event-title {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.event-info {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 0.25rem;
}

.event-participants {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-light);
}

.event-participants .avatars-stack {
    display: flex;
}

.event-participants .avatars-stack .avatar-sm {
    margin-left: -8px;
    border: 2px solid white;
}

.event-participants .avatars-stack .avatar-sm:first-child {
    margin-left: 0;
}

.event-join-btn {
    margin-top: 0.75rem;
}

/* --- カレンダー --- */
.calendar {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.calendar th {
    background: var(--primary-pale);
    color: var(--primary);
    padding: 0.5rem;
    font-size: 0.8rem;
    text-align: center;
}

.calendar td {
    border: 1px solid var(--border-light);
    padding: 0.25rem;
    vertical-align: top;
    height: 80px;
    width: 14.28%;
    font-size: 0.8rem;
}

.calendar .day-number {
    font-weight: bold;
    color: var(--text-light);
    margin-bottom: 0.2rem;
}

.calendar .today .day-number {
    color: white;
    background: var(--primary);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar .has-event {
    background: var(--primary-pale);
}

.calendar .event-dot {
    display: block;
    font-size: 0.7rem;
    color: var(--primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0.1rem 0.2rem;
    background: white;
    border-radius: 2px;
    margin-top: 0.1rem;
}

.calendar .other-month {
    color: var(--text-muted);
    background: var(--bg);
}

.calendar .sunday { color: var(--danger); }
.calendar .saturday { color: var(--primary); }

/* --- お知らせ --- */
.announcement-card {
    border-left: 4px solid var(--accent);
}

.announcement-card.pinned {
    border-left-color: var(--danger);
    background: #FFF9F0;
}

.announcement-title {
    font-size: 1rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

/* --- ボタン --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.5rem 1.25rem;
    border: none;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

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

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}
.btn-outline:hover {
    background: var(--primary-pale);
}

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

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

.btn-sm {
    padding: 0.3rem 0.75rem;
    font-size: 0.8rem;
}

.btn-block {
    display: flex;
    width: 100%;
}

/* --- フォーム --- */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: bold;
    margin-bottom: 0.3rem;
    color: var(--text);
}

.form-control {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(31, 78, 121, 0.1);
}

.form-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* --- フラッシュメッセージ --- */
.flash {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.flash-success {
    background: #E8F5E9;
    color: #2E7D32;
    border: 1px solid #C8E6C9;
}

.flash-error {
    background: #FFEBEE;
    color: #C62828;
    border: 1px solid #FFCDD2;
}

.flash-info {
    background: var(--primary-pale);
    color: var(--primary);
    border: 1px solid #BBDEFB;
}

/* --- 認証ページ --- */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: var(--bg-light);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
}

.auth-title {
    text-align: center;
    color: var(--primary);
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.auth-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
}

.auth-footer {
    text-align: center;
    margin-top: 1.25rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* --- ページタイトル --- */
.page-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-pale);
}

/* --- セクション切り替え（タブ） --- */
.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.tab {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-family: var(--font);
    transition: all 0.2s;
}

.tab:hover,
.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* --- 空の状態 --- */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* --- ユーティリティ --- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 0.5rem; }

/* --- 未読バッジ --- */
/* hidden 属性を強制的に効かせる（クラスの display を上書き） */
[hidden] {
    display: none !important;
}

.unread-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--danger);
    color: white;
    font-size: 0.65rem;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    padding: 0 4px;
    margin-left: 4px;
    font-weight: bold;
}

.unread-badge-mobile {
    position: absolute;
    top: 2px;
    right: 50%;
    transform: translateX(12px);
    background: var(--danger);
    color: white;
    font-size: 0.6rem;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    font-weight: bold;
}

/* --- レスポンシブ --- */
@media (min-width: 768px) {
    body {
        padding-bottom: 0;
    }

    .mobile-nav {
        display: none;
    }

    .desktop-nav {
        display: block;
    }

    .calendar td {
        height: 100px;
    }
}

/* =========================================
   通知ベル＋ドロップダウン
   ========================================= */
.bell-wrapper {
    position: relative;
    display: inline-block;
}

.bell-btn {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.3rem 0.4rem;
    font-size: 1.2rem;
    line-height: 1;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
}

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

.bell-icon {
    display: inline-block;
    font-size: 1.2rem;
}

.bell-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    background: var(--danger);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.bell-badge[hidden] {
    display: none;
}

.bell-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: 320px;
    max-width: calc(100vw - 2rem);
    background: var(--bg);
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 100;
    overflow: hidden;
}

.bell-dropdown[hidden] {
    display: none;
}

.bell-dropdown-header {
    padding: 0.75rem 1rem;
    font-weight: 700;
    color: var(--primary);
    border-bottom: 1px solid var(--bg-light);
    font-size: 0.9rem;
}

.bell-dropdown-body {
    max-height: 400px;
    overflow-y: auto;
}

.bell-dropdown-footer {
    padding: 0.6rem 1rem;
    text-align: center;
    border-top: 1px solid var(--bg-light);
    font-size: 0.85rem;
}

.bell-dropdown-footer a {
    color: var(--primary);
    text-decoration: none;
}

.bell-dropdown-footer a:hover {
    text-decoration: underline;
}

.bell-loading,
.bell-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* =========================================
   通知アイテム（ドロップダウン内・一覧ページ共通）
   ========================================= */
.notif-list {
    overflow: hidden;
}

.notif-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid var(--bg-light);
    transition: background 0.15s;
}

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

.notif-item:hover {
    background: var(--bg-light);
}

.notif-item.unread {
    background: var(--primary-pale);
}

.notif-item.unread:hover {
    background: #dce7f3;
}

.notif-avatar {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--bg-light);
}

.notif-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.notif-avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    background: var(--primary-pale);
    color: var(--primary);
}

.notif-body {
    flex: 1;
    min-width: 0;
}

.notif-text {
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--text, #333);
    word-break: break-word;
}

.notif-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

@media (max-width: 600px) {
    .bell-dropdown {
        position: fixed;
        top: 56px;
        left: 0.5rem;
        right: 0.5rem;
        width: auto;
    }
}

/* ==========================================
   クラスグループ機能
   ========================================== */

/* --- クラス一覧 --- */
.class-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.class-list-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.15s, border-color 0.15s;
}
.class-list-item:hover {
    background: var(--bg-light);
    border-color: var(--primary-light);
}
.class-list-item-main {
    flex: 1;
    min-width: 0;
}
.class-list-item-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.2rem;
}
.class-list-item .class-name {
    font-size: 0.95rem;
    color: var(--text);
}
.class-list-item-preview {
    font-size: 0.8rem;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}
.class-list-item-sender {
    color: var(--text-muted);
    margin-right: 0.3rem;
}
.class-list-item-desc {
    color: var(--text-muted);
    font-style: italic;
}
.class-list-item-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.3rem;
    flex-shrink: 0;
}
.class-list-item-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* --- ロールバッジ --- */
.role-badge {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    font-size: 0.65rem;
    font-weight: bold;
    border-radius: var(--radius-sm);
    line-height: 1.3;
}
.role-manager {
    background: var(--primary-pale);
    color: var(--primary);
}

/* --- クラス詳細ヘッダー --- */
.class-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
}
.class-header-main {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    flex: 1;
}
.class-header-title {
    font-size: 1.1rem;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.class-back {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 1.1rem;
    padding: 0.2rem 0.3rem;
}
.class-back:hover {
    color: var(--primary);
}
.class-description {
    font-size: 0.85rem;
    color: var(--text-light);
    padding: 0 0.5rem;
    margin: 0 0 0.75rem;
}

/* --- タブ --- */
.class-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
    background: var(--bg);
    border-radius: var(--radius) var(--radius) 0 0;
    overflow-x: auto;
}
.class-tabs .tab {
    flex: 1;
    padding: 0.75rem 0.5rem;
    font-size: 0.85rem;
    color: var(--text-light);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s, background-color 0.15s;
}
.class-tabs .tab:hover {
    background: var(--bg-light);
    color: var(--primary);
}
.class-tabs .tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: bold;
}

.tab-panel {
    display: none;
}
.tab-panel.active {
    display: block;
}

/* --- 掲示板 --- */
.board-block {
    margin-bottom: 0.75rem;
    padding: 0.85rem 1rem;
}
.board-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border-light);
}
.board-block-content {
    font-size: 0.9rem;
    line-height: 1.6;
    word-break: break-word;
    white-space: pre-wrap;
}
.board-block-content a {
    word-break: break-all;
}
.board-block-empty {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
    padding: 0.3rem 0;
}
.board-block-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    padding-top: 0.4rem;
    border-top: 1px dashed var(--border-light);
}
.board-textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    box-sizing: border-box;
}
.board-edit-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 0.5rem;
}

/* --- クラスメッセージ --- */
.class-messages {
    max-height: 500px;
    overflow-y: auto;
    padding: 0.5rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
}
.class-msg {
    display: flex;
    gap: 0.6rem;
    margin-bottom: 0.85rem;
}
.class-msg-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-pale);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: bold;
    flex-shrink: 0;
    overflow: hidden;
}
.class-msg-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.class-msg-body {
    flex: 1;
    min-width: 0;
}
.class-msg-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}
.class-msg-sender {
    font-weight: bold;
    color: var(--text);
    font-size: 0.85rem;
}
.class-msg-content {
    background: var(--bg-light);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    line-height: 1.5;
    word-break: break-word;
}
.class-msg.mine .class-msg-content {
    background: var(--primary-pale);
}
.class-msg-delete-form {
    margin: 0;
    margin-left: auto;
}
.class-msg-delete-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.1rem 0.3rem;
    border-radius: var(--radius-sm);
    opacity: 0.7;
    transition: opacity 0.15s, background-color 0.15s;
}
.class-msg-delete-btn:hover {
    opacity: 1;
    background: var(--danger);
    color: #fff;
}

.class-msg-form {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}
.class-msg-form textarea {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    min-height: 50px;
    box-sizing: border-box;
}

/* --- メンバー一覧（クラス内） --- */
.class-members-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.class-member-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.85rem;
    text-decoration: none;
    color: inherit;
}
.class-member-item:hover {
    background: var(--bg-light);
}
.class-member-body {
    flex: 1;
    min-width: 0;
}
.class-member-name {
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}
.class-member-period {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: normal;
}
.class-member-one-liner {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- 管理画面テーブル --- */
.manage-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.manage-table th,
.manage-table td {
    padding: 0.5rem 0.4rem;
    border-bottom: 1px solid var(--border-light);
    text-align: left;
    vertical-align: middle;
}
.manage-table th {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: normal;
    border-bottom: 1px solid var(--border);
}
.manage-table tbody tr:hover {
    background: var(--bg-light);
}

