:root {
    --bg-primary: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-elevated: #f1f5f9;
    --border-color: #e2e8f0;
    --border-highlight: rgba(79, 70, 229, 0.35);
    --text-main: #0f172a;
    --text-muted: #64748b;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #6366f1 50%, #8b5cf6 100%);
    --accent: #0284c7;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --success: #10b981;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --shadow-subtle: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 12px 28px -4px rgba(79, 70, 229, 0.15);
    --transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-main);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ヘッダー・ナビゲーション */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.03);
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

.nav-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

.brand-icon {
    width: 32px;
    height: 32px;
    background: var(--primary-gradient);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* ボタン */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 2px 10px rgba(79, 70, 229, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn-secondary {
    background: var(--bg-surface-elevated);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: #e2e8f0;
}

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

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

.btn-outline {
    background: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #f8fafc;
}

/* ヒーローセクション */
.hero {
    padding: 3rem 0 1.5rem;
    text-align: center;
}

.hero-title {
    font-size: 2.8rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #1e293b 0%, #334155 50%, #475569 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.15rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto 2rem;
}

/* 検索・フィルターバー */
.search-wrapper {
    max-width: 680px;
    margin: 0 auto 2.5rem;
}

.search-form {
    display: flex;
    gap: 0.5rem;
    background: var(--bg-surface);
    padding: 0.4rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.06);
    transition: var(--transition);
}

.search-form:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    padding: 0.6rem 1rem;
    color: var(--text-main);
    font-size: 1rem;
}

.search-input::placeholder {
    color: var(--text-muted);
}

/* タグチップ */
.tag-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
    justify-content: center;
}

.tag-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.75rem;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    color: #4338ca;
    border-radius: 9999px;
    font-size: 0.82rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
}

.tag-badge:hover, .tag-badge.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-1px);
}

/* 成果物カードグリッド */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    margin-bottom: 3.5rem;
}

.post-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    text-decoration: none;
    color: inherit;
    box-shadow: 0 2px 8px -2px rgba(0, 0, 0, 0.05);
}

.post-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-highlight);
    box-shadow: var(--shadow-hover);
}

.card-image-wrap {
    height: 190px;
    background: #f1f5f9;
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid var(--border-color);
}

.card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.post-card:hover .card-image {
    transform: scale(1.04);
}

.card-no-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.card-body {
    padding: 1.35rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1.35;
    color: var(--text-main);
}

.card-desc {
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.5;
    margin-bottom: 1rem;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.card-author {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.author-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border-color);
}

/* フォーム・エディタ */
.form-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2.2rem;
    margin: 2rem auto 3.5rem;
    max-width: 840px;
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.06);
}

.form-group {
    margin-bottom: 1.6rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    color: var(--text-main);
    font-size: 0.96rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.form-help {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

/* Quillカスタマイズ (白基調・ライトテーマ) */
.ql-toolbar.ql-snow {
    background: #f8fafc;
    border-color: var(--border-color) !important;
    border-top-left-radius: var(--radius-sm);
    border-top-right-radius: var(--radius-sm);
}

.ql-snow .ql-stroke {
    stroke: #475569 !important;
}

.ql-snow .ql-fill {
    fill: #475569 !important;
}

.ql-snow .ql-picker {
    color: #475569 !important;
}

.ql-container.ql-snow {
    background: #ffffff;
    border-color: var(--border-color) !important;
    border-bottom-left-radius: var(--radius-sm);
    border-bottom-right-radius: var(--radius-sm);
    font-size: 1rem;
    min-height: 250px;
    color: var(--text-main);
}

/* 本文リッチテキスト表示用 */
.content-body {
    line-height: 1.8;
    font-size: 1.05rem;
    color: #1e293b;
}

.content-body h1, .content-body h2, .content-body h3 {
    color: #0f172a;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-weight: 700;
}

.content-body p {
    margin-bottom: 1rem;
}

.content-body blockquote {
    border-left: 4px solid var(--primary);
    padding-left: 1rem;
    color: var(--text-muted);
    background: #f8fafc;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    margin: 1rem 0;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.content-body pre {
    background: #1e293b;
    color: #f8fafc;
    padding: 1rem;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 1rem 0;
}

/* フラッシュメッセージ */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.95rem;
}

.alert-success {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.alert-danger {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

/* テーブルスタイル（管理画面） */
.table-wrap {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-subtle);
}

.table-custom {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.table-custom th {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: #f8fafc;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table-custom td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.table-custom tr:last-child td {
    border-bottom: none;
}

.table-custom tr:hover {
    background: #f8fafc;
}

/* フッター */
.footer {
    margin-top: auto;
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    background: #ffffff;
}



/* 投稿管理: タグが多い場合も状態と操作列の幅を確保する */
.my-posts-page {
    max-width: 1200px;
    margin: 1rem auto 4rem;
}

.my-posts-heading {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.my-posts-heading > .btn {
    flex-shrink: 0;
    white-space: nowrap;
}

.my-posts-table-wrap {
    overflow-x: auto;
}

.my-posts-table {
    min-width: 1080px;
    table-layout: fixed;
}

.my-posts-title-column { width: 32%; }
.my-posts-status-column { width: 100px; }
.my-posts-date-column { width: 128px; }
.my-posts-actions-column { width: 168px; }

.my-posts-table th,
.my-posts-table td {
    vertical-align: middle;
}

.my-posts-table th,
.my-posts-table td:nth-child(5) {
    white-space: nowrap;
}

.my-posts-summary {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.my-posts-summary > :first-child {
    flex-shrink: 0;
}

.my-posts-summary > :last-child {
    min-width: 0;
    overflow-wrap: anywhere;
}

.my-posts-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.my-posts-tags .tag-badge {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
}

.my-posts-status {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
}

.my-posts-status-published {
    background: #d1fae5;
    color: #047857;
}

.my-posts-status-private {
    background: #e2e8f0;
    color: #475569;
}

.my-posts-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.my-posts-actions form {
    display: flex;
    margin: 0;
}

.my-posts-actions .btn {
    min-width: 56px;
    height: 36px;
    padding: 0.35rem 0.75rem;
    font-family: inherit;
    font-size: 0.82rem;
    line-height: 1;
    white-space: nowrap;
    flex-shrink: 0;
}


.my-posts-sort-column { width: 116px; }
.my-posts-sort-cell { padding: 1rem 0.75rem; }
.my-posts-sort-input { width: 92px; padding: 0.5rem; }
.my-posts-sort-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.my-posts-sort-toolbar .btn { white-space: nowrap; }
.my-posts-sort-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}
