:root {
    --primary-color: #2563eb;
    --secondary-color: #64748b;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --background-color: #f8fafc;
    --card-background: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-radius: 8px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
}

.site-header {
    background: var(--card-background);
    border-bottom: 1px solid #e2e8f0;
    padding: 1rem 2rem;
    box-shadow: var(--shadow);
}

.site-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.site-title a {
    text-decoration: none;
    color: var(--primary-color);
}

.site-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.identity-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.identity-card {
    background: var(--card-background);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

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

.identity-name {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
}

.identity-meta {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge.source-tmdb {
    background: #dbeafe;
    color: #1e40af;
}

.badge.source-manual {
    background: #fef3c7;
    color: #92400e;
}

.badge.source-auto_trace {
    background: #d1fae5;
    color: #065f46;
}

.quality-score {
    position: relative;
    height: 24px;
    background: #e2e8f0;
    border-radius: 4px;
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.score-bar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--warning-color), var(--success-color));
    border-radius: 4px;
}

.score-value {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.75rem;
    font-weight: 600;
}

.trace-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

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

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn:hover {
    opacity: 0.9;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

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

.pagination-container {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
}

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

.pagination .prev,
.pagination .next {
    background: var(--primary-color);
    color: white;
}

.page-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.modal-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.identity-detail-modal,
.angle-coverage-modal,
.body-actions-modal {
    background: var(--card-background);
    border-radius: var(--border-radius);
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.detail-section {
    margin-bottom: 1.5rem;
}

.detail-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.coverage-score {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.angles-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.angle-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 4px;
    background: #f1f5f9;
}

.angle-item.dominant {
    background: #d1fae5;
}

.angle-item.present {
    background: #dbeafe;
}

.angle-item.missing {
    background: #fef3c7;
}

.status-icon {
    font-size: 1.25rem;
}

.angle-name {
    flex: 1;
    font-weight: 500;
    text-transform: capitalize;
}

.count {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.recommendation {
    margin-top: 1rem;
    padding: 0.75rem;
    background: #fef3c7;
    border-radius: 4px;
    font-size: 0.875rem;
}

.actions-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.action-category h4 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    text-transform: capitalize;
}

.action-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.action-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    background: #e2e8f0;
    font-size: 0.75rem;
}

.close-modal {
    background: var(--secondary-color);
    color: white;
    width: 100%;
}

.error {
    color: var(--error-color);
    padding: 1rem;
    background: #fee2e2;
    border-radius: 4px;
}

.site-footer {
    text-align: center;
    padding: 2rem;
    margin-top: 2rem;
    border-top: 1px solid #e2e8f0;
    color: var(--text-secondary);
}

.site-footer a {
    color: var(--primary-color);
    text-decoration: none;
}

/* API Demo Pages - Shared Styles */
.page-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}
.api-nav {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--card-background);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    flex-wrap: wrap;
}
.api-nav .nav-item {
    padding: 0.5rem 1rem;
    border-radius: 4px;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    transition: background-color 0.2s;
}
.api-nav .nav-item:hover {
    background: #f1f5f9;
}
.api-nav .nav-item.active {
    background: var(--primary-color);
    color: white;
}
.api-section {
    background: var(--card-background);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}
.api-section h2 {
    margin-top: 0;
    color: var(--primary-color);
    font-size: 1.25rem;
}
.api-tester {
    margin: 1rem 0;
}
.input-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}
.input-group label {
    font-weight: 500;
    min-width: 120px;
    font-size: 0.875rem;
}
.input-group input,
.input-group select,
.input-group textarea {
    padding: 0.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 0.875rem;
    flex: 1;
    min-width: 200px;
}
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}
.btn:hover {
    opacity: 0.9;
}
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.btn-primary {
    background: var(--primary-color);
    color: white;
}
.btn-secondary {
    background: var(--secondary-color);
    color: white;
}
.response-panel {
    margin-top: 1rem;
    padding: 1rem;
    background: #f1f5f9;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.75rem;
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
    display: none;
}
.response-panel.has-content {
    display: block;
}
.badge-status {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}
.badge-status.pending { background: #fef3c7; color: #92400e; }
.badge-status.processing { background: #dbeafe; color: #1e40af; }
.badge-status.completed { background: #d1fae5; color: #065f46; }
.badge-status.error { background: #fee2e2; color: #991b1b; }
.file-item {
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.file-item:hover {
    background: #e2e8f0;
}
.file-item .uuid {
    font-family: monospace;
    font-size: 0.75rem;
    color: var(--primary-color);
}
.file-item .name {
    font-weight: 500;
}
.chunk-item {
    padding: 0.75rem;
    background: #f1f5f9;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    border-left: 3px solid var(--primary-color);
}
.chunk-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-family: monospace;
}