/* ===================================================================
   SEARCH UI — Desktop popup + Mobile bar + Search Results Page
   =================================================================== */

/* ---------- DESKTOP: Search Popup Panel ---------- */
#desktop-search-panel {
    position: absolute;
    right: 0;
    top: 100%;
    z-index: 1050;
    width: 380px;
    padding: 12px;
    background: #fff;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 6px 24px rgba(0,0,0,.15);
    animation: fadeSlideDown .2s ease;
}

@keyframes fadeSlideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.desktop-search-inner {
    display: flex;
    border: 2px solid #0056b3;
    border-radius: 6px;
    overflow: hidden;
}

.desktop-search-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 10px 14px;
    font-size: 15px;
    color: #333;
}

.desktop-search-btn {
    border: none;
    background: #0056b3;
    color: #fff;
    padding: 10px 16px;
    font-size: 16px;
    cursor: pointer;
    transition: background .2s;
}
.desktop-search-btn:hover { background: #003d80; }

/* ---------- MOBILE: Search Bar Row ---------- */
.mobile-search-row {
    width: 100%;
    padding: 6px 10px;
    gap: 8px;
}

.mobile-search-form {
    flex: 1;
}

.mobile-search-wrap {
    display: flex;
    border: 2px solid #d9534f;
    border-radius: 25px;
    overflow: hidden;
    background: #fff;
}

.mobile-search-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 8px 14px;
    font-size: 14px;
    color: #333;
    background: transparent;
    min-width: 0;
}

.mobile-search-btn {
    border: none;
    background: #d9534f;
    color: #fff;
    padding: 8px 16px;
    font-size: 15px;
    cursor: pointer;
    flex-shrink: 0;
}

/* ---------- SEARCH RESULTS PAGE ---------- */

.search-results-header {
    background: linear-gradient(135deg, #0056b3 0%, #0074e4 100%);
    color: #fff;
    padding: 24px 28px;
    border-radius: 3px;
    margin-bottom: 24px;
}

.search-results-header h2 {
    margin: 0 0 6px;
    font-size: 22px;
    font-weight: 700;
}

.search-results-header p {
    margin: 0;
    font-size: 14px;
    opacity: .85;
}

/* Search box trên trang kết quả */
.search-page-form {
    display: flex;
    border: 1px solid #0056b3;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 20px;
    max-width: 600px;
}

.search-page-form input[type="text"] {
    flex: 1;
    border: none;
    outline: none;
    padding: 10px 14px;
    font-size: 15px;
}

.search-page-form button {
    border: none;
    background: #0056b3;
    color: #fff;
    padding: 10px 18px;
    font-size: 15px;
    cursor: pointer;
    transition: background .2s;
}
.search-page-form button:hover { background: #003d80; }

/* Result item */
.result-item {
    display: flex;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid #e8e8e8;
    transition: background .15s;
}
.result-item:hover { background: #f8fafe; }

.result-item .img-item {
    flex-shrink: 0;
    width: 300px;
    height: 180px;
    border-radius: 4px;
    overflow: hidden;
    background: #eee;
}

.result-item .img-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.result-item .text-item {
    flex: 1;
    min-width: 0;
}

.result-item .text-item h2 {
    font-size: 17px;
    font-weight: 600;
    margin: 0 0 6px;
    line-height: 1.4;
}

.result-item .text-item h2 a {
    color: #0056b3;
    text-decoration: none;
    transition: color .2s;
}
.result-item .text-item h2 a:hover { color: #003d80; text-decoration: underline; }

.result-item .text-item p {
    font-size: 14px;
    color: #555;
    line-height: 1.6;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

    /* Highlight từ khóa */
    .result-item .text-item mark,
    .result-item .text-item .highlight {
        background: #fff3cd;
        color: #333;
        padding: 0;
        margin: 0;
        border-radius: 2px;
        font-weight: 600;
        box-decoration-break: clone;
        -webkit-box-decoration-break: clone;
    }

/* No-image fallback */
.result-item.no-image .text-item {
    padding-left: 0;
}

/* ---------- PAGINATION ---------- */
.pagination-wrap {
    margin: 28px 0 12px;
    text-align: center;
}

.pagination-wrap .pagination {
    display: inline-flex;
    gap: 4px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.pagination-wrap .pagination li a,
.pagination-wrap .pagination li span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    color: #0056b3;
    font-size: 14px;
    text-decoration: none;
    transition: all .15s;
}

.pagination-wrap .pagination li a:hover {
    background: #0056b3;
    color: #fff;
    border-color: #0056b3;
}

.pagination-wrap .pagination li.active span,
.pagination-wrap .pagination li.active a {
    background: #0056b3;
    color: #fff;
    border-color: #0056b3;
    font-weight: 700;
}

.pagination-wrap .pagination li.disabled span,
.pagination-wrap .pagination li.disabled a {
    color: #ccc;
    pointer-events: none;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 991px) {
    #desktop-search-panel { display: none !important; }
    #desktop-search-toggle { display: none !important; }

    .result-item .img-item {
        width: 100px;
        height: 70px;
    }

    .result-item .text-item h2 { font-size: 15px; }
    .result-item .text-item p { font-size: 13px; -webkit-line-clamp: 2; }
}

@media (min-width: 992px) {
    .mobile-search-row { display: none !important; }
}

@media (max-width: 480px) {
    .result-item {
        flex-direction: column;
        gap: 10px;
    }
    .result-item .img-item {
        width: 100%;
        height: 180px;
    }
}


/* ---------- TOAST THÔNG BÁO ---------- */
.search-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: #d9534f;
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 16px rgba(0,0,0,.2);
    z-index: 9999;
    opacity: 0;
    transition: opacity .3s, transform .3s;
    white-space: nowrap;
}

    .search-toast.show {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }

.news-datetime {
    font-size: 13px;
    color: #888 !important;
    display: block;
    margin-top: 4px;
}