/* ========================================
   SEARCH PANEL & SEARCH RESULTS
   ======================================== */


/* Collapsed sidebar when search panel active (kept for mobile click compatibility) */
body.search-panel-active .sidebar {
    width: 72px;
    max-width: 72px;
    flex: 0 0 72px;
    padding: 0;
}

body.search-panel-active .sidebar .menu-text,
body.search-panel-active .sidebar .search-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

body.search-panel-active .sidebar ul li a {
    justify-content: center;
    padding: 12px;
}

body.search-panel-active .sidebar .logo img {
    height: auto;
}

body.search-panel-active .sidebar .sidebar-footer {
    display: none;
}

body.search-panel-active .sidebar .sidebar-social {
    padding: 10px 0;
}

body.search-panel-active .tiktok-app {
    gap: 0;
}

body.search-panel-active .main-content {
    margin-left: 0;
}

/* Search Panel - Sliding search panel */
.search-panel {
    position: fixed;
    left: 72px;
    top: 0;
    width: 300px;
    height: 100vh;
    background: var(--puna-bg);
    border-right: 1px solid var(--puna-muted);
    transform: translateX(-130%);
    transition: transform 0.3s ease;
    z-index: 9998;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}

body.search-panel-active .search-panel {
    transform: translateX(0);
}

/* Show search panel when hovering over search icon (PC) */
body.search-panel-hover .search-panel {
    transform: translateX(0);
}

body.search-panel-active .sidebar-search-trigger {
    margin: 0 10px;
    justify-content: center;
    gap: 0;
}

.search-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    position: sticky;
    top: 0;
    background: var(--puna-bg);
    z-index: 10;
}

.search-panel-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--puna-text);
    margin: 0;
}

.close-search-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: opacity 0.2s;
}

.close-search-btn:hover {
    opacity: 0.7;
}

.close-search-btn .icon-svg,
.close-search-btn .icon-img {
    font-size: 18px;
    color: var(--puna-text);
}

.close-search-btn .icon-svg {
    width: 18px;
    height: 18px;
    color: inherit;
    transition: opacity 0.2s ease, filter 0.2s ease;
}

.close-search-btn:hover .icon-svg,
.close-search-btn:active .icon-svg {
    filter: brightness(0) saturate(100%) invert(31%) sepia(98%) saturate(2479%) hue-rotate(202deg) brightness(97%) contrast(90%);
}

.search-panel-input-wrapper {
    padding: 12px 16px;
}

.search-panel-input-wrapper input,
.real-search-input {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    background: var(--puna-muted);
    color: var(--puna-text);
    outline: none;
    transition: background-color 0.2s;
    border-radius: 25px;
    border: none;
}

.search-panel-input-wrapper input:focus,
.real-search-input:focus {
    background: var(--puna-muted);
    outline: none;  
}

.search-panel-input-wrapper input::placeholder,
.real-search-input::placeholder {
    color: rgba(17, 24, 35, 0.5);
}

/* Search Suggestions Container */
.search-suggestions-container {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    overflow-x: hidden;
}

/* Hidden elements */
#search-loading,
#search-suggestions-list,
#clear-history-btn {
    display: none;
}

#search-loading.show,
#search-suggestions-list.show,
#clear-history-btn.show {
    display: block;
}

/* Original search-loading styles */
.search-loading {
    padding: 20px;
    text-align: center;
    color: var(--puna-primary);
}

.search-loading p {
    font-size: 14px;
}

/* Search History Section */
.search-history-section {
    padding: 12px 0;
}

.search-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px 10px;
    border-bottom: 1px solid var(--puna-muted);
    margin-bottom: 10px;
}

.search-history-header h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--puna-text);
    margin: 0;
}

.clear-history-btn {
    background: transparent;
    border: none;
    color: var(--puna-text);
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.clear-history-btn:hover,
.clear-history-btn:active {
    background: var(--puna-muted);
    color: var(--puna-primary);
}

.clear-history-btn .icon-svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    opacity: 0.8;
    transition: opacity 0.2s ease, filter 0.2s ease;
}

.clear-history-btn:hover .icon-svg,
.clear-history-btn:active .icon-svg {
    opacity: 1;
    filter: brightness(0) saturate(100%) invert(31%) sepia(98%) saturate(2479%) hue-rotate(202deg) brightness(97%) contrast(90%);
}

.search-history-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.search-history-item,
.search-history-loading,
.search-history-empty {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    color: var(--puna-text);
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.search-history-item:hover {
    background: var(--puna-muted);
}

.search-history-item .icon-svg,
.search-history-item .icon-img {
    font-size: 14px;
    color: var(--puna-primary);
    flex-shrink: 0;
}

.search-history-item span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-history-loading,
.search-history-empty {
    color: var(--puna-primary);
    cursor: default;
}

/* Search Popular Section */
.search-popular-section {
    padding: 12px 0;
    border-top: 1px solid var(--puna-muted);
    margin-top: 12px;
}

.search-popular-section h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--puna-text);
    margin: 0 0 10px 16px;
}

.search-popular-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.search-popular-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    color: var(--puna-text);
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.search-popular-list li:hover {
    background: var(--puna-muted);
}

.search-popular-list li .icon-svg {
    width: 14px;
    height: 14px;
    color: var(--puna-primary);
    filter: brightness(0) saturate(100%) invert(31%) sepia(98%) saturate(2479%) hue-rotate(202deg) brightness(97%) contrast(90%);;
    flex-shrink: 0;
}

.search-history-item .icon-svg {
    width: 14px;
    height: 14px;
    color: var(--puna-primary);
    flex-shrink: 0;
}

.search-popular-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    color: var(--puna-text);
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.search-popular-loading,
.search-popular-empty {
    padding: 10px 16px;
    color: var(--puna-text-secondary);
    font-size: 14px;
    text-align: center;
    cursor: default;
}

/* Related Searches Loading */
.related-searches-loading {
    padding: 10px 16px;
    color: var(--puna-primary);
    font-size: 14px;
    text-align: center;
}

.search-popular-list li span {
    flex: 1;
}

/* Suggestion Item Styles */
.search-suggestion-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    color: var(--puna-text);
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.search-suggestion-item:hover {
    background: var(--puna-muted);
}

.search-suggestion-item .icon-svg,
.search-suggestion-item .icon-img {
    font-size: 14px;
    color: var(--puna-primary);
    flex-shrink: 0;
}

.search-suggestion-item span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-suggestions-list {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow: hidden;
    flex: 1;
}

.search-suggestions-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-radius: 0;
}

.search-suggestions-list li:hover {
    background: var(--puna-muted);
    border-radius: 8px;
}

.search-suggestions-list li .icon-svg,
.search-suggestions-list li .icon-img {
    font-size: 16px;
    color: rgba(17, 24, 35, 0.5);
    flex-shrink: 0;
}

.search-suggestions-list li span {
    font-size: 13px;
    color: var(--puna-text);
    flex: 1;
}

/* ========================================
   SEARCH RESULTS PAGE
   ======================================== */

/* Main Search Results Page Container */
.search-results-page {
    flex: 1;
    padding: 0;
    margin: 0 40px;
    width: 100%;
    position: relative;
    min-height: 100vh;
}

/* Container wrapper for search page with sidebar */
.main-content.search-results-page-wrapper {
    position: relative;
}

/* Search Tabs */
.search-tabs {
    display: flex;
    gap: 32px;
    padding: 0 24px;
    border-bottom: 1px solid var(--puna-muted);
    margin-bottom: 0;
}

.search-tab {
    padding: 16px 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--puna-text);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    position: relative;
    display: inline-block;
}

.search-tab.active {
    color: var(--puna-primary);
    border-bottom-color: var(--puna-primary);
}

.search-tab:hover {
    color: var(--puna-text);
}

/* Search Tab Content */
.search-tab-content {
    padding: 24px;
    min-height: 400px;
}

/* Search Videos Grid */
.search-videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 16px;
    padding-bottom: 24px;
}

.search-video-item {
    display: block;
    text-decoration: none;
    color: var(--puna-text);
    border-radius: 4px;
    overflow: hidden;
    transition: transform 0.2s ease;
    background: var(--puna-bg);
}

.search-video-item:hover {
    transform: scale(1.02);
}

.search-video-thumbnail {
    position: relative;
    width: 100%;
    aspect-ratio: 9/16;
    background: var(--puna-muted);
    overflow: hidden;
    border-radius: 4px;
}

.search-video-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.search-video-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.search-video-views {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
}

.search-video-views .icon-svg,
.search-video-views .icon-img {
    width: 12px;
    height: 12px;
    filter: brightness(0) invert(1);
}

.search-video-views span {
    font-size: 12px;
}

.search-video-info {
    padding: 12px 0 0;
}

.search-video-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--puna-text);
    line-height: 1.4;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-video-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--puna-primary);
}

.search-video-author {
    font-weight: 500;
    color: var(--puna-text);
}

.search-video-time {
    color: var(--puna-primary);
}

/* Empty state trong search tab content */
.search-tab-content .taxonomy-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 300px);
    padding: 60px 20px;
    text-align: center;
    width: 100%;
}

.search-tab-content .taxonomy-empty-state .icon-svg,
.search-tab-content .taxonomy-empty-state .icon-img {
    width: 80px;
    height: 80px;
    margin-bottom: 30px;
    color: #666;
    opacity: 1;
    filter: brightness(0) saturate(100%) invert(38%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(95%) contrast(95%);
}

.search-tab-content .taxonomy-empty-state h3 {
    color: #666;
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 12px 0;
    line-height: 1.4;
}

.search-tab-content .taxonomy-empty-state p {
    color: #999;
    font-size: 16px;
    margin: 0 0 24px 0;
    line-height: 1.5;
    max-width: 500px;
}

.search-tab-content .taxonomy-empty-state .empty-state-btn {
    display: inline-block;
    padding: 12px 24px;
    background: var(--puna-primary);
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-top: 8px;
}

.search-tab-content .taxonomy-empty-state .empty-state-btn:hover {
    background: color-mix(in srgb, var(--puna-primary) 90%, black);
    transform: translateY(-1px);
}

.search-tab-content .taxonomy-empty-state .empty-state-btn:active {
    transform: translateY(0);
}

/* Search Suggestions Sidebar */
.search-suggestions-sidebar {
    position: absolute;
    right: 0;
    top: 0;
    width: 300px;
    min-height: 100vh;
    padding: 16px 12px;
    background: var(--puna-bg);
    border-left: 1px solid var(--puna-muted);
    overflow-y: auto;
    z-index: 10;
}

.search-suggestions-sidebar h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--puna-text);
    margin-bottom: 20px;
    padding: 0 4px;
}

.search-suggestion-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 4px;
    text-decoration: none;
    color: var(--puna-text);
    border-radius: 6px;
    transition: background-color 0.2s ease;
    font-size: 13px;
    min-width: 0;
    overflow: hidden;
}

.search-suggestion-link:hover {
    background: var(--puna-muted);
}

.search-suggestion-link .icon-svg {
    font-size: 14px;
    color: var(--puna-primary);
    filter: brightness(0) saturate(100%) invert(31%) sepia(98%) saturate(2479%) hue-rotate(202deg) brightness(97%) contrast(90%);
}

.search-suggestion-link span {
    flex: 1;
    min-width: 0;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Main content when sidebar suggestions are present */
.main-content.search-results-page {
    padding-right: 0;
}

.main-content.search-results-page:has(.search-suggestions-sidebar) {
    padding-right: 200px;
}

/* Search Results Page Title */
.search-results-title {
    padding: 20px 24px 16px 24px;
    border-bottom: 1px solid var(--puna-muted);
    margin-bottom: 0;
    position: relative;
}

.search-results-title .video-top-controls {
    position: absolute;
    top: 20px;
    left: 24px;
    right: auto;
    z-index: 100;
}

.search-results-title h1 {
    font-size: 20px;
    font-weight: 600;
    color: var(--puna-text);
    margin: 0;
}

.search-results-title .search-query {
    color: var(--puna-primary);
    font-weight: 700;
}
