/* Favourites Page Styles */

.favourites-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 100px 2rem 150px;
    min-height: 100vh;
    box-sizing: border-box;
}

/* When embedded on landing page */
.favourites-on-landing {
    padding: 60px 2rem 100px;
    min-height: auto;
}

/* Expand container for wider screens */
@media (min-width: 1200px) {
    .favourites-container {
        max-width: 1500px;
        padding: 100px 3rem 150px;
    }
}

@media (min-width: 1600px) {
    .favourites-container {
        max-width: 1800px;
        padding: 100px 4rem 150px;
    }
}

@media (min-width: 2000px) {
    .favourites-container {
        max-width: 2200px;
    }
}

.favourites-header {
    text-align: center;
    margin-bottom: 3rem;
}

.favourites-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.favourites-description {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* Layout with sidebar */
.favourites-layout {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.favourites-sections {
    flex: 1;
    min-width: 0;
}

/* Tags Sidebar */
.tags-sidebar {
    position: sticky;
    top: 100px;
    width: 250px;
    flex-shrink: 0;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.25rem;
    backdrop-filter: blur(10px);
    max-height: calc(100vh - 150px);
    overflow-y: auto;
}

.tags-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--card-border);
}

.tags-sidebar-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.tags-sidebar-title svg {
    color: #ff8c42;
}

.clear-tags-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: none;
}

.clear-tags-btn.visible {
    display: block;
}

.clear-tags-btn:hover {
    background: rgba(255, 107, 53, 0.1);
    color: #ff8c42;
}

.tags-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.sidebar-tag {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 107, 53, 0.08);
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    color: var(--text-color);
}

.sidebar-tag:hover {
    background: rgba(255, 107, 53, 0.15);
    border-color: rgba(255, 107, 53, 0.3);
}

.sidebar-tag.active {
    background: linear-gradient(135deg, #ff6b35, #ff8c42);
    color: white;
    border-color: transparent;
}

.sidebar-tag.active:hover {
    background: linear-gradient(135deg, #e55a2b, #e57b38);
}

.tag-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tag-count {
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 10px;
    margin-left: 0.5rem;
    font-weight: 500;
}

.sidebar-tag.active .tag-count {
    background: rgba(255, 255, 255, 0.25);
}

/* Hide sidebar on mobile, show as collapsible */
@media (max-width: 1024px) {
    .favourites-layout {
        flex-direction: column;
    }
    
    .tags-sidebar {
        position: relative;
        top: 0;
        width: 100%;
        max-height: none;
        order: -1;
    }
    
    .tags-list {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .sidebar-tag {
        padding: 0.4rem 0.65rem;
        font-size: 0.8rem;
    }
}

/* Search Bar */
.search-container {
    position: relative;
    max-width: 550px;
    margin: 2.5rem auto 0;
    padding: 4px;
    background: linear-gradient(135deg, #ff6b35, #ff8c42, #ffb347);
    border-radius: 55px;
    box-shadow: 0 4px 25px rgba(255, 107, 53, 0.3), 0 0 40px rgba(255, 140, 66, 0.15);
    animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 4px 25px rgba(255, 107, 53, 0.3), 0 0 40px rgba(255, 140, 66, 0.15);
    }
    50% {
        box-shadow: 0 4px 30px rgba(255, 107, 53, 0.45), 0 0 50px rgba(255, 140, 66, 0.25);
    }
}

.search-input {
    width: 100%;
    padding: 1.1rem 3.2rem 1.1rem 3.2rem;
    font-size: 1.05rem;
    border: none;
    border-radius: 50px;
    background: var(--card-bg);
    color: var(--text-color);
    outline: none;
    transition: background 0.3s ease;
    box-sizing: border-box;
    backdrop-filter: blur(10px);
}

.search-input::placeholder {
    color: var(--text-secondary);
}

.search-input:focus {
    background: var(--card-bg);
}

.search-container:focus-within {
    animation: none;
    box-shadow: 0 4px 35px rgba(255, 107, 53, 0.5), 0 0 60px rgba(255, 140, 66, 0.3);
}

.search-icon {
    position: absolute;
    left: 1.3rem;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    color: #ff8c42;
    pointer-events: none;
    transition: color 0.3s ease, transform 0.3s ease;
}

.search-container:focus-within .search-icon {
    color: #ff6b35;
    transform: translateY(-50%) scale(1.1);
}

.clear-search {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 107, 53, 0.1);
    border: none;
    font-size: 1.1rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.3rem 0.6rem;
    border-radius: 50%;
    display: none;
    transition: all 0.2s ease;
    line-height: 1;
}

.clear-search:hover {
    background: rgba(255, 107, 53, 0.2);
    color: #ff8c42;
}

.clear-search.visible {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* No results message */
.no-results {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-size: 1rem;
    font-style: italic;
}

/* Hidden items */
.video-card.search-hidden,
.fav-item-card.search-hidden,
.video-card.tag-hidden,
.fav-item-card.tag-hidden {
    display: none;
}

.favourites-sections {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Section Styles */
.fav-section {
    background: var(--card-bg);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--card-border);
    backdrop-filter: blur(10px);
}

.fav-section-header {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s ease;
}

.fav-section-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="light"] .fav-section-header:hover {
    background: rgba(0, 0, 0, 0.03);
}

.fav-section-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: linear-gradient(135deg, #ff6b35, #ff8c42);
}

.fav-section-icon svg {
    width: 22px;
    height: 22px;
    color: white;
}

.fav-section-title {
    flex: 1;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
}

.fav-section-toggle {
    font-size: 1.5rem;
    font-weight: 300;
    color: var(--text-secondary);
    transition: transform 0.3s ease;
}

.fav-section.expanded .fav-section-toggle {
    transform: rotate(45deg);
}

/* Section Content */
.fav-section-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.4s ease;
    padding: 0 1.5rem;
}

.fav-section.expanded .fav-section-content {
    max-height: 3000px;
    padding: 0 1.5rem 1.5rem;
}

/* Videos Grid */
.fav-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* Better distribution for wider screens */
@media (min-width: 900px) {
    .fav-items-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    }
}

@media (min-width: 1200px) {
    .fav-items-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        max-width: 1400px;
        margin: 0 auto;
    }
}

@media (min-width: 1600px) {
    .fav-items-grid {
        grid-template-columns: repeat(4, 1fr);
        max-width: 1600px;
    }
}

@media (min-width: 2000px) {
    .fav-items-grid {
        grid-template-columns: repeat(5, 1fr);
        max-width: 2000px;
    }
}

.video-card {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

[data-theme="light"] .video-card {
    background: rgba(0, 0, 0, 0.05);
}

.video-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.video-thumbnail {
    position: relative;
    padding-top: 56.25%;
    overflow: hidden;
}

.video-thumbnail iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.video-info {
    padding: 1rem;
}

.video-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.video-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.video-tag {
    font-size: 0.75rem;
    padding: 0.25rem 0.6rem;
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.2), rgba(255, 140, 66, 0.2));
    color: #ff8c42;
    border-radius: 20px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: background 0.2s ease, transform 0.2s ease;
}

.video-tag:hover {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.4), rgba(255, 140, 66, 0.4));
    transform: scale(1.05);
}

.video-tag.active {
    background: linear-gradient(135deg, #ff6b35, #ff8c42);
    color: white;
}

/* Dimmed state for non-matching videos */
.video-card.dimmed {
    opacity: 0.3;
    filter: grayscale(50%);
    transform: scale(0.98);
}

.video-card.dimmed:hover {
    opacity: 0.5;
    transform: scale(0.98);
}

/* Items List (for articles and projects) */
.fav-items-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.fav-item-card {
    display: flex;
    gap: 1rem;
    padding: 1.25rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    transition: transform 0.3s ease, background 0.3s ease;
    text-decoration: none;
    color: inherit;
}

[data-theme="light"] .fav-item-card {
    background: rgba(0, 0, 0, 0.05);
}

.fav-item-card:hover {
    transform: translateX(8px);
    background: rgba(255, 107, 53, 0.1);
}

.fav-item-icon {
    width: 50px;
    height: 50px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.2), rgba(255, 140, 66, 0.2));
}

.fav-item-icon svg {
    width: 24px;
    height: 24px;
    color: #ff8c42;
}

.fav-item-content {
    flex: 1;
    min-width: 0;
}

.fav-item-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.25rem;
}

.fav-item-author {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.fav-item-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.fav-item-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.fav-item-tag {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    background: rgba(255, 107, 53, 0.15);
    color: #ff8c42;
    border-radius: 12px;
    font-weight: 500;
}

.fav-item-arrow {
    display: flex;
    align-items: center;
    color: var(--text-secondary);
    transition: color 0.3s ease, transform 0.3s ease;
}

.fav-item-card:hover .fav-item-arrow {
    color: #ff8c42;
    transform: translateX(4px);
}

.fav-item-arrow svg {
    width: 20px;
    height: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .favourites-container {
        padding: 80px 1rem 140px;
    }

    .favourites-title {
        font-size: 2rem;
    }

    .fav-section-header {
        padding: 1rem;
    }

    .fav-section-icon {
        width: 36px;
        height: 36px;
    }

    .fav-section-title {
        font-size: 1.1rem;
    }

    .fav-items-grid {
        grid-template-columns: 1fr;
    }

    .fav-item-card {
        flex-direction: column;
        gap: 0.75rem;
    }

    .fav-item-icon {
        width: 40px;
        height: 40px;
    }

    .fav-item-arrow {
        display: none;
    }
}
