/* Tutor Lesson Search Styles */

.tls-search-wrapper {
    margin-bottom: 24px;
    width: 100%;
    padding: 0;
}

/* For lesson sidebar placement */
.tutor-course-sidebar .tls-search-wrapper {
    padding: 0 24px;
    margin-bottom: 20px;
    margin-top: 0;
}

/* For course page placement (above topics) */
.tutor-course-topics-wrap .tls-search-wrapper {
    margin-bottom: 24px;
    padding: 0;
}

/* Ensure proper spacing when inside tabs content */
.tutor-course-content-wrapper .tls-search-wrapper {
    margin-top: 0;
    margin-bottom: 24px;
}

.tls-search-container {
    position: relative;
    width: 100%;
    max-width: 100%;
}

.tls-search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.tls-search-input {
    width: 100%;
    padding: 12px 40px 12px 44px;
    font-size: 14px;
    line-height: 1.5;
    color: #1e293b;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    transition: all 0.2s ease;
    outline: none;
    box-sizing: border-box;
}

    .tls-search-input:focus {
        border-color: #3E64DE;
        box-shadow: 0 0 0 3px rgba(62, 100, 222, 0.1);
    }

    .tls-search-input::placeholder {
        color: #94a3b8;
    }

.tls-clear-btn {
    position: absolute;
    right: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    background: #e8e8e8;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: #666;
    transition: all 0.2s ease;
    top: 50%;
    transform: translateY(-50%);
    visibility: hidden;
    opacity: 0;
}

    /* Add X icon as CSS background */
    .tls-clear-btn::before {
        content: '';
        display: block;
        width: 12px;
        height: 12px;
        background-image: url('data:image/svg+xml;utf8,<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12 4L4 12M4 4L12 12" stroke="%23666666" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>');
        background-size: contain;
        background-repeat: no-repeat;
        background-position: center;
    }

    .tls-clear-btn:hover::before {
        background-image: url('data:image/svg+xml;utf8,<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12 4L4 12M4 4L12 12" stroke="%23333333" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>');
    }

    .tls-clear-btn.tls-show {
        visibility: visible;
        opacity: 1;
    }

    .tls-clear-btn:hover {
        background: #d0d0d0;
        color: #333;
    }

    .tls-clear-btn svg {
        width: 12px;
        height: 12px;
        display: block;
    }

.tls-search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08), 0 0 1px rgba(0, 0, 0, 0.1);
    max-height: 420px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.tls-results-list {
    padding: 4px 0;
}

.tls-result-item {
    display: flex;
    align-items: flex-start;
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    text-decoration: none;
    color: inherit;
    border: none;
}

    .tls-result-item:hover {
        background-color: #f5f5f5;
    }

    .tls-result-item:active {
        background-color: #ebebeb;
    }

.tls-result-icon {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f5f5f5;
    border-radius: 8px;
    margin-right: 14px;
}

    .tls-result-icon svg {
        width: 20px;
        height: 20px;
        color: #666;
    }

    .tls-result-icon.video {
        background-color: #e8eaf6;
    }

        .tls-result-icon.video svg {
            color: #5b5fc7;
        }

    .tls-result-icon.youtube {
        background-color: #ffebee;
    }

        .tls-result-icon.youtube svg {
            color: #e53935;
        }

    .tls-result-icon.vimeo {
        background-color: #e1f5fe;
    }

        .tls-result-icon.vimeo svg {
            color: #00acc1;
        }

    .tls-result-icon.text {
        background-color: #e8f5e9;
    }

        .tls-result-icon.text svg {
            color: #43a047;
        }

    .tls-result-icon.assignment {
        background-color: #fff3e0;
    }

        .tls-result-icon.assignment svg {
            color: #fb8c00;
        }

    .tls-result-icon.quiz {
        background-color: #f3e5f5;
    }

        .tls-result-icon.quiz svg {
            color: #8e24aa;
        }

.tls-result-content {
    flex: 1;
    min-width: 0;
    padding-top: 2px;
}

.tls-result-title {
    font-size: 14px;
    font-weight: 500;
    color: #3e3e3e;
    margin: 0 0 4px 0;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tls-result-topic {
    font-size: 13px;
    color: #757575;
    margin: 0;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tls-loading {
    padding: 20px;
    text-align: center;
    color: #757575;
    font-size: 14px;
}

.tls-no-results {
    padding: 32px 20px;
    text-align: center;
    color: #9e9e9e;
    font-size: 14px;
}

    .tls-no-results svg {
        width: 56px;
        height: 56px;
        margin: 0 auto 16px;
        color: #d9d9d9;
    }

    .tls-no-results p {
        margin: 0;
        font-weight: 500;
    }

.tls-error {
    padding: 20px;
    text-align: center;
    color: #d32f2f;
    font-size: 14px;
}

/* Highlight matched text */
.tls-highlight {
    background-color: #fff9c4;
    font-weight: 600;
    padding: 2px 3px;
    border-radius: 3px;
    color: #3e3e3e;
}

/* Scrollbar styling */
.tls-search-results::-webkit-scrollbar {
    width: 6px;
}

.tls-search-results::-webkit-scrollbar-track {
    background: #fafafa;
    border-radius: 6px;
}

.tls-search-results::-webkit-scrollbar-thumb {
    background: #d0d0d0;
    border-radius: 6px;
}

    .tls-search-results::-webkit-scrollbar-thumb:hover {
        background: #b8b8b8;
    }

/* Responsive adjustments */
@media (max-width: 768px) {
    .tls-search-wrapper {
        padding: 0 16px;
    }

    .tutor-course-sidebar .tls-search-wrapper {
        padding: 0 20px;
    }

    .tls-search-input {
        font-size: 14px;
        padding: 12px 36px 12px 42px;
    }

    .tls-search-icon {
        left: 12px;
    }

    .tls-clear-btn {
        right: 12px;
        width: 20px;
        height: 20px;
    }

        .tls-clear-btn svg {
            width: 11px;
            height: 11px;
        }

    .tls-search-results {
        max-height: 280px;
    }

    .tls-result-item {
        padding: 10px 14px;
    }

    .tls-result-icon {
        width: 34px;
        height: 34px;
        margin-right: 12px;
    }

        .tls-result-icon svg {
            width: 18px;
            height: 18px;
        }

    .tls-result-title {
        font-size: 13px;
    }

    .tls-result-topic {
        font-size: 12px;
    }
}
