/* ──────────── 基本設定 ──────────── */
:root {
    --primary: #3B82F6;
    --primary-light: #93C5FD;
    --primary-dark: #2563EB;
    --secondary: #F59E0B;
    --bg: #F8FAFC;
    --bg-card: #ffffff;
    --bg-header: #EFF6FF;
    --text: #1E293B;
    --text-light: #64748B;
    --text-muted: #94A3B8;
    --border: #E2E8F0;
    --border-light: #F1F5F9;
    --success: #22C55E;
    --warning: #F59E0B;
    --danger: #EF4444;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --radius: 8px;
    --radius-lg: 12px;
}

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

body {
    font-family: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

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

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text);
}

.logo-icon {
    font-size: 24px;
}

.logo-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

.nav {
    display: flex;
    gap: 4px;
}

.nav-link {
    padding: 8px 16px;
    text-decoration: none;
    color: var(--text-light);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-link:hover {
    background: var(--bg-header);
    color: var(--text);
}

.nav-link.active {
    background: var(--primary);
    color: white;
}

/* ──────────── メインコンテンツ ──────────── */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

/* ──────────── ページヘッダー ──────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.page-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
}

.action-buttons {
    display: flex;
    gap: 8px;
}

/* ──────────── ボタン ──────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

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

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

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

.btn-secondary:hover {
    opacity: 0.9;
}

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

.btn-outline:hover {
    background: var(--bg-header);
}

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

.btn-success:hover {
    opacity: 0.9;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-lg {
    padding: 14px 32px;
    font-size: 16px;
    border-radius: var(--radius-lg);
}

.btn-skip {
    background: var(--bg-header);
    color: var(--text-light);
}

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

/* ──────────── バッジ ──────────── */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    background: rgba(255,255,255,0.3);
    border-radius: 11px;
    font-size: 12px;
    font-weight: 700;
}

.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-new { background: #e8f0fe; color: #4a6fa5; }
.status-promising { background: #fef3e2; color: #b8860b; }
.status-done { background: #e6f4ea; color: #2d8a4e; }
.status-excluded { background: #f4e8e8; color: #a55; }

/* ──────────── フィルタエリア ──────────── */
.filter-area {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.filter-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.filter-row:last-child {
    margin-bottom: 0;
}

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

.filter-group label {
    font-size: 12px;
    color: var(--text-light);
    font-weight: 600;
}

.filter-group select,
.filter-group input {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text);
    background: white;
    min-width: 120px;
}

.filter-group input[type="text"] {
    min-width: 180px;
}

.filter-actions {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    margin-left: auto;
}

/* ──────────── テーブル ──────────── */
.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow-x: auto;
    box-shadow: var(--shadow);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th {
    background: var(--bg-header);
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-light);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    position: sticky;
    top: 0;
}

.data-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.data-table th.sortable:hover {
    color: var(--primary);
}

.data-table th.sort-asc::after {
    content: ' ▲';
    font-size: 10px;
}

.data-table th.sort-desc::after {
    content: ' ▼';
    font-size: 10px;
}

.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.data-table tr:hover {
    background: #F8FAFC;
}

.data-table .truncate {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.data-table .text-center {
    text-align: center;
}

.target-yes { color: var(--success); font-weight: 700; }
.target-no { color: var(--danger); font-weight: 700; }
.target-none { color: var(--text-muted); }

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-light);
}

.platform-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    color: white;
}

.platform-x { background: #000; }
.platform-instagram { background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); }
.platform-threads { background: #000; }

/* ──────────── ページネーション ──────────── */
.pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 16px;
    padding: 8px;
}

.pagination button {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.pagination button:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.pagination button.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ──────────── 詳細画面 ──────────── */
.detail-container {
    display: grid;
    gap: 20px;
}

.detail-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
}

.detail-section h2 {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-light);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px 24px;
}

.detail-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-field.full-width {
    grid-column: 1 / -1;
}

.detail-field label {
    font-size: 12px;
    color: var(--text-light);
    font-weight: 600;
}

.detail-field .value {
    font-size: 14px;
    color: var(--text);
    padding: 6px 0;
}

.detail-field .value a {
    color: var(--primary);
    text-decoration: none;
}

.detail-field .value a:hover {
    text-decoration: underline;
}

.detail-field select,
.detail-field textarea,
.detail-field input {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    color: var(--text);
    background: white;
    font-family: inherit;
}

.detail-field textarea {
    min-height: 80px;
    resize: vertical;
}

.post-content-full {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 16px;
    line-height: 1.8;
    white-space: pre-wrap;
}

.detail-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    justify-content: flex-end;
}

/* ──────────── リプ候補エリア ──────────── */
.reply-candidates {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.candidate-card {
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.candidate-card:hover {
    border-color: var(--primary-light);
    background: #EFF6FF;
}

.candidate-card.selected {
    border-color: var(--primary);
    background: #DBEAFE;
}

.candidate-card.copied {
    border-color: var(--success);
    background: #f0faf4;
}

.candidate-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.candidate-number {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
}

.candidate-copy-btn {
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: white;
    font-size: 11px;
    cursor: pointer;
    color: var(--text-light);
    transition: all 0.2s;
}

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

.candidate-content {
    font-size: 14px;
    line-height: 1.7;
}

.candidate-selected-badge {
    display: inline-block;
    padding: 2px 8px;
    background: var(--success);
    color: white;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
}

/* ──────────── サポート画面 ──────────── */
.support-page {
    max-width: 700px;
    margin: 0 auto;
}

.support-header {
    text-align: center;
    margin-bottom: 24px;
}

.support-header h1 {
    font-size: 20px;
    margin-bottom: 12px;
}

.support-progress {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

#remaining-count {
    font-size: 14px;
    color: var(--text-light);
    font-weight: 600;
}

.progress-bar {
    width: 100%;
    max-width: 400px;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* サポート - ターゲット情報 */
.support-target {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.support-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}

.support-user-name {
    font-size: 16px;
    font-weight: 700;
}

.support-user-handle {
    font-size: 13px;
    color: var(--text-light);
}

.support-user-stats {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: auto;
}

.support-bio {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 16px;
    padding: 10px;
    background: var(--bg);
    border-radius: 6px;
}

.support-post {
    font-size: 15px;
    line-height: 1.8;
    white-space: pre-wrap;
    margin-bottom: 8px;
}

.support-post-datetime {
    font-size: 12px;
    color: var(--text-muted);
}

/* サポート - リプ候補 */
.support-candidates {
    margin-bottom: 20px;
}

.support-candidates h3 {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 12px;
}

/* サポート - アクションボタン */
.support-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* アクションタイプバッジ */
.action-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-right: 6px;
    vertical-align: middle;
}
.action-badge.action-reply {
    background: #DBEAFE;
    color: #2563EB;
}
.action-badge.action-like {
    background: #FEF3C7;
    color: #D97706;
}

/* ──────────── 完了メッセージ ──────────── */
.completed-message {
    text-align: center;
    padding: 60px 20px;
}

.completed-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.completed-message h2 {
    font-size: 24px;
    color: var(--primary);
    margin-bottom: 24px;
}

/* ──────────── トースト通知 ──────────── */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 24px;
    background: var(--text);
    color: white;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 1000;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.success {
    background: var(--success);
}

/* ──────────── スコア表示 ──────────── */
.support-score {
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
    padding: 6px 16px;
    border-radius: var(--radius);
    display: inline-block;
}

.support-score.score-high { color: #2d8a4e; background: #e6f4ea; }
.support-score.score-mid { color: #b8860b; background: #fef3e2; }
.support-score.score-low { color: #a55; background: #f4e8e8; }

.support-reason {
    text-align: center;
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 12px;
}

/* ──────────── 除外ボタン ──────────── */
.btn-exclude {
    background: var(--danger);
    color: white;
}

.btn-exclude:hover {
    opacity: 0.9;
}

/* サポートアクション - スマホ対応 */
@media (max-width: 600px) {
    .support-actions {
        flex-wrap: wrap;
    }
    .support-actions .btn {
        flex: 1 1 45%;
        justify-content: center;
        padding: 12px 16px;
        font-size: 14px;
    }
}

/* ──────────── カード遷移アニメーション ──────────── */
#support-content {
    transition: opacity 0.2s ease, transform 0.2s ease;
}

#support-content.slide-out {
    opacity: 0;
    transform: translateX(-30px);
}

#support-content.slide-in {
    animation: slideIn 0.3s ease forwards;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ──────────── ログイン画面 ──────────── */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%);
}

.login-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
    width: 100%;
    max-width: 420px;
}

.login-card h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    text-align: center;
    margin-bottom: 8px;
}

.login-card p {
    text-align: center;
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 24px;
}

.login-card .form-group {
    margin-bottom: 20px;
}

.login-card .form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 6px;
}

.login-card .form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px;
    color: var(--text);
    font-family: monospace;
    letter-spacing: 1px;
    text-align: center;
}

.login-card .form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.login-card .btn {
    width: 100%;
    justify-content: center;
    padding: 14px;
    font-size: 16px;
}

.login-error {
    background: #FEF2F2;
    color: var(--danger);
    padding: 10px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 16px;
    text-align: center;
}

/* ──────────── 設定画面 ──────────── */
.settings-page {
    max-width: 800px;
    margin: 0 auto;
}

.settings-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.settings-section h2 {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-light);
}

.settings-field {
    margin-bottom: 16px;
}

.settings-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 6px;
}

.settings-field select,
.settings-field input[type="text"],
.settings-field input[type="number"] {
    width: 100%;
    max-width: 400px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    color: var(--text);
    background: white;
}

.settings-field select:focus,
.settings-field input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.settings-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.keyword-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.keyword-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: var(--bg-header);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 13px;
    color: var(--text);
}

.keyword-tag .remove-tag {
    cursor: pointer;
    color: var(--text-muted);
    font-size: 16px;
    line-height: 1;
}

.keyword-tag .remove-tag:hover {
    color: var(--danger);
}

.keyword-input-row {
    display: flex;
    gap: 8px;
}

.keyword-input-row input {
    flex: 1;
    max-width: 300px;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 400;
    color: var(--text);
    cursor: pointer;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 400;
    color: var(--text);
    cursor: pointer;
}

.settings-save {
    display: flex;
    justify-content: flex-end;
}

/* ──────────── スコアインライン ──────────── */
.score-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 24px;
    padding: 0 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
}

.score-inline.score-high { background: #DCFCE7; color: #166534; }
.score-inline.score-mid { background: #FEF3C7; color: #92400E; }
.score-inline.score-low { background: #FEE2E2; color: #991B1B; }

/* ──────────── ログアウトリンク ──────────── */
.nav-logout {
    color: var(--text-muted) !important;
    font-size: 13px !important;
}

.nav-logout:hover {
    color: var(--danger) !important;
}

/* ──────────── バナー通知 ──────────── */
.banner {
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 16px;
}
.banner-danger {
    background: #FEE2E2;
    color: #991B1B;
    border: 1px solid #FECACA;
}
.banner-warning {
    background: #FEF3C7;
    color: #92400E;
    border: 1px solid #FDE68A;
}
.banner-info {
    background: #DBEAFE;
    color: #1E40AF;
    border: 1px solid #BFDBFE;
}

/* ──────────── スピナー ──────────── */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 4px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ──────────── ボタン disabled ──────────── */
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ──────────── ユーティリティ ──────────── */
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-muted); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
