/* History page specific styles */
/* Make sidebar stretch to match main content height */
.container-fluid > .row {
    display: flex;
    align-items: stretch; /* This makes all children stretch to the same height */
}

.container-fluid > .row > .sidebar {
    display: flex !important;
    flex-direction: column !important;
    align-self: stretch !important; /* Stretch to match the tallest sibling (main content) */
}

.container-fluid > .row > .sidebar .offcanvas-md {
    display: flex;
    flex-direction: column;
    flex: 1; /* Fill the sidebar height */
}

.container-fluid > .row > .sidebar .offcanvas-body {
    display: flex;
    flex-direction: column;
    flex: 1; /* Fill the offcanvas height */
}

/* Full history page — same `.history` cards as viewerDashboard; rows wrap here */
.history-page-day-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
    padding: 1rem 0;
}

.history-page-single-section .history {
    width: auto;
    margin: 0;
    border-radius: 12px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.history-page-single-section .history:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.history-page-single-section .image-square-wrapper {
    padding-top: 56.25%;
}

.history-more-actions {
    display: flex;
    justify-content: flex-start;
    margin-top: 0.25rem;
}

.history-more-button {
    min-width: 0;
}

.filter-buttons {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.5rem 1.25rem;
    border-radius: 20px;
    border: 1px solid var(--bs-border-color);
    background: transparent;
    color: var(--bs-body-color);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.filter-btn:hover {
    background: var(--bs-secondary-bg);
}

.filter-btn.active {
    background: var(--bs-primary);
    border-color: var(--bs-primary);
    color: white;
}

.history-section {
    margin-bottom: 2.5rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--bs-border-color);
}

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--bs-body-color);
    margin: 0;
}

.section-date {
    font-size: 0.9rem;
    color: var(--bs-secondary-color);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.history-item {
    display: flex;
    gap: 1rem;
    padding: 0.75rem;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.history-item:hover {
    background-color: var(--bs-secondary-bg);
}

.history-thumbnail {
    position: relative;
    width: 240px;
    min-width: 240px;
    height: 135px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bs-secondary-bg);
}

.history-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-duration {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.progress-bar-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
}

.progress-bar {
    height: 100%;
    background: var(--bs-danger);
    transition: width 0.3s;
}

.history-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
}

.history-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.5rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.history-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.channel-link {
    color: var(--bs-secondary-color);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.channel-link:hover {
    color: var(--bs-body-color);
}

.video-stats {
    font-size: 0.85rem;
    color: var(--bs-secondary-color);
}

.watched-time {
    font-size: 0.85rem;
    color: var(--bs-secondary-color);
}

.history-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-end;
}

.action-btn {
    background: none;
    border: none;
    color: var(--bs-secondary-color);
    cursor: pointer;
    padding: 0.25rem;
    transition: color 0.2s;
}

.action-btn:hover {
    color: var(--bs-body-color);
}

.clear-history-section {
    text-align: center;
    padding: 2rem;
    background: var(--bs-secondary-bg);
    border-radius: 8px;
    margin-top: 2rem;
}

.rating-hearts {
    display: flex;
    gap: 2px;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .history-page-day-cards {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 0.5rem;
    }

    .history-thumbnail {
        width: 160px;
        min-width: 160px;
        height: 90px;
    }

    .history-item {
        flex-direction: column;
    }

    .history-thumbnail {
        width: 100%;
    }

    .history-controls {
        flex-direction: column;
        align-items: stretch;
    }

}

/* ── Header results page (search-layers_design.md §3.2): three categories ── */
.koi-search-section {
    margin-bottom: 1.75rem;
}

.koi-search-section-title {
    margin-bottom: 0.75rem;
    opacity: 0.85;
}

.koi-search-section-rows {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Highlight/Note rows are compact list rows; a Video row wraps a history card. */
.koi-search-row {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    outline: none;
}

.koi-search-row:hover,
.koi-search-row:focus-visible {
    background: rgba(255, 255, 255, 0.06);
}

.koi-search-row[data-cat="videos"] {
    flex-direction: column;
    gap: 0.25rem;
}

.koi-search-row-thumb {
    flex: 0 0 auto;
    width: 96px;
    height: 54px;
    border-radius: 0.375rem;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
}

.koi-search-row-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.koi-search-row-thumb--super {
    font-size: 1.4rem;
    color: #ffc107;
}

.koi-search-row-body {
    min-width: 0;
    flex: 1 1 auto;
}

.koi-search-row-title {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.koi-search-row-sub {
    font-size: 0.85rem;
    opacity: 0.8;
}

.koi-search-row-snippet,
.koi-search-row-meta {
    font-size: 0.85rem;
    opacity: 0.75;
    margin-top: 0.15rem;
}

.koi-search-more {
    margin-top: 0.5rem;
}

