/* ========================================
   基本設定
======================================== */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

/* ========================================
   ヘッダー
======================================== */

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem 0;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: relative;
}

.top-btn {
    position: absolute;
    top: 1rem;
    left: 1.5rem;
    color: rgba(255, 255, 255, 0.95);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.25);
    font-weight: 500;
}

.top-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    color: white;
    transform: translateX(-2px);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* モバイル対応 */
@media (max-width: 768px) {
    .top-btn {
        position: static;
        display: inline-block;
        margin-bottom: 1rem;
        font-size: 0.85rem;
        padding: 0.4rem 0.8rem;
    }

    header h1 {
        font-size: 1.8rem;
    }
}

/* ========================================
   レイアウト
======================================== */

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
}

@media (max-width: 768px) {
    main {
        grid-template-columns: 1fr;
        padding: 1rem;
    }
}

/* ========================================
   会議一覧ページ
======================================== */

.latest-meetings h2 {
    color: #333;
    border-bottom: 3px solid #667eea;
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
}

.meeting-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.meeting-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.meeting-title {
    margin-bottom: 0.5rem;
}

.meeting-title a {
    color: #333;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
}

.meeting-title a:hover {
    color: #667eea;
}

.meeting-date {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.meeting-agenda {
    color: #555;
    font-size: 0.9rem;
    margin-bottom: 0.8rem;
    padding: 0.5rem;
    background: #f8f9fa;
    border-left: 3px solid #667eea;
    border-radius: 4px;
}

.meeting-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: #777;
}

/* ========================================
   会議詳細ページ
======================================== */

.meeting-detail {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.back-link {
    display: inline-block;
    color: #667eea;
    text-decoration: none;
    margin-bottom: 1rem;
    font-weight: 500;
}

.back-link:hover {
    text-decoration: underline;
}

.meeting-meta {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
}

.meeting-meta p {
    margin-bottom: 0.5rem;
}

.meeting-link {
    color: #667eea;
    text-decoration: none;
}

.meeting-link:hover {
    text-decoration: underline;
}

/* ========================================
   発言・議事録表示
======================================== */

.speech-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    transition: background 0.3s ease;
}

.speech-highlighted {
    background: #fff3cd !important;
    box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.3);
}

.agenda-item {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
}

.agenda-title {
    font-weight: 600;
    color: #1976d2;
    margin-bottom: 0.5rem;
}

.speaker-line {
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.speech-number {
    color: #666;
    min-width: 2rem;
}

.party-name {
    background: #e3f2fd;
    color: #1976d2;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

.party-independent {
    background: #f3e5f5;
    color: #7b1fa2;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.8rem;
}

.speaker-name {
    color: #333;
}

.speech-content {
    margin: 0.5rem 0;
}

.original-text {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 1rem;
    margin-top: 0.5rem;
    white-space: pre-wrap;
}

.speech-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.toggle-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.toggle-btn:hover {
    background: #5a67d8;
}

.comment-quote-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s ease;
}

.comment-quote-btn:hover {
    background: #218838;
}

.bulk-controls {
    text-align: center;
    margin: 1rem 0;
}

.bulk-toggle-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.7rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
}

.bulk-toggle-btn:hover {
    background: #5a67d8;
}

/* ========================================
   コメント機能
======================================== */

.comments-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid #eee;
}

.comments-section h2 {
    color: #333;
    margin-bottom: 1rem;
}

.comment-form {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.comment-form h3 {
    margin-bottom: 1rem;
    color: #333;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group textarea {
    width: 100%;
    padding: 0.7rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    resize: vertical;
}

.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.form-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

button[type="submit"] {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.7rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

button[type="submit"]:hover {
    background: #5a67d8;
}

.clear-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 0.7rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.3s ease;
}

.clear-btn:hover {
    background: #5a6268;
}

/* コメント表示 */
.comment-thread {
    margin-bottom: 2rem;
}

.thread-header {
    background: #e3f2fd;
    padding: 0.5rem 1rem;
    border-radius: 6px 6px 0 0;
    font-weight: 500;
    color: #1976d2;
}

.comment {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.5rem;
}

.comment-reply {
    margin-left: 2rem;
    border-left: 3px solid #667eea;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.comment-id {
    font-weight: 600;
    color: #667eea;
}

.comment-author {
    font-weight: 500;
}

.comment-date {
    color: #666;
    margin-left: auto;
}

.report-count {
    background: #fff3cd;
    color: #856404;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid #ffeaa7;
}

.comment-content {
    margin: 0.5rem 0;
    line-height: 1.5;
}

.speech-quote-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    padding: 0.1rem 0.3rem;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 3px;
    transition: all 0.2s ease;
}

.speech-quote-link:hover {
    background: rgba(102, 126, 234, 0.2);
    text-decoration: underline;
    cursor: pointer;
}

/* 発言プレビュー */
.speech-preview {
    position: fixed;
    background: #fffbf0;
    border: 2px solid #d4a574;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    padding: 1rem;
    max-width: 400px;
    z-index: 10000;
    animation: slideIn 0.2s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(-10px);
    }
    to {
        transform: translateY(0);
    }
}

.speech-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e0e0e0;
}

.speech-preview-number {
    font-weight: bold;
    color: #667eea;
    font-size: 0.9rem;
}

.speech-preview-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.speech-preview-close:hover {
    color: #333;
}

.speech-preview-speaker {
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: #333;
    font-size: 0.9rem;
}

.speech-preview-content {
    color: #555;
    line-height: 1.5;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-line;
}

.speech-preview-actions {
    display: flex;
    gap: 0.5rem;
}

.speech-preview-goto {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.speech-preview-goto:hover {
    background: #5568d3;
}

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

.reply-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
}

.reply-btn:hover {
    background: #218838;
}

.report-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.2rem;
}

.report-btn:hover {
    background: #c82333;
}

.report-btn:active {
    transform: translateY(1px);
}

/* 返信フォーム */
.reply-form-content {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 6px;
    margin-top: 0.5rem;
}

.reply-target-info {
    background: white;
    padding: 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.form-actions {
    display: flex;
    gap: 0.5rem;
}

.form-actions button {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

/* ========================================
   エラーメッセージ
======================================== */

.error-message {
    background: #fee;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    font-weight: 500;
    display: none;
    position: relative;
    font-size: 14px;
}

.error-message.show {
    display: block !important;
    animation: fadeIn 0.3s ease-in;
}

.error-message .close-btn {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    font-size: 18px;
    color: #721c24;
    cursor: pointer;
    line-height: 1;
}

.error-message .close-btn:hover {
    opacity: 0.7;
}

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

/* ========================================
   ローディング・エラー状態
======================================== */

.loading, .error {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.no-comments {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 2rem;
}

/* ========================================
   サイドバー・広告
======================================== */

.ad-space {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    height: fit-content;
}

.ad-banner {
    background: #ddd;
    height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    border-radius: 4px;
}

/* ========================================
   利用規約・フォーム関連
======================================== */

.terms-notice {
    padding: 0.5rem 0;
    margin-bottom: 1rem;
    font-size: 0.75rem;
}

.terms-notice p {
    margin: 0;
    color: #999;
}

.terms-notice a {
    color: #999;
    text-decoration: underline;
}

.terms-notice a:hover {
    color: #666;
}

.form-agreement {
    margin: 1rem 0;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 4px;
}

.form-agreement label {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    cursor: pointer;
}

.form-agreement input[type="checkbox"] {
    margin-right: 0.5rem;
    cursor: pointer;
}

.form-agreement a {
    color: #007bff;
    text-decoration: none;
}

.form-agreement a:hover {
    text-decoration: underline;
}

/* 利用規約ページスタイル */
.terms-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.terms-container h2 {
    color: #333;
    margin-bottom: 1rem;
    border-bottom: 2px solid #007bff;
    padding-bottom: 0.5rem;
}

.terms-container h3 {
    color: #555;
    margin: 2rem 0 1rem 0;
    padding: 0.5rem 0;
    border-left: 4px solid #007bff;
    padding-left: 1rem;
}

.terms-container section {
    margin-bottom: 2rem;
}

.terms-container ul {
    margin: 1rem 0;
    padding-left: 2rem;
}

.terms-container li {
    margin-bottom: 0.5rem;
}

.last-updated {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.contact-info {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 2rem 0;
    border-left: 4px solid #28a745;
}

.back-link {
    color: #007bff;
    text-decoration: none;
    font-weight: 500;
    display: inline-block;
    margin-bottom: 2rem;
}

.back-link:hover {
    text-decoration: underline;
}

.back-to-top {
    text-align: center;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #eee;
}

/* ========================================
   フッター
======================================== */

footer {
    background: #333;
    color: white;
    text-align: center;
    padding: 1rem 0;
    margin-top: 3rem;
}

footer a {
    color: #ccc;
    text-decoration: none;
}

footer a:hover {
    color: white;
    text-decoration: underline;
}

/* ========================================
   固定ナビゲーションボタン
======================================== */
.fixed-nav-buttons {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 9999;
}

.nav-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.8rem 1.2rem;
    border-radius: 50px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
    white-space: nowrap;
}

.nav-btn:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.nav-btn-comment {
    background: #28a745;
}

.nav-btn-comment:hover {
    background: #218838;
    box-shadow: 0 6px 16px rgba(40, 167, 69, 0.4);
}

/* モバイル対応 */
@media (max-width: 768px) {
    .fixed-nav-buttons {
        bottom: 1rem;
        right: 1rem;
    }

    .nav-btn {
        padding: 0.6rem 1rem;
        font-size: 0.8rem;
    }
}