/* News search feature styles */

/* Search bar area */
.news-search-container {
    background: var(--white, #fff);
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.news-search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--gray-lightest, #f5f5f5);
    border-radius: 24px;
    padding: 4px 8px 4px 16px;
    border: 2px solid transparent;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.news-search-bar:focus-within {
    border-color: var(--cl-hard, #26418f);
    box-shadow: 0 0 0 3px rgba(38, 65, 143, 0.1);
    background: var(--white, #fff);
}

.news-search-bar__icon {
    color: var(--gray-dark, #757575);
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.news-search-bar__icon .material-icons {
    font-size: 20px;
}

.news-search-bar__input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    padding: 10px 4px;
    color: var(--gray-darker, #212121);
    outline: none;
    font-family: 'Roboto', sans-serif;
}

.news-search-bar__input::placeholder {
    color: var(--gray-dark, #9e9e9e);
}

.news-search-bar__btn {
    background: var(--cl-hard, #26418f);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: background 0.2s;
    white-space: nowrap;
}

.news-search-bar__btn:hover {
    background: var(--cl-harder, #1a2e66);
}

.news-search-bar__btn .material-icons {
    font-size: 18px;
}

.news-clear-search-btn {
    background: none;
    color: var(--gray-dark, #757575);
    border: 1px solid var(--gray-light, #e0e0e0);
    border-radius: 20px;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    display: none;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
    white-space: nowrap;
}

.news-clear-search-btn:hover {
    background: var(--gray-lightest, #f5f5f5);
    border-color: var(--gray-dark, #bdbdbd);
}

.news-clear-search-btn .material-icons {
    font-size: 16px;
}

/* Scope and archive controls */
.news-search-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.news-search-scope {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--gray-dark, #616161);
    font-size: 13px;
}

.news-search-scope .material-icons {
    font-size: 16px;
    color: var(--cl-hard, #26418f);
}

.news-search-scope__label {
    font-weight: 500;
    color: var(--cl-hard, #26418f);
}

.news-archive-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--gray-dark, #616161);
    cursor: pointer;
}

.news-archive-toggle input[type="checkbox"] {
    accent-color: var(--cl-hard, #26418f);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.news-min-length-hint {
    display: none;
    margin-top: 8px;
    padding: 6px 12px;
    background: var(--cl-yellow-light, #fff8e1);
    border-radius: 4px;
    font-size: 12px;
    color: var(--gray-darker, #424242);
}

/* Search result banner */
.news-search-result-banner {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--cl-super-soft, #e8eaf6);
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--gray-darker, #37474f);
    flex-wrap: wrap;
    gap: 8px;
}

.news-search-result-banner .search-term {
    font-weight: 500;
    color: var(--cl-hard, #26418f);
}

.news-search-result-banner .result-count {
    background: var(--cl-hard, #26418f);
    color: white;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

/* News list */
.news-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* News card */
.news-item-card {
    background: var(--white, #fff);
    border-radius: 8px;
    padding: 16px 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.15s;
    border-left: 4px solid var(--cl-hard, #26418f);
}

.news-item-card:hover {
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.news-item-card--archived {
    border-left-color: var(--gray-light, #bdbdbd);
    opacity: 0.85;
}

.news-item-card__header {
    margin-bottom: 8px;
}

.news-item-card__meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.news-item-card__title {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 500;
    color: var(--gray-darker, #212121);
    line-height: 1.4;
}

.news-item-card__title mark {
    background: var(--cl-yellow-light, #fff176);
    color: inherit;
    padding: 1px 2px;
    border-radius: 2px;
}

.news-item-card__snippet {
    margin: 0 0 12px;
    font-size: 13px;
    color: var(--gray-dark, #616161);
    line-height: 1.5;
}

.news-item-card__snippet mark {
    background: var(--cl-yellow-light, #fff176);
    color: inherit;
    padding: 1px 2px;
    border-radius: 2px;
}

.news-item-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.news-item-card__author,
.news-item-card__date {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--gray-dark, #9e9e9e);
}

.news-item-card__author .material-icons,
.news-item-card__date .material-icons {
    font-size: 16px;
}

/* Context badges */
.news-context-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

.news-context-badge .material-icons {
    font-size: 14px;
}

.news-context-badge--org {
    background: var(--cl-super-soft, #e8eaf6);
    color: var(--cl-hard, #26418f);
}

.news-context-badge--school {
    background: #e8f5e9;
    color: #2e7d32;
}

.news-context-badge--class {
    background: #fff3e0;
    color: #e65100;
}

.news-archive-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    background: var(--gray-lightest, #f5f5f5);
    color: var(--gray-dark, #757575);
}

.news-archive-badge .material-icons {
    font-size: 13px;
}

.news-visibility {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    color: var(--gray-dark, #9e9e9e);
}

.news-visibility .material-icons {
    font-size: 14px;
}

/* Empty state */
.news-empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--gray-dark, #757575);
}

.news-empty-state .material-icons {
    font-size: 56px;
    color: var(--gray-light, #bdbdbd);
    margin-bottom: 16px;
}

.news-empty-state h3 {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 500;
    color: var(--gray-darker, #424242);
}

.news-empty-state p {
    margin: 0;
    font-size: 14px;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 16px 0;
}

.pagination-btn {
    min-width: 36px;
    height: 36px;
    border: 1px solid var(--gray-light, #e0e0e0);
    background: var(--white, #fff);
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-darker, #424242);
    transition: all 0.15s;
    padding: 0 8px;
}

.pagination-btn:hover {
    background: var(--gray-lightest, #f5f5f5);
    border-color: var(--gray-dark, #bdbdbd);
}

.pagination-btn--active {
    background: var(--cl-hard, #26418f);
    color: white;
    border-color: var(--cl-hard, #26418f);
}

.pagination-btn--active:hover {
    background: var(--cl-harder, #1a2e66);
}

.pagination-btn .material-icons {
    font-size: 20px;
}

.pagination-ellipsis {
    padding: 0 4px;
    color: var(--gray-dark, #9e9e9e);
}

/* News detail dialog */
.news-detail-dialog {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
}

.news-detail-dialog--open {
    display: flex;
    align-items: center;
    justify-content: center;
}

.news-detail__backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.news-detail__panel {
    position: relative;
    background: var(--white, #fff);
    border-radius: 12px;
    width: 90%;
    max-width: 680px;
    max-height: 85vh;
    overflow-y: auto;
    z-index: 1;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.news-detail__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px 24px 0;
    gap: 12px;
}

.news-detail__close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-dark, #757575);
    padding: 4px;
    border-radius: 50%;
    transition: background 0.2s;
    flex-shrink: 0;
}

.news-detail__close:hover {
    background: var(--gray-lightest, #f5f5f5);
}

.news-detail__title {
    margin: 0;
    font-size: 20px;
    font-weight: 500;
    color: var(--gray-darker, #212121);
    line-height: 1.4;
}

.news-detail__meta {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 24px;
    color: var(--gray-dark, #757575);
    font-size: 13px;
    flex-wrap: wrap;
}

.news-detail__meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.news-detail__meta-item .material-icons {
    font-size: 16px;
}

.news-detail__body {
    padding: 0 24px 24px;
    font-size: 14px;
    line-height: 1.7;
    color: var(--gray-darker, #37474f);
}

.news-detail__body p {
    margin: 0 0 12px;
}

/* Page header */
.news-page-header {
    margin-bottom: 20px;
}

.news-page-header h1 {
    margin: 0 0 4px;
    font-size: 22px;
    font-weight: 500;
    color: var(--gray-darker, #212121);
}

.news-page-header p {
    margin: 0;
    font-size: 14px;
    color: var(--gray-dark, #757575);
}

/* Admin-specific overrides */
.vk-admin .news-search-container {
    background: var(--admin-card-bg, #fff);
    border: 1px solid var(--admin-border, #e0e0e0);
}

.vk-admin .news-item-card {
    border: 1px solid var(--admin-border, #e0e0e0);
    border-left: 4px solid var(--admin-primary, #1565c0);
}

.vk-admin .news-item-card--archived {
    border-left-color: var(--gray-light, #bdbdbd);
}

/* Responsive */
@media (max-width: 599px) {
    .news-search-bar {
        flex-wrap: wrap;
    }

    .news-search-bar__input {
        min-width: 100px;
    }

    .news-search-options {
        flex-direction: column;
        align-items: flex-start;
    }

    .news-item-card {
        padding: 12px 16px;
    }

    .news-item-card__footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .news-detail__panel {
        width: 96%;
        max-height: 92vh;
        border-radius: 8px;
    }
}

/* Dark mode overrides */
body.dark-mode .news-search-container {
    background: var(--dm-surface, #1e1e1e);
}

body.dark-mode .news-search-bar {
    background: var(--dm-surface-variant, #2d2d2d);
}

body.dark-mode .news-search-bar:focus-within {
    background: var(--dm-surface, #1e1e1e);
    border-color: var(--cl-soft, #7986cb);
}

body.dark-mode .news-search-bar__input {
    color: var(--dm-text-primary, #e0e0e0);
}

body.dark-mode .news-item-card {
    background: var(--dm-surface, #1e1e1e);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

body.dark-mode .news-item-card__title {
    color: var(--dm-text-primary, #e0e0e0);
}

body.dark-mode .news-item-card__snippet {
    color: var(--dm-text-secondary, #aaa);
}

body.dark-mode .news-search-result-banner {
    background: var(--dm-surface-variant, #2d2d2d);
    color: var(--dm-text-primary, #e0e0e0);
}

body.dark-mode .news-detail__panel {
    background: var(--dm-surface, #1e1e1e);
}

body.dark-mode .news-detail__title,
body.dark-mode .news-detail__body {
    color: var(--dm-text-primary, #e0e0e0);
}

body.dark-mode .news-empty-state h3 {
    color: var(--dm-text-primary, #e0e0e0);
}

body.dark-mode .news-context-badge--org {
    background: rgba(38, 65, 143, 0.2);
}

body.dark-mode .news-context-badge--school {
    background: rgba(46, 125, 50, 0.2);
}

body.dark-mode .news-context-badge--class {
    background: rgba(230, 81, 0, 0.2);
}

body.dark-mode .pagination-btn {
    background: var(--dm-surface, #1e1e1e);
    border-color: var(--dm-border, #444);
    color: var(--dm-text-primary, #e0e0e0);
}
