/**
 * noteクリエイターダッシュボード - スタイルシート
 */

/* リセットと基本スタイル */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary-color: #41c9b4;
    --primary-hover: #35a899;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --text-color: #333;
    --text-muted: #6c757d;
    --border-color: #dee2e6;
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.15);
    --radius: 8px;
    --radius-sm: 4px;
}

html {
    font-size: 16px;
    line-height: 1.5;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-color);
    background-color: #f5f5f5;
    min-height: 100vh;
}

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

/* ボタン */
.btn {
    display: inline-block;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

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

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

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

.btn-logout {
    background-color: transparent;
    color: var(--text-muted);
    padding: 8px 16px;
    font-size: 0.875rem;
}

.btn-logout:hover {
    background-color: rgba(0, 0, 0, 0.1);
    color: var(--text-color);
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-color);
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(65, 201, 180, 0.2);
}

.input-group {
    display: flex;
    gap: 10px;
}

.input-group input {
    flex: 1;
}

/* APIバージョン選択 */
.api-version-group {
    margin-top: 1rem;
}

.radio-group {
    display: flex;
    gap: 20px;
    margin-top: 0.5rem;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: normal;
}

.radio-label input[type="radio"] {
    width: auto;
    margin: 0;
    cursor: pointer;
}

.radio-label span {
    font-size: 0.9rem;
    color: var(--text-color);
}

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

/* アラート */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* ログインページ */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

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

.login-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.login-form .btn {
    margin-top: 1rem;
}

.login-footer {
    text-align: center;
    margin-top: 2rem;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.875rem;
}

/* ヘッダー */
.header {
    background: white;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-title {
    font-size: 1.25rem;
    color: var(--text-color);
}

.header-user {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-name {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* メインコンテンツ */
.main-content {
    padding: 40px 0;
    min-height: calc(100vh - 140px);
}

/* セクション */
.search-section,
.results-section {
    background: white;
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.search-section h2,
.results-section h2 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.section-description {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* ローディング */
.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

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

/* クリエイター情報 */
.creator-info {
    margin-bottom: 30px;
}

.creator-profile {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: var(--light-color);
    border-radius: var(--radius);
}

.creator-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
}

.creator-details h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.creator-details p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* 統計情報 */
.stats-section {
    margin-bottom: 30px;
}

.stats-section h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--text-muted);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
}

.stat-card {
    background: var(--light-color);
    padding: 20px;
    border-radius: var(--radius);
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* スキ率（人気指標）セクション */
.suki-rate-title {
    font-size: 1rem;
    margin-top: 2rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.suki-rate-description {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.stat-card-highlight {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stat-card-highlight .stat-label {
    color: rgba(255, 255, 255, 0.8);
}

.stat-card-highlight .stat-value {
    color: white;
}

.stat-value-rank {
    font-size: 1.25rem;
}

/* ランク別カラー */
.rank-s {
    color: #ffd700 !important;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.rank-a {
    color: #ff6b6b !important;
}

.rank-b {
    color: #4ecdc4 !important;
}

.rank-c {
    color: #95e1d3 !important;
}

/* 記事一覧 */
.articles-section h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--text-muted);
}

.table-container {
    overflow-x: auto;
}

.articles-table {
    width: 100%;
    border-collapse: collapse;
}

.articles-table th,
.articles-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.articles-table th {
    background: var(--light-color);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.articles-table td {
    font-size: 0.875rem;
}

.articles-table tbody tr:hover {
    background: var(--light-color);
}

.articles-table a {
    color: var(--primary-color);
    text-decoration: none;
}

.articles-table a:hover {
    text-decoration: underline;
}

/* 記事テーブルのカラム幅 */
.articles-table .col-thumbnail {
    width: 100px;
}

.articles-table .col-title {
    min-width: 200px;
}

.articles-table .col-date {
    width: 140px;
    white-space: nowrap;
}

.articles-table .col-price {
    width: 80px;
    text-align: right;
}

.articles-table .col-likes {
    width: 80px;
    text-align: right;
}

.articles-table .col-hashtags {
    min-width: 200px;
}

/* サムネイル画像 */
.article-thumbnail {
    width: 80px;
    height: 50px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

/* セル固有のスタイル */
.cell-thumbnail {
    padding: 8px !important;
}

.cell-price {
    text-align: right;
    font-weight: 500;
}

.cell-likes {
    text-align: right;
    color: var(--primary-color);
    font-weight: 600;
}

.cell-hashtags {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* ハッシュタグリンク */
.hashtag-link {
    color: var(--primary-color);
    text-decoration: none;
    margin-right: 4px;
}

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

/* タグTOP5 */
.top-tags-title {
    font-size: 0.9rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-muted);
}

.top-tags-container {
    background: var(--light-color);
    border-radius: var(--radius-sm);
    padding: 1rem;
}

.top-tags-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.top-tag-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.top-tag-rank {
    font-weight: 600;
    color: var(--text-muted);
    min-width: 1.5rem;
}

.top-tag-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.top-tag-link:hover {
    text-decoration: underline;
}

.top-tag-count {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* viewerセクション */
.viewer-section {
    background: white;
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.viewer-section h2 {
    margin-bottom: 0.5rem;
}

/* ソート機能 */
.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background-color 0.2s ease;
}

.sortable:hover {
    background-color: #e9ecef;
}

.sortable .sort-icon {
    display: inline-block;
    margin-left: 4px;
    width: 0;
    height: 0;
    vertical-align: middle;
}

.sortable .sort-icon::after {
    content: '';
    display: inline-block;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid #adb5bd;
    margin-left: 2px;
}

.sortable .sort-icon::before {
    content: '';
    display: inline-block;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-bottom: 5px solid #adb5bd;
    margin-right: 2px;
}

.sortable.sort-asc .sort-icon::before {
    border-bottom-color: var(--primary-color);
}

.sortable.sort-asc .sort-icon::after {
    border-top-color: #adb5bd;
}

.sortable.sort-desc .sort-icon::after {
    border-top-color: var(--primary-color);
}

.sortable.sort-desc .sort-icon::before {
    border-bottom-color: #adb5bd;
}

/* フッター */
.footer {
    background: white;
    padding: 20px 0;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

.footer p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.footer-note {
    margin-top: 0.5rem;
    font-size: 0.75rem !important;
}

/* レスポンシブ */
@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        gap: 10px;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .creator-profile {
        flex-direction: column;
        text-align: center;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}
