/* ============================================
   Skills 中文站 - 原生 CSS 样式
   ============================================ */

/* ========== 全局重置 ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
                 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 50%, #eff6ff 100%);
    min-height: 100vh;
    color: #1e293b;
    line-height: 1.6;
}

/* ========== 容器 ========== */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
}

@media (min-width: 640px) {
    .container {
        padding: 0 1.5rem;
    }
}

@media (min-width: 1024px) {
    .container {
        padding: 0 2rem;
    }
}

/* ========== Header ========== */
.header {
    border-bottom: 1px solid #e2e8f0;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-content {
    padding: 1.5rem 0;
}

.title {
    font-size: 1.875rem;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.emoji {
    font-size: 2.5rem;
}

.subtitle {
    color: #64748b;
    margin-top: 0.25rem;
}

/* ========== Main ========== */
.main {
    max-width: 1280px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

@media (min-width: 640px) {
    .main {
        padding: 2rem 1.5rem;
    }
}

@media (min-width: 1024px) {
    .main {
        padding: 2rem 2rem;
    }
}

/* ========== 搜索区域 ========== */
.search-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-wrapper {
    position: relative;
    flex: 1;
    max-width: 20rem;
}

.search-input {
    width: 100%;
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.25rem;
    height: 1.25rem;
    color: #94a3b8;
    pointer-events: none;
}

.skill-count {
    font-size: 0.875rem;
    color: #64748b;
}

/* ========== 更新时间 ========== */
.last-update {
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    color: #64748b;
}

/* ========== 错误状态 ========== */
.error-state {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
}

.error-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.error-icon {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

/* ========== 加载状态 ========== */
.loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5rem 0;
}

.loading-content {
    text-align: center;
}

.spinner {
    width: 3rem;
    height: 3rem;
    color: #2563eb;
    margin: 0 auto 1rem;
    animation: spin 1s linear infinite;
}

.spinner-circle-1 {
    opacity: 0.25;
}

.spinner-circle-2 {
    opacity: 0.75;
}

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

.loading-text {
    color: #64748b;
}

/* ========== 技能网格 ========== */
.skills-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .skills-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .skills-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ========== 技能卡片 ========== */
.skill-card {
    position: relative;
    display: block;
    width: 100%;
}

.skill-card-inner {
    background: #ffffff;
    border-radius: 0.75rem;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease-in-out;
}

.skill-card-inner:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-color: #93c5fd;
    transform: translateY(-2px);
}

/* 卡片头部 */
.card-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    border: 2px solid;
    font-weight: 700;
    font-size: 0.875rem;
    flex-shrink: 0;
}

/* 排名颜色 */
.rank-1 {
    color: #ca8a04;
    background-color: #fef9c3;
    border-color: #fde047;
}

.rank-2 {
    color: #ca8a04;
    background-color: #fef9c3;
    border-color: #fde047;
}

.rank-3 {
    color: #ca8a04;
    background-color: #fef9c3;
    border-color: #fde047;
}

.rank-default {
    color: #57534e;
    background-color: #fafaf9;
    border-color: #e7e5e4;
}

.card-title {
    flex: 1;
    min-width: 0;
}

.card-title h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #0f172a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 卡片摘要 */
.card-summary {
    margin-bottom: 1rem;
}

.card-summary p {
    font-size: 0.875rem;
    color: #64748b;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 卡片底部 */
.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.75rem;
    border-top: 1px solid #f1f5f9;
}

.installs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.installs-main {
    font-size: 0.875rem;
    font-weight: 600;
    color: #0f172a;
}

.installs-sub {
    font-size: 0.75rem;
    color: #64748b;
}

.repo-link {
    font-size: 0.875rem;
    color: #2563eb;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    transition: color 0.15s;
}

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

.repo-link svg {
    width: 1rem;
    height: 1rem;
}

/* ========== 空状态 ========== */
.empty-state {
    text-align: center;
    padding: 5rem 0;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.empty-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 0.5rem;
}

.empty-desc {
    color: #64748b;
    margin-bottom: 1.5rem;
}

/* ========== 按钮 ========== */
.btn-primary {
    padding: 0.5rem 1.5rem;
    background: #2563eb;
    color: #ffffff;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #1d4ed8;
}

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

/* ========== Footer ========== */
.footer {
    margin-top: 4rem;
    padding: 2rem 0;
    border-top: 1px solid #e2e8f0;
    text-align: center;
    font-size: 0.875rem;
    color: #64748b;
}

.footer p {
    margin-bottom: 0.25rem;
}

/* ========== Tooltip ========== */
.tooltip {
    position: fixed;
    z-index: 50;
    padding: 0.75rem 1rem;
    background: #0f172a;
    color: #ffffff;
    font-size: 0.875rem;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    max-width: 25rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
    transition: opacity 0.15s ease-in-out;
}

.tooltip-arrow {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: -0.25rem;
    width: 0;
    height: 0;
    border-left: 0.5rem solid transparent;
    border-right: 0.5rem solid transparent;
    border-top: 0.5rem solid #0f172a;
}

/* ========== 工具类 ========== */
.hidden {
    display: none !important;
}

/* ========== 响应式调整 ========== */
@media (max-width: 640px) {
    .title {
        font-size: 1.5rem;
    }

    .emoji {
        font-size: 2rem;
    }

    .search-row {
        flex-direction: column;
        align-items: stretch;
    }

    .search-wrapper {
        max-width: 100%;
    }

    .skill-count {
        text-align: center;
    }
}
