/**
 * CSS cho plugin Tìm kiếm nâng cao
 */

/* Container chính */
.tknk-search-container {
    max-width: 100%;
    position: relative;
}

/* Form tìm kiếm */
.tknk-search-form {
    position: relative;
    border: 1px solid #d8d8d8;
    z-index: 10;
}


.tknk-search-form input[type="text"]::placeholder {
    color: #666;
    font-style: italic;
}

/* Loading animation */
.tknk-loading {
    text-align: center;
    padding: 40px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    margin-top: 10px;
}

.tknk-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    margin-bottom: 15px;
}

.spinner {
    width: 100%;
    height: 100%;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.tknk-loading p {
    color: #666;
    font-size: 16px;
    margin: 0;
}

/* Results - Floating */
.tknk-results {
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    margin-top: 10px;
    max-height: 400px;
    overflow-y: auto;
    animation: slideDown 0.3s ease-out;
}

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

.tknk-results-header {
    background:#fff;
    padding: 7px 20px;
    text-align: center;
    position: sticky;
    top: 0;
    border-bottom:1px solid #d8d8d8;
    z-index: 1;
}

.tknk-results-header .s-title{
    margin: 0;
    font-size: 14px;
}

.tknk-results-list {
    padding: 0;
}

.tknk-result-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 20px;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.3s ease;
    cursor: pointer;
    background: transparent;
}

.tknk-result-item:last-child {
    border-bottom: none;
}


.tknk-result-thumbnail {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    overflow: hidden;
    border-radius: 8px;
    background: #f3f3f3;
    display: flex;
    align-items: center;
    justify-content: center;
}
.tknk-result-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}
.tknk-result-item:hover .tknk-result-thumbnail img,
.tknk-result-item.focused .tknk-result-thumbnail img {
    transform: scale(1.08);
}

.tknk-result-content {
    min-width: 0;
    flex: 1;
}

.tknk-result-content h4 {
    margin: 0;
    font-size: 16px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #333;
    font-weight: 500;
}

.tknk-result-category {
    font-size: 13px;
    color: #764ba2;
    font-weight: 600;
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.85;
}

.tknk-result-taxonomies {
    margin-top: 3px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.tknk-taxonomy {
    display: inline-block;
    background: #f3f3f3;
    color: #333;
    font-size: 12px;
    border-radius: 6px;
    padding: 2px 8px;
    margin-right: 2px;
    font-weight: 500;
}
.tknk-taxonomy.tknk-so-dang-ky {
    background: #e0e7ff;
    color: #3b3b8f;
}
.tknk-taxonomy.tknk-quy-cach {
    background: #ffe0e0;
    color: #b23b3b;
}

.tknk-result-item.focused .tknk-result-category,
.tknk-result-item.focused .tknk-taxonomy {
    color: #fff;
    background: rgba(255,255,255,0.18);
}

/* Ẩn các thành phần không dùng */
.tknk-result-excerpt,
.tknk-result-meta {
    display: none !important;
}

/* Keyboard navigation highlight */
.tknk-result-item.focused {
    background: #667eea !important;
    color: white;
}
.tknk-result-item.focused h4 {
    color: white;
}
.tknk-result-item.focused .tknk-result-thumbnail {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #667eea;
}

/* Messages */
.tknk-no-results,
.tknk-error {
    text-align: center;
    padding: 30px 20px;
    color: #666;
    font-size: 14px;
    margin: 0;
}

.tknk-error {
    color: #e74c3c;
}

/* Widget styles */
.tknk-widget-search .tknk-search-form {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.tknk-widget-search .tknk-results {
    max-height: 300px;
}

.tknk-widget-results {
    margin-top: 20px;
}

/* Responsive design */
@media (max-width: 768px) {
    .tknk-search-form {
        padding: 15px;
        border-radius: 25px;
    }
    
    .tknk-search-form input[type="text"] {
        padding: 12px 15px;
        font-size: 14px;
    }
    
    .tknk-results {
        max-height: 350px;
        margin-top: 5px;
    }
    
    .tknk-result-item {
        flex-direction: column;
        gap: 10px;
        padding: 12px 15px;
    }
    
    .tknk-result-thumbnail {
        width: 100%;
        height: 120px;
    }
    
    .tknk-result-meta {
        flex-direction: column;
        gap: 3px;
    }
    
    .tknk-result-content h4 {
        white-space: normal;
        line-height: 1.3;
    }
}


/* Print styles */
@media print {
    .tknk-search-form,
    .tknk-loading {
        display: none;
    }
    
    .tknk-results {
        box-shadow: none;
        border: 1px solid #ccc;
        position: static;
        max-height: none;
    }
}

/* Animation cho form */
.tknk-search-form {
    animation: slideInUp 0.5s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}



/* Searching animation */
.tknk-form-group.searching {
    animation: pulse 1s infinite;
}


@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.tknk-section {
    margin-bottom: 18px;
}
.tknk-section-title {
    font-size: 14px;
    font-weight: 700;
    color: #764ba2;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-left: 4px;
    opacity: 0.85;
}
.tknk-section:last-child {
    margin-bottom: 0;
}


