/**
 * SKILL 排行榜 - 主样式表
 */

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

/* Font loading optimization */
@font-face {
    font-family: 'JetBrains Mono';
    font-display: swap;
}

* {
    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;
}

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

/* ASCII Logo */
.ascii-logo {
    font-size: clamp(0.4rem, 1.2vw, 0.85rem);
    line-height: 1.1;
    white-space: pre;
    text-align: center;
    margin-bottom: 1rem;
    color: #fff;
    letter-spacing: 0;
}

.tagline {
    text-align: center;
    color: #888;
    font-size: 1rem;
    margin-bottom: 2rem;
}

/* Header Nav */
.header-nav {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Docs Dropdown */
.docs-dropdown {
    position: relative;
}

.docs-btn {
    background: #111;
    border: 1px solid #333;
    color: #888;
    padding: 0.5rem 0.75rem;
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.docs-btn:hover {
    border-color: #555;
    color: #fff;
}

.docs-btn svg {
    width: 12px;
    height: 12px;
    transition: transform 0.2s;
}

.docs-dropdown:hover .docs-btn svg {
    transform: rotate(180deg);
}

.docs-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: #111;
    border: 1px solid #333;
    border-radius: 4px;
    min-width: 140px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
}

.docs-dropdown:hover .docs-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.docs-menu a {
    display: block;
    padding: 0.6rem 1rem;
    color: #888;
    text-decoration: none;
    font-size: 0.8rem;
    transition: all 0.2s;
    border-bottom: 1px solid #222;
}

.docs-menu a:last-child {
    border-bottom: none;
}

.docs-menu a:hover {
    background: #1a1a1a;
    color: #fff;
}

.docs-menu a svg {
    width: 14px;
    height: 14px;
    margin-right: 0.5rem;
    vertical-align: middle;
    opacity: 0.6;
}

/* Language Switcher */
.lang-switcher {
    display: inline-block;
}

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

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

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

/* Search Section */
.search-section {
    margin-bottom: 2rem;
}

.search-container {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 1rem;
}

.search-input {
    flex: 1;
    max-width: 500px;
    background: #111;
    border: 1px solid #333;
    color: #fff;
    padding: 0.75rem 1rem;
    font-family: inherit;
    font-size: 0.9rem;
    border-radius: 4px;
}

.search-input:focus {
    outline: none;
    border-color: #666;
}

.search-input::placeholder {
    color: #555;
}

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

.search-btn:hover {
    background: #333;
    border-color: #555;
}

.search-btn.active {
    background: #fff;
    color: #000;
}

.search-mode {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.mode-btn {
    background: transparent;
    border: 1px solid #333;
    color: #888;
    padding: 0.5rem 1rem;
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.mode-btn:hover {
    border-color: #555;
    color: #fff;
}

.mode-btn.active {
    border-color: #fff;
    color: #fff;
}

.keyboard-hint {
    text-align: center;
    color: #444;
    font-size: 0.75rem;
}

.keyboard-hint kbd {
    background: #222;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    border: 1px solid #333;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 2rem;
    border-bottom: 1px solid #222;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
}

.tab {
    background: none;
    border: none;
    color: #555;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.5rem 0;
    transition: color 0.2s;
}

.tab:hover {
    color: #888;
}

.tab.active {
    color: #fff;
    border-bottom: 2px solid #fff;
    margin-bottom: -0.6rem;
}

.tab-count {
    color: #444;
    font-size: 0.8rem;
    margin-left: 0.5rem;
}

/* Stats */
.stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.stat {
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
}

.stat-label {
    font-size: 0.75rem;
    color: #555;
    text-transform: uppercase;
}

/* Table */
.table-container {
    overflow-x: auto;
}

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

th {
    text-align: left;
    padding: 1rem 0.75rem;
    border-bottom: 1px solid #333;
    color: #666;
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
    white-space: nowrap;
}

td {
    padding: 0.75rem;
    border-bottom: 1px solid #1a1a1a;
    font-size: 0.85rem;
    vertical-align: top;
}

tr:hover {
    background: #0a0a0a;
}

.rank {
    color: #555;
    font-weight: 500;
    width: 50px;
}

.skill-name {
    color: #fff;
    font-weight: 500;
    width: 300px;
    max-width: 300px;
}

.skill-name a {
    color: inherit;
    text-decoration: none;
}

.skill-name a:hover {
    text-decoration: underline;
}

.repo {
    color: #666;
}

.repo a {
    color: inherit;
    text-decoration: none;
}

.repo a:hover {
    color: #888;
}

.description {
    color: #888;
    max-width: 450px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
    font-size: 0.85rem;
    max-height: 3.825rem;
}

.description-full {
    white-space: normal;
    word-break: break-word;
}

.installs {
    color: #4ade80;
    font-weight: 500;
    text-align: right;
    white-space: nowrap;
}

.copy-btn {
    background: #1a1a1a;
    border: 1px solid #333;
    color: #666;
    padding: 0.25rem 0.5rem;
    font-family: inherit;
    font-size: 0.7rem;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.2s;
    margin-left: 0.5rem;
}

.copy-btn:hover {
    background: #222;
    color: #fff;
}

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

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.page-btn {
    background: #111;
    border: 1px solid #333;
    color: #888;
    padding: 0.5rem 1rem;
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.page-btn:hover:not(.disabled):not(:disabled) {
    background: #222;
    color: #fff;
}

.page-btn:disabled,
.page-btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.page-btn.active {
    background: #fff;
    color: #000;
    border-color: #fff;
}

.page-info {
    color: #555;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
}

/* Loading */
.loading {
    text-align: center;
    padding: 3rem;
    color: #555;
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #333;
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 0.5rem;
}

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

/* No Results */
.no-results {
    text-align: center;
    padding: 3rem;
    color: #555;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    color: #333;
    font-size: 0.75rem;
    border-top: 1px solid #111;
    margin-top: 2rem;
}

footer a {
    color: #555;
    text-decoration: none;
}

footer a:hover {
    color: #888;
}

/* Semantic Search Indicator */
.search-indicator {
    text-align: center;
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: #0a0a0a;
    border-radius: 4px;
    display: none;
}

.search-indicator.visible {
    display: block;
}

.similarity-score {
    color: #f59e0b;
    font-size: 0.75rem;
    margin-left: 0.5rem;
}

/* Highlight matched text */
.highlight {
    background: #ca8a04;
    color: #000;
    padding: 0 2px;
    border-radius: 2px;
}

/* Responsive */
@media (max-width: 768px) {
    .ascii-logo {
        font-size: 0.35rem;
    }

    th, td {
        padding: 0.5rem 0.25rem;
    }

    .description {
        max-width: 150px;
    }

    .stats {
        gap: 1rem;
    }

    .tabs {
        gap: 1rem;
        overflow-x: auto;
    }

    .header-nav {
        position: static;
        justify-content: center;
        margin-bottom: 1rem;
    }
}
