/* Comic7 Components - 卡片、按钮、列表等 */

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    white-space: nowrap;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    border-radius: 9999px;
    padding: 0.5rem 1rem;
    height: 2.5rem;
    border: none;
    background: var(--primary);
    color: var(--primary-foreground);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn:hover {
    background: rgba(37, 99, 235, 0.9);
}

.btn:active {
    transform: scale(0.95);
}

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

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

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

.btn-secondary:hover {
    background: #e2e8f0;
}

/* 卡片 */
.card {
    background: var(--background);
    border-radius: var(--radius-2xl);
    padding: 0.75rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

/* 漫画卡片 */
.book-card {
    display: block;
    position: relative;
    background-color: var(--background);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    text-decoration: none;
}

.book-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    text-decoration: none;
}

.book-card:active {
    transform: scale(0.95);
}

.book-cover-wrapper {
    position: relative;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    border-radius: var(--radius-xl);
    background: linear-gradient(to bottom right, #f0f0f0, #e0e0e0);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.book-cover {
    position: relative;
    width: 100%;
    aspect-ratio: 3/4;
    background-color: var(--muted);
    overflow: hidden;
}

.book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 1;
    transition: transform 0.3s ease;
}

.book-card:hover .book-cover img {
    transform: scale(1.03);
}

.book-status-badge {
    position: absolute;
    top: 0.375rem;
    right: 0.375rem;
    z-index: 10;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background: rgba(37, 99, 235, 0.9);
    backdrop-filter: blur(8px);
    padding: 0.125rem 0.375rem;
    font-size: 0.5625rem;
    font-weight: var(--font-weight-bold);
    color: white;
    box-shadow: var(--shadow-sm);
}

.book-info {
    padding: var(--spacing-md);
}

.book-title {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: var(--spacing-xs);
    line-height: 1.4;
    transition: color 0.3s ease;
}

.book-card:hover .book-title {
    color: var(--primary);
}

.book-author {
    font-size: var(--font-size-sm);
    color: var(--muted-foreground);
    margin-bottom: var(--spacing-xs);
}

.book-meta {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: var(--font-size-xs);
    color: var(--muted-foreground);
}

.book-status {
    display: inline-block;
    padding: 2px var(--spacing-xs);
    font-size: var(--font-size-xs);
    border-radius: var(--radius-sm);
    background-color: var(--muted);
    color: var(--muted-foreground);
}

.book-status.completed {
    background-color: #10b981;
    color: #ffffff;
}

/* 书籍列表 */
.book-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: var(--spacing-lg);
    padding: var(--spacing-lg) 0;
}

@media (max-width: 768px) {
    .book-list {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: var(--spacing-md);
    }
}

/* 网格布局 */
.grid {
    display: grid;
}

.grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.gap-3 {
    gap: 0.75rem;
}

.gap-4 {
    gap: 1rem;
}

/* 章节列表 */
.chapter-list {
    background-color: var(--background);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-top: var(--spacing-xl);
}

.chapter-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border);
}

.chapter-list-title {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--foreground);
}

.chapter-list-items {
    max-height: 600px;
    overflow-y: auto;
}

.chapter-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--border);
    transition: background-color 0.15s ease;
}

.chapter-item:hover {
    background-color: var(--muted);
}

.chapter-item:last-child {
    border-bottom: none;
}

.chapter-name {
    flex: 1;
    font-size: var(--font-size-base);
    color: var(--foreground);
    text-decoration: none;
    transition: color 0.15s ease;
}

.chapter-name:hover {
    color: var(--primary);
    text-decoration: none;
}

.chapter-time {
    font-size: var(--font-size-sm);
    color: var(--muted-foreground);
    margin-left: var(--spacing-md);
}

.chapter-item-rank {
    width: 1rem;
    text-align: center;
    font-weight: var(--font-weight-bold);
    font-size: var(--font-size-sm);
    font-style: italic;
    flex-shrink: 0;
}

.chapter-item-rank.rank-1 {
    color: #eab308;
}

.chapter-item-rank.rank-2 {
    color: #94a3b8;
}

.chapter-item-rank.rank-3 {
    color: #d97706;
}

.chapter-item-rank.rank-other {
    color: #d1d5db;
    font-size: var(--font-size-xs);
    font-style: normal;
}

.chapter-item-cover {
    position: relative;
    width: 3rem;
    height: 4rem;
    flex-shrink: 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--muted);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.chapter-item:hover .chapter-item-cover {
    box-shadow: var(--shadow-md);
}

.chapter-item-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.chapter-item:hover .chapter-item-cover img {
    transform: scale(1.05);
}

.chapter-item-info {
    flex: 1;
    min-width: 0;
    padding: 0.125rem 0;
}

.chapter-item-title {
    font-weight: var(--font-weight-bold);
    font-size: var(--font-size-xs);
    color: var(--foreground);
    margin-bottom: 0.125rem;
    transition: color 0.3s ease;
}

.chapter-item:hover .chapter-item-title {
    color: var(--primary);
}

.chapter-item-author {
    font-size: 0.625rem;
    color: var(--muted-foreground);
    margin-top: 0.125rem;
}

.chapter-item-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.chapter-item-tag {
    font-size: 0.5625rem;
    padding: 0.0625rem 0.25rem;
    background: var(--muted);
    color: var(--muted-foreground);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.chapter-item-views {
    display: flex;
    align-items: center;
    gap: 0.125rem;
    font-size: 0.5625rem;
    color: #fb923c;
    font-weight: var(--font-weight-medium);
}

.chapter-item-views svg {
    width: 0.625rem;
    height: 0.625rem;
    fill: #fb923c;
}

/* 标签 */
.tag {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    font-size: var(--font-size-xs);
    background: var(--muted);
    color: var(--muted-foreground);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    text-decoration: none;
    transition: all 0.2s ease;
}

.tag:hover {
    background: var(--secondary);
    color: var(--foreground);
}

/* 加载动画 */
.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

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