/**
 * SKILL 排行榜 - Skill 详情页样式
 */

/* Core Web Vitals: Prevent CLS */
img, video, iframe {
    max-width: 100%;
    height: auto;
}

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

body {
    background: #000;
    color: #fff;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    min-height: 100vh;
    line-height: 1.6;
    padding: 2rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.page-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
}

.main-content {
    min-width: 0;
}

.sidebar {
    position: sticky;
    top: 2rem;
    height: fit-content;
}

/* Header Navigation - 与首页一致 */
.header-nav {
    position: fixed;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
    z-index: 100;
}

.lang-switcher {
    position: relative;
}

.lang-select {
    background: #111;
    border: 1px solid #333;
    color: #888;
    padding: 0.4rem 0.8rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    cursor: pointer;
    border-radius: 4px;
    appearance: none;
    padding-right: 1.5rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='%23888'%3E%3Cpath d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 8px;
}

.lang-select:hover {
    border-color: #555;
    color: #fff;
}

.lang-select:focus {
    outline: none;
    border-color: #666;
}

.breadcrumb {
    color: #666;
    font-size: 0.85rem;
    margin-bottom: 2rem;
}

.breadcrumb a {
    color: #888;
    text-decoration: none;
}

.breadcrumb a:hover {
    color: #fff;
}

.breadcrumb-separator {
    margin: 0 0.5rem;
}

.skill-header {
    border-bottom: 1px solid #222;
    padding-bottom: 2rem;
    margin-bottom: 2rem;
}

.skill-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.skill-meta {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    margin-top: 1rem;
    color: #888;
    font-size: 0.9rem;
}

.skill-meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.skill-meta-label {
    color: #666;
}

.skill-meta-value {
    color: #fff;
}

.installs {
    color: #4ade80;
    font-weight: 500;
}

.repo-link {
    color: #888;
    text-decoration: none;
}

.repo-link:hover {
    color: #fff;
    text-decoration: underline;
}

.skill-content {
    margin-top: 2rem;
}

.skill-content h1,
.skill-content h2,
.skill-content h3 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: #fff;
}

.skill-content h1 {
    font-size: 1.8rem;
}

.skill-content h2 {
    font-size: 1.4rem;
}

.skill-content h3 {
    font-size: 1.1rem;
}

.skill-content p {
    margin-bottom: 1rem;
    color: #ccc;
}

.skill-content pre {
    background: #111;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 1rem;
    overflow-x: auto;
    margin: 1rem 0;
}

.skill-content code {
    font-family: 'JetBrains Mono', monospace;
    background: #111;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-size: 0.9rem;
}

.skill-content pre code {
    background: none;
    padding: 0;
}

.skill-content ul,
.skill-content ol {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

.skill-content li {
    margin-bottom: 0.5rem;
    color: #ccc;
}

.skill-content a {
    color: #888;
    text-decoration: underline;
}

.skill-content a:hover {
    color: #fff;
}

.install-section {
    background: #0a0a0a;
    border: 1px solid #222;
    border-radius: 4px;
    padding: 1.5rem;
    margin: 2rem 0;
}

.install-title {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

.install-command {
    background: #111;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 1rem;
    font-family: 'JetBrains Mono', monospace;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.command-text {
    color: #4ade80;
    flex: 1;
}

.copy-btn {
    background: #222;
    border: 1px solid #444;
    color: #fff;
    padding: 0.5rem 1rem;
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.copy-btn:hover {
    background: #333;
}

.copy-btn.copied {
    background: #166534;
    border-color: #22c55e;
    color: #4ade80;
}

.back-link {
    display: inline-block;
    margin-top: 2rem;
    color: #888;
    text-decoration: none;
    font-size: 0.9rem;
}

.back-link:hover {
    color: #fff;
}

/* Related Skills Section - Sidebar */
.related-skills {
    background: #0a0a0a;
    border: 1px solid #222;
    border-radius: 6px;
    padding: 1.25rem;
}

.related-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.related-card {
    background: #111;
    border: 1px solid #222;
    border-radius: 4px;
    padding: 0.75rem;
    text-decoration: none;
    transition: all 0.2s;
    display: block;
}

.related-card:hover {
    border-color: #444;
    background: #1a1a1a;
}

.related-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: #fff;
    margin-bottom: 0.35rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.related-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #666;
    margin-bottom: 0.35rem;
}

.related-installs {
    color: #4ade80;
}

.related-desc {
    font-size: 0.75rem;
    color: #888;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (max-width: 900px) {
    .page-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        order: 2;
    }

    .related-skills {
        margin-top: 2rem;
    }

    .related-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 0.75rem;
    }
}

@media (max-width: 768px) {
    body {
        padding: 1rem;
    }

    .skill-title {
        font-size: 1.5rem;
    }

    .skill-meta {
        flex-direction: column;
        gap: 0.5rem;
    }

    .header-nav {
        top: 0.5rem;
        right: 0.5rem;
    }

    .related-list {
        grid-template-columns: 1fr;
    }
}

/* 骨架屏动画 */
.skeleton-card {
    background: #111;
    border: 1px solid #222;
    border-radius: 4px;
    padding: 0.75rem;
    height: 90px;
    position: relative;
    overflow: hidden;
}

.skeleton-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.05),
        transparent
    );
    animation: skeleton-shimmer 1.5s infinite;
}

@keyframes skeleton-shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* 相关推荐加载失败/为空 */
.related-empty {
    color: #666;
    font-size: 0.85rem;
    padding: 1rem 0;
    text-align: center;
}

/* 淡入动画 */
.related-card {
    opacity: 0;
    animation: fadeIn 0.3s ease forwards;
}

.related-card:nth-child(1) { animation-delay: 0.05s; }
.related-card:nth-child(2) { animation-delay: 0.1s; }
.related-card:nth-child(3) { animation-delay: 0.15s; }
.related-card:nth-child(4) { animation-delay: 0.2s; }
.related-card:nth-child(5) { animation-delay: 0.25s; }
.related-card:nth-child(6) { animation-delay: 0.3s; }

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