/**
 * AIDB Skill Library - Frontend Styles
 */

/* ========== Container ========== */
.aidb-sl-library {
    max-width: 1200px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* ========== Header ========== */
.aidb-sl-header {
    text-align: center;
    margin-bottom: 32px;
    padding: 36px 24px;
    background: linear-gradient(135deg, #0a0a0a 0%, #1c1c1c 50%, #111 100%);
    border-radius: 12px;
    position: relative;
    overflow: hidden;
}

.aidb-sl-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.04) 0%, transparent 50%),
                radial-gradient(circle at 80% 50%, rgba(255, 255, 255, 0.02) 0%, transparent 50%);
    pointer-events: none;
}

.aidb-sl-header-text {
    position: relative;
    z-index: 1;
}

.aidb-sl-title {
    font-size: 26px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 6px 0;
    letter-spacing: 0.02em;
}

.aidb-sl-subtitle {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.55);
    margin: 0;
}

.aidb-sl-premium-notice {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.75);
    font-size: 12px;
    position: relative;
    z-index: 1;
}

.aidb-sl-lock-icon {
    font-size: 14px;
}

/* ========== Filters ========== */
.aidb-sl-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.aidb-sl-search-wrap {
    flex: 1;
    min-width: 180px;
}

.aidb-sl-search {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #d4d4d4;
    border-radius: 8px;
    font-size: 13px;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
    box-sizing: border-box;
}

.aidb-sl-search:focus {
    outline: none;
    border-color: #1a1a1a;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);
}

.aidb-sl-filter-controls {
    display: flex;
    gap: 8px;
}

.aidb-sl-filter-category,
.aidb-sl-filter-difficulty {
    padding: 10px 14px;
    border: 1px solid #d4d4d4;
    border-radius: 8px;
    font-size: 13px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s;
    -webkit-appearance: none;
    appearance: none;
    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='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
}

.aidb-sl-filter-category:focus,
.aidb-sl-filter-difficulty:focus {
    outline: none;
    border-color: #1a1a1a;
}

/* ========== Grid ========== */
.aidb-sl-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

@media (max-width: 768px) {
    .aidb-sl-grid {
        grid-template-columns: 1fr;
    }
}

.aidb-sl-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 48px 20px;
    color: #888;
    font-size: 14px;
}

.aidb-sl-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 48px 20px;
    color: #999;
}

.aidb-sl-empty-icon {
    font-size: 40px;
    margin-bottom: 10px;
    opacity: 0.4;
}

/* ========== Skill Card ========== */
.aidb-sl-card {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.aidb-sl-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    border-color: #d0d0d0;
}

.aidb-sl-card.is-featured {
    border-color: #1a1a1a;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

/* Card body */
.aidb-sl-card-body {
    padding: 18px 18px 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Card header: emoji + meta badges */
.aidb-sl-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.aidb-sl-card-emoji {
    font-size: 28px;
    line-height: 1;
    flex-shrink: 0;
}

.aidb-sl-card-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.aidb-sl-card-category {
    display: inline-block;
    padding: 2px 8px;
    background: #f0f0f0;
    color: #555;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.aidb-sl-card-difficulty {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}

.aidb-sl-card-difficulty.beginner {
    background: #e8f5e9;
    color: #2e7d32;
}

.aidb-sl-card-difficulty.intermediate {
    background: #fff3e0;
    color: #e65100;
}

.aidb-sl-card-difficulty.advanced {
    background: #1a1a1a;
    color: #fff;
}

.aidb-sl-card-featured-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #fffde7;
    color: #f9a825;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}

/* Card title */
.aidb-sl-card-title {
    font-size: 15px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 8px 0;
    line-height: 1.4;
}

/* Card description */
.aidb-sl-card-description {
    font-size: 13px;
    color: #555;
    line-height: 1.65;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    cursor: pointer;
    transition: max-height 0.3s ease;
}

.aidb-sl-card.is-expanded .aidb-sl-card-description {
    display: block;
    -webkit-line-clamp: unset;
    overflow: visible;
}

.aidb-sl-card {
    cursor: pointer;
}

/* Card tags */
.aidb-sl-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 12px;
}

.aidb-sl-card-tag {
    padding: 2px 8px;
    background: #f5f5f5;
    color: #888;
    border-radius: 10px;
    font-size: 10px;
}

/* Spacer pushes footer to bottom */
.aidb-sl-card-spacer {
    flex: 1;
}

/* Card references - compact chip-style links */
.aidb-sl-card-refs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.aidb-sl-card-ref {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 8px;
    background: #f8f8f8;
    border: 1px solid #eee;
    border-radius: 4px;
    font-size: 10px;
    color: #888;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    cursor: default;
}

a.aidb-sl-card-ref {
    cursor: pointer;
}

a.aidb-sl-card-ref:hover {
    background: #eee;
    color: #555;
    text-decoration: none;
}

/* Card footer */
.aidb-sl-card-footer {
    display: flex;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

.aidb-sl-btn-copy {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 1;
    padding: 9px 16px;
    background: #fff;
    color: #1a1a1a;
    border: 1px solid #d0d0d0;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    text-decoration: none;
}

.aidb-sl-btn-copy:hover {
    background: #f5f5f5;
    transform: translateY(-1px);
}

.aidb-sl-btn-copy:active {
    transform: translateY(0);
}

.aidb-sl-btn-download {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 1;
    padding: 9px 16px;
    background: #1a1a1a;
    color: #fff;
    border: none;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    text-decoration: none;
}

.aidb-sl-btn-download:hover {
    background: #333;
    transform: translateY(-1px);
}

.aidb-sl-btn-download:active {
    transform: translateY(0);
}

.aidb-sl-btn-download.disabled {
    width: 100%;
    background: #e0e0e0;
    color: #999;
    border-color: #e0e0e0;
    cursor: not-allowed;
}

.aidb-sl-btn-download.disabled:hover {
    background: #e0e0e0;
    transform: none;
}

/* ========== Pagination ========== */
.aidb-sl-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-top: 24px;
    margin-bottom: 16px;
}

.aidb-sl-pagination button {
    padding: 8px 14px;
    border: 1px solid #d4d4d4;
    background: #fff;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    color: #333;
}

.aidb-sl-pagination button:hover {
    border-color: #1a1a1a;
    color: #1a1a1a;
}

.aidb-sl-pagination button.active {
    background: #1a1a1a;
    color: #fff;
    border-color: #1a1a1a;
}

.aidb-sl-pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.aidb-sl-pagination-info {
    font-size: 12px;
    color: #888;
    padding: 0 6px;
}

/* ========== Responsive ========== */
@media (max-width: 600px) {
    .aidb-sl-header {
        padding: 28px 16px;
    }

    .aidb-sl-title {
        font-size: 22px;
    }

    .aidb-sl-filters {
        flex-direction: column;
    }

    .aidb-sl-filter-controls {
        width: 100%;
    }

    .aidb-sl-filter-category,
    .aidb-sl-filter-difficulty {
        flex: 1;
    }

    .aidb-sl-grid {
        grid-template-columns: 1fr;
    }
}

/* ========== Toast notification ========== */
.aidb-sl-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #1a1a1a;
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 13px;
    z-index: 10000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s;
}

.aidb-sl-toast.show {
    transform: translateY(0);
    opacity: 1;
}

.aidb-sl-toast.success {
    background: #1a1a1a;
}

.aidb-sl-toast.error {
    background: #d63638;
}

/* ========== Latest Skills Shortcode (compact, mobile-first) ========== */
/* Note: same rules exist in frontend-latest.css for inline injection */

.aidb-sl-latest {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 0 16px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.aidb-sl-latest-title {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 12px 0;
    padding-left: 2px;
}

.aidb-sl-latest-grid {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    margin-bottom: 16px;
    scrollbar-width: none;
}
.aidb-sl-latest-grid::-webkit-scrollbar {
    display: none;
}

.aidb-sl-latest-card {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    width: 220px;
    scroll-snap-align: start;
    transition: box-shadow 0.2s;
}

.aidb-sl-latest-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.07);
    border-color: #d0d0d0;
}

.aidb-sl-latest-card-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.aidb-sl-latest-card-emoji {
    font-size: 20px;
    line-height: 1;
    flex-shrink: 0;
}

.aidb-sl-latest-card-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.aidb-sl-latest-card-category {
    display: inline-block;
    padding: 1px 6px;
    background: #f0f0f0;
    color: #666;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.aidb-sl-latest-card-difficulty {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 600;
}

.aidb-sl-latest-card-difficulty.beginner {
    background: #e8f5e9;
    color: #2e7d32;
}

.aidb-sl-latest-card-difficulty.intermediate {
    background: #fff3e0;
    color: #e65100;
}

.aidb-sl-latest-card-difficulty.advanced {
    background: #1a1a1a;
    color: #fff;
}

.aidb-sl-latest-card-title {
    font-size: 13px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 4px 0;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.aidb-sl-latest-card-desc {
    font-size: 11px;
    color: #777;
    line-height: 1.5;
    margin: 0 0 8px 0;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.aidb-sl-latest-cta {
    text-align: right;
    margin-top: 12px;
}

.aidb-sl-latest-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 10px 24px;
    background: #1a1a1a;
    color: #fff;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s;
}

.aidb-sl-latest-link:hover {
    background: #333;
    color: #fff;
    text-decoration: none;
}

@media (min-width: 768px) {
    .aidb-sl-latest {
        padding: 32px 0 20px;
    }

    .aidb-sl-latest-title {
        font-size: 20px;
        margin-bottom: 16px;
    }

    .aidb-sl-latest-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 14px;
        overflow: visible;
    }

    .aidb-sl-latest-card {
        width: auto;
        padding: 16px;
        border-radius: 10px;
    }

    .aidb-sl-latest-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    }

    .aidb-sl-latest-card-emoji {
        font-size: 24px;
    }

    .aidb-sl-latest-card-category {
        font-size: 10px;
        padding: 2px 7px;
    }

    .aidb-sl-latest-card-difficulty {
        font-size: 10px;
        padding: 2px 7px;
    }

    .aidb-sl-latest-card-title {
        font-size: 14px;
        margin-bottom: 6px;
    }

    .aidb-sl-latest-card-desc {
        font-size: 12px;
        -webkit-line-clamp: 3;
    }

    .aidb-sl-latest-link {
        padding: 11px 28px;
        font-size: 14px;
    }
}

/* ========== Single Skill Card Embed (compact, mobile-first) ========== */

.aidb-sl-embed {
    max-width: 480px;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.aidb-sl-embed-label {
    font-size: 11px;
    font-weight: 700;
    color: #1a1a1a;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
    padding-left: 1px;
}

.aidb-sl-embed-card {
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 14px;
}

.aidb-sl-embed-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.aidb-sl-embed-emoji {
    font-size: 16px;
    line-height: 1;
    flex-shrink: 0;
}

.aidb-sl-embed-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.aidb-sl-embed-category {
    display: inline-block;
    padding: 1px 6px;
    background: #eee;
    color: #777;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.aidb-sl-embed-difficulty {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 600;
}

.aidb-sl-embed-difficulty.beginner {
    background: #e8f5e9;
    color: #2e7d32;
}

.aidb-sl-embed-difficulty.intermediate {
    background: #fff3e0;
    color: #e65100;
}

.aidb-sl-embed-difficulty.advanced {
    background: #1a1a1a;
    color: #fff;
}

.aidb-sl-embed-title {
    font-size: 13px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 4px 0;
    line-height: 1.35;
}

.aidb-sl-embed-desc {
    font-size: 12px;
    color: #777;
    line-height: 1.5;
    margin: 0 0 8px 0;
}

.aidb-sl-embed-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-bottom: 8px;
}

.aidb-sl-embed-tag {
    display: inline-block;
    padding: 1px 6px;
    background: #f0f0f0;
    color: #999;
    border-radius: 3px;
    font-size: 9px;
}

.aidb-sl-embed-refs {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}

.aidb-sl-embed-ref {
    display: inline-block;
    padding: 3px 8px;
    background: #f0f0f0;
    color: #666;
    border-radius: 4px;
    font-size: 10px;
    text-decoration: none;
    transition: background 0.15s;
}

a.aidb-sl-embed-ref:hover {
    background: #e5e5e5;
    color: #333;
    text-decoration: none;
}

.aidb-sl-embed-footer {
    border-top: 1px solid #eee;
    padding-top: 10px;
}

.aidb-sl-embed-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.aidb-sl-embed-footer .aidb-sl-btn-copy {
    display: block;
    flex: 1;
    padding: 8px;
    background: #fff;
    color: #1a1a1a;
    border: 1px solid #d0d0d0;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    text-align: center;
}

.aidb-sl-embed-footer .aidb-sl-btn-copy:hover {
    background: #f5f5f5;
}

.aidb-sl-embed-footer .aidb-sl-btn-download {
    display: block;
    flex: 1;
    padding: 8px;
    background: #1a1a1a;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    text-align: center;
}

.aidb-sl-embed-footer .aidb-sl-btn-download:hover {
    background: #f5f5f5;
}

.aidb-sl-embed-lock {
    display: block;
    text-align: center;
    padding: 8px;
    background: #f0f0f0;
    color: #aaa;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 600;
}

.aidb-sl-embed-library-link {
    display: block;
    text-align: right;
    margin-top: 8px;
    font-size: 11px;
    color: #999;
    text-decoration: none;
}

.aidb-sl-embed-library-link:hover {
    color: #555;
    text-decoration: none;
}

@media (min-width: 768px) {
    .aidb-sl-embed-card {
        padding: 16px;
    }

    .aidb-sl-embed-title {
        font-size: 14px;
    }
}
