/* ========================================
   KEYWORDS PAGE STYLES
   Styles for the interactive keywords browser
   ======================================== */

/* MARK: - Page Layout */
.keywords-main {
    padding: 40px var(--section-padding-x);
    min-height: 600px;
    background: transparent;
}

.keywords-page-header {
    text-align: center;
    margin-bottom: 40px;
}

.keywords-page-header p {
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.6;
    color: var(--color-text-muted);
}

/* MARK: - Search and Filter Controls */
.keywords-controls {
    margin-bottom: 32px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.keywords-search input {
    width: 100%;
    padding: 14px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: #fff;
}

.keywords-search input:focus {
    outline: none;
    border-color: #007CBA;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.15);
}

.keywords-search input::placeholder {
    color: #999;
}

.keywords-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.filter-btn {
    padding: 8px 18px;
    border: 2px solid #e0e0e0;
    background: #fff;
    color: #666;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border-radius: 24px;
    transition: all 0.2s ease;
}

.filter-btn:hover {
    border-color: #007CBA;
    color: #007CBA;
    background: #F0F7FF;
}

.filter-btn.active {
    background: #003A70;
    border-color: #003A70;
    color: #fff;
}

.keywords-count {
    font-size: 14px;
    color: var(--color-text-subtle);
    font-weight: 600;
}

/* MARK: - Keyword Cards */
.keywords-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.keyword-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.2s ease, border-color 0.2s ease, background-color 0.5s ease;
}

.keyword-card:hover {
    box-shadow: 0 2px 12px rgba(0, 58, 112, 0.1);
    border-color: #ccc;
}

/* Highlight animation for scroll-to-keyword */
.keyword-card.highlighted {
    background-color: #F0F7FF;
    border-color: #007CBA;
    box-shadow: 0 4px 16px rgba(0, 124, 186, 0.2);
}

/* MARK: - Card Header (collapsed view) */
.keyword-card-header {
    padding: 20px 24px;
    cursor: pointer;
    position: relative;
    user-select: none;
}

.keyword-card-header:hover {
    background: #FAFAFA;
}

.keyword-card-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.keyword-card-title h3 {
    font-size: 1.15em;
    font-weight: 700;
    color: #003A70;
    margin: 0;
}

.keyword-card-tooltip {
    font-size: 14px;
    line-height: 1.6;
    color: #757575;
    margin: 0;
    padding-right: 32px;
}

/* MARK: - Category Badges */
.category-badge {
    display: inline-block;
    padding: 3px 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 12px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Category-specific colors */
.category-cognitive {
    background: #E8F5E9;
    color: #2E7D32;
}

.category-risk {
    background: #FFF3E0;
    color: #E65100;
}

.category-technology {
    background: #E3F2FD;
    color: #1565C0;
}

.category-bias {
    background: #FCE4EC;
    color: #AD1457;
}

.category-educational {
    background: #F3E5F5;
    color: #6A1B9A;
}

.category-framework {
    background: #E0F2F1;
    color: #00695C;
}

.category-model_output {
    background: #FFF8E1;
    color: #F57F17;
}

.category-assessment {
    background: #E8EAF6;
    color: #283593;
}

.category-other {
    background: #F5F5F5;
    color: #616161;
}

/* MARK: - Expand/Collapse Icon */
.expand-icon {
    position: absolute;
    top: 24px;
    right: 24px;
    font-size: 12px;
    color: #999;
    transition: transform 0.3s ease;
}

.keyword-card.expanded .expand-icon {
    transform: rotate(180deg);
}

/* MARK: - Card Details (expanded view) */
.keyword-card-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
    border-top: 0 solid #e0e0e0;
}

.keyword-card.expanded .keyword-card-details {
    max-height: 1200px;
    border-top: 1px solid #e0e0e0;
}

.keyword-detail-section {
    padding: 20px 24px;
}

.keyword-detail-section + .keyword-detail-section {
    border-top: 1px solid #f0f0f0;
}

.keyword-detail-section h4 {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #003A70;
    margin-bottom: 12px;
}

.keyword-detail-section p {
    font-size: 14px;
    line-height: 1.7;
    color: #333;
}

/* MARK: - Source Citations in Details */
.keyword-sources-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.keyword-source-item {
    padding: 12px 16px;
    margin-bottom: 8px;
    background: #FAFAFA;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.6;
    color: #555;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.keyword-source-item:last-child {
    margin-bottom: 0;
}

.source-citation {
    flex: 1;
}

.source-doi {
    display: inline-block;
    padding: 4px 10px;
    background: #003A70;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
    border-radius: 4px;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.2s ease;
}

.source-doi:hover {
    background: #004A8A;
    color: #fff;
    text-decoration: none;
}

/* MARK: - Related Keywords */
.related-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.related-keyword-tag {
    display: inline-block;
    padding: 6px 14px;
    border: 1px solid #007CBA;
    background: #F0F7FF;
    color: #007CBA;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.related-keyword-tag:hover {
    background: #007CBA;
    color: #fff;
}

/* MARK: - Empty State */
.keywords-empty {
    text-align: center;
    padding: 60px var(--section-padding-x);
    color: var(--color-text-subtle);
    font-size: 16px;
}

.no-keywords {
    text-align: center;
    padding: 60px var(--section-padding-x);
    color: var(--color-text-subtle);
    font-size: 16px;
}

/* MARK: - Responsive */
@media (max-width: 868px) {
    .keywords-main {
        padding: 24px var(--section-padding-x);
    }

    .keyword-card-title {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .keywords-filters {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
    }

    .filter-btn {
        flex-shrink: 0;
    }

    .keyword-source-item {
        flex-direction: column;
        gap: 8px;
    }

    .source-doi {
        align-self: flex-start;
    }
}
