/**
 * Morlok KB Frontend Styles
 */

/* =========================================================================
   Login Prompt
   ========================================================================= */

.kb-login-prompt {
    text-align: center;
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.kb-login-prompt__button {
    display: inline-block;
    padding: 10px 24px;
    background: #2271b1;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    margin-top: 10px;
    transition: background 0.2s;
}

.kb-login-prompt__button:hover {
    background: #135e96;
    color: #fff;
}

/* =========================================================================
   Notice
   ========================================================================= */

.kb-notice {
    padding: 16px 20px;
    background: #f0f0f1;
    border-left: 4px solid #72aee6;
    border-radius: 4px;
    margin: 16px 0;
    color: #50575e;
}

/* =========================================================================
   Breadcrumbs
   ========================================================================= */

.kb-breadcrumbs {
    margin: 0 0 20px;
    font-size: 0.85em;
    color: #757575;
    line-height: 1.4;
}

.kb-breadcrumbs a {
    color: #2271b1;
    text-decoration: none;
}

.kb-breadcrumbs a:hover {
    color: #135e96;
    text-decoration: underline;
}

.kb-breadcrumbs__sep {
    margin: 0 5px;
    color: #c3c4c7;
}

.kb-breadcrumbs__current {
    color: #1e1e1e;
    font-weight: 600;
}

/* =========================================================================
   Tiles
   ========================================================================= */

.kb-tiles {
    display: grid;
    gap: 20px;
    margin: 20px 0;
}

.kb-tiles--cols-2 { grid-template-columns: repeat(2, 1fr); }
.kb-tiles--cols-3 { grid-template-columns: repeat(3, 1fr); }
.kb-tiles--cols-4 { grid-template-columns: repeat(4, 1fr); }
.kb-tiles--cols-5 { grid-template-columns: repeat(5, 1fr); }
.kb-tiles--cols-6 { grid-template-columns: repeat(6, 1fr); }

@media (max-width: 768px) {
    .kb-tiles {
        grid-template-columns: 1fr !important;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .kb-tiles--cols-4,
    .kb-tiles--cols-5,
    .kb-tiles--cols-6 {
        grid-template-columns: repeat(2, 1fr);
    }
}

.kb-tile {
    background: #fff;
    border: 1px solid #e2e4e7;
    border-radius: 8px;
    transition: box-shadow 0.2s, border-color 0.2s;
    overflow: hidden;
}

.kb-tile:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: #2271b1;
}

.kb-tile__link {
    display: block;
    padding: 24px;
    color: inherit;
    text-decoration: none;
}

.kb-tile__title {
    margin: 0 0 8px;
    font-size: 1.1em;
    font-weight: 600;
    color: #1e1e1e;
}

.kb-tile__desc {
    margin: 0 0 12px;
    font-size: 0.9em;
    color: #757575;
    line-height: 1.5;
}

.kb-tile__meta {
    display: block;
    font-size: 0.8em;
    color: #999;
}

/* =========================================================================
   Tree Navigation
   ========================================================================= */

.kb-tree {
    margin: 20px 0;
}

.kb-tree__list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.kb-tree__list .kb-tree__list {
    padding-left: 20px;
    margin-top: 4px;
}

.kb-tree__item {
    position: relative;
    margin-bottom: 2px;
}

.kb-tree__toggle {
    position: absolute;
    left: -4px;
    top: 4px;
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 10px;
    color: #757575;
    line-height: 20px;
    text-align: center;
    transition: transform 0.2s;
}

.kb-tree__toggle[aria-expanded="false"] .kb-tree__arrow {
    display: inline-block;
    transform: rotate(-90deg);
}

.kb-tree__item--has-children > .kb-tree__link {
    padding-left: 20px;
}

.kb-tree__link {
    display: block;
    padding: 6px 8px;
    color: #1e1e1e;
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.15s;
    font-size: 0.95em;
}

.kb-tree__link:hover {
    background: #f0f0f1;
    color: #2271b1;
}

.kb-tree__count {
    color: #999;
    font-size: 0.85em;
}

/* =========================================================================
   Recent Articles
   ========================================================================= */

.kb-recent {
    margin: 20px 0;
}

.kb-recent__list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.kb-recent__item {
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f1;
}

.kb-recent__item:last-child {
    border-bottom: none;
}

.kb-recent__link {
    color: #1e1e1e;
    text-decoration: none;
    font-weight: 500;
    font-size: 1em;
    transition: color 0.15s;
}

.kb-recent__link:hover {
    color: #2271b1;
}

.kb-recent__meta {
    display: block;
    font-size: 0.85em;
    color: #757575;
    margin-top: 4px;
}

.kb-recent__area {
    color: #2271b1;
}

.kb-recent__excerpt {
    margin: 6px 0 0;
    font-size: 0.9em;
    color: #50575e;
    line-height: 1.5;
}

/* =========================================================================
   Search
   ========================================================================= */

.kb-search {
    margin: 20px 0;
}

.kb-search__form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-start;
}

.kb-search__input-wrap {
    flex: 1 1 300px;
    position: relative;
}

.kb-search__input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e2e4e7;
    border-radius: 6px;
    font-size: 1em;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.kb-search__input:focus {
    outline: none;
    border-color: #2271b1;
}

.kb-search__filters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.kb-search__filter {
    padding: 10px 12px;
    border: 2px solid #e2e4e7;
    border-radius: 6px;
    font-size: 0.9em;
    background: #fff;
}

.kb-search__submit {
    padding: 10px 24px;
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.kb-search__submit:hover {
    background: #135e96;
}

/* Autocomplete Dropdown */
.kb-search__autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    background: #fff;
    border: 1px solid #e2e4e7;
    border-top: none;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-height: 320px;
    overflow-y: auto;
}

.kb-autocomplete__item {
    display: block;
    padding: 10px 14px;
    color: #1e1e1e;
    text-decoration: none;
    border-bottom: 1px solid #f5f5f5;
    transition: background 0.1s;
}

.kb-autocomplete__item:last-child {
    border-bottom: none;
}

.kb-autocomplete__item:hover,
.kb-autocomplete__item--active {
    background: #f0f6fc;
}

.kb-autocomplete__title {
    font-weight: 500;
    font-size: 0.95em;
}

.kb-autocomplete__snippet {
    font-size: 0.8em;
    color: #757575;
    margin-top: 2px;
}

/* Search Results */
.kb-search__results {
    margin-top: 20px;
}

.kb-result {
    padding: 16px 0;
    border-bottom: 1px solid #f0f0f1;
}

.kb-result:last-child {
    border-bottom: none;
}

.kb-result__title {
    margin: 0 0 4px;
    font-size: 1.1em;
}

.kb-result__title a {
    color: #1e1e1e;
    text-decoration: none;
}

.kb-result__title a:hover {
    color: #2271b1;
}

.kb-result__meta {
    font-size: 0.8em;
    color: #999;
    margin-bottom: 6px;
}

.kb-result__excerpt {
    font-size: 0.9em;
    color: #50575e;
    line-height: 1.5;
    margin: 0;
}

.kb-highlight {
    background: #fff3cd;
    padding: 1px 2px;
    border-radius: 2px;
}

.kb-search__loading {
    text-align: center;
    padding: 20px;
    color: #757575;
}

.kb-search__pagination {
    text-align: center;
    padding: 20px 0;
}

.kb-search__load-more {
    padding: 8px 20px;
    background: #f0f0f1;
    border: 1px solid #e2e4e7;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.kb-search__load-more:hover {
    background: #e2e4e7;
}

/* =========================================================================
   Article List
   ========================================================================= */

.kb-article-list {
    margin: 20px 0;
}

.kb-article-list__items {
    list-style: none;
    padding: 0;
    margin: 0;
}

.kb-article-list__item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f1;
    gap: 12px;
}

.kb-article-list__item:last-child {
    border-bottom: none;
}

.kb-article-list__item a {
    color: #1e1e1e;
    text-decoration: none;
    font-weight: 500;
    flex: 1;
}

.kb-article-list__item a:hover {
    color: #2271b1;
}

.kb-article-list__date {
    font-size: 0.85em;
    color: #999;
    white-space: nowrap;
}
