:root {
    --primary-color: #1DA1F2;
    --primary-dark: #0d8bd9;
    --primary-light: #4ab3f4;
    --secondary-color: #14171A;
    --text-primary: #14171A;
    --text-secondary: #657786;
    --text-light: #AAB8C2;
    --bg-primary: #FFFFFF;
    --bg-secondary: #F7F9FA;
    --bg-hover: #E8F5FE;
    --border-color: #E1E8ED;
    --success-color: #17BF63;
    --danger-color: #E0245E;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8f0f7 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* サイドバー */
.sidebar {
    width: 280px;
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    padding: 24px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.logo h1 {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
}

.nav-item:hover {
    background: var(--bg-hover);
    transform: translateX(4px);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    box-shadow: var(--shadow-md);
}

.nav-item svg {
    flex-shrink: 0;
}

/* メインコンテンツ */
.main-content {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
}

.page {
    display: none;
    animation: fadeIn 0.4s ease-in-out;
}

.page.active {
    display: block;
}

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

.page-header {
    margin-bottom: 32px;
}

.page-header h2 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 16px;
}

/* フォーム */
.post-form {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-md);
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-family: inherit;
    transition: var(--transition);
    background: var(--bg-secondary);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--bg-primary);
    box-shadow: 0 0 0 3px rgba(29, 161, 242, 0.1);
}

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

.form-hint {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

/* プレビュー */
.preview-container {
    display: grid;
    gap: 16px;
}

.preview-main-post,
.preview-thread {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.preview-header {
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.preview-content {
    padding: 16px;
    color: var(--text-primary);
    min-height: 80px;
    max-height: 300px;
    overflow-y: auto;
}

.preview-thread .preview-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.thread-item {
    padding: 12px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary-color);
    font-size: 14px;
    transition: var(--transition);
}

.thread-item:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

.thread-item-number {
    font-weight: 600;
    color: var(--primary-color);
    margin-right: 8px;
}

/* ボタン */
.button-group {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.btn {
    padding: 14px 28px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    box-shadow: var(--shadow-md);
}

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

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

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

.btn-small {
    padding: 8px 16px;
    font-size: 13px;
}

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

.btn-danger:hover {
    background: #c91c4e;
}

/* 投稿結果 */
.post-result {
    margin-top: 32px;
    padding: 32px;
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    border-radius: var(--radius-lg);
    text-align: center;
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    background: var(--success-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: bold;
}

.post-result h3 {
    margin-bottom: 16px;
    color: var(--success-color);
}

.post-link {
    display: inline-block;
    padding: 12px 24px;
    background: white;
    color: var(--primary-color);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.post-link:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* アカウント管理 */
.accounts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
}

.category-section {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
}

.category-section h3 {
    margin-bottom: 20px;
    font-size: 20px;
    color: var(--text-primary);
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
}

.accounts-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
    min-height: 100px;
}

.account-item {
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
    border: 2px solid transparent;
}

.account-item:hover {
    border-color: var(--primary-color);
    transform: translateX(4px);
}

.account-info {
    flex: 1;
}

.account-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.account-category {
    font-size: 13px;
    color: var(--text-secondary);
}

.account-actions {
    display: flex;
    gap: 8px;
}

.add-account-btn {
    width: 100%;
}

/* テンプレート管理 */
.templates-container {
    display: grid;
    gap: 24px;
}

.template-section {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
}

.section-header h3 {
    font-size: 18px;
    color: var(--text-primary);
}

.template-list {
    display: grid;
    gap: 12px;
    min-height: 80px;
}

.template-item {
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    transition: var(--transition);
    border: 2px solid transparent;
}

.template-item:hover {
    border-color: var(--primary-color);
}

.template-content {
    flex: 1;
    color: var(--text-primary);
    line-height: 1.5;
    word-break: break-word;
}

.template-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* 投稿履歴 */
.history-list {
    display: grid;
    gap: 16px;
}

.history-item {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.history-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.history-account {
    font-weight: 600;
    color: var(--text-primary);
}

.history-date {
    font-size: 13px;
    color: var(--text-secondary);
}

.history-content {
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    border-left: 3px solid var(--primary-color);
}

.history-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: var(--transition);
}

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

/* モーダル */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease-out;
}

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

.modal-header h3 {
    font-size: 20px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-secondary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* レスポンシブ */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .nav-menu {
        flex-direction: row;
        overflow-x: auto;
    }

    .nav-item {
        white-space: nowrap;
    }

    .main-content {
        padding: 20px;
    }

    .accounts-container {
        grid-template-columns: 1fr;
    }
}

/* スクロールバー */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}
