/* ================================
   CSS Custom Properties
   ================================ */
:root {
    --card-border-color: #525151;
    --card-text-color: #afafaf;
    --card-text-light: #bababb;
    --primary-accent: rgb(55, 155, 254);
    --transition-standard: 0.3s ease;
    --sidebar-width-mobile: 250px;
    --border-radius-standard: 10px;
    --header-height: 89px;
    --hamburger-height: 60px;
}

/* ================================
   Base Icons
   ================================ */
.bi {
    display: inline-block;
    width: 1rem;
    height: 1rem;
}


/* ================================
   Sidebar Navigation Links
   ================================ */
.nav-link {
    color: #afafaf;
    padding: 6px 14px;
    display: flex;
    align-items: center;
    border-radius: 8px;
    transition: all var(--transition-standard);
    text-decoration: none;
    border: 1px solid transparent;
}

.nav-link:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.nav-link.active {
    background: rgba(55, 155, 254, 0.2);
    color: rgb(55, 155, 254);
    border: 1px solid rgb(55, 155, 254);
}

/* Match ads-manager-dashboard: tighter gaps after Home and the viewer nav section. */
.sidebar-unified .sidebar-unified-inner > ul:nth-child(1) .nav-link {
    padding-bottom: 2px;
}

.sidebar-unified .sidebar-unified-inner > hr:nth-child(2) {
    margin-top: 0;
    margin-bottom: 6px;
}

.sidebar-unified .sidebar-unified-inner > ul:nth-child(3) .nav-item:last-child .nav-link {
    padding-bottom: 2px;
}

.sidebar-unified .sidebar-unified-inner > hr:nth-child(4) {
    margin-top: 0;
    margin-bottom: 6px;
}

.sidebar-unified .sidebar-unified-inner > ul:nth-child(5) .nav-item:last-child .nav-link {
    padding-bottom: 2px;
}

.sidebar-unified .sidebar-unified-inner > hr:nth-child(6) {
    margin-top: 0;
    margin-bottom: 6px;
}

.nav-icon {
    fill:currentColor;
    margin-right: 10px;
}


/* ================================
   Remove gap between header and content
   ================================ */
.header.border-bottom {
    margin-bottom: 0 !important;
}



/* Fix main-content to properly constrain within flexbox (ALL screen sizes) */
.main-content {
    min-width: 0 !important; /* Allow flexbox to shrink below content size */
    max-width: 100% !important; /* Never exceed available space */
    overflow-x: hidden !important; /* Prevent horizontal scrolling */
    box-sizing: border-box !important;
}

/* Desktop Sidebar */
@media (min-width: 768px) {
    /* Remove gap between header and sidebar */
    .container-fluid {
        margin-top: 0;
        padding-top: 0;
    }
    
    .container-fluid .row {
        margin-top: 0;
    }
    
    /* Align sidebar top with header bottom */
    .sidebar {
        margin-top: 0;
    }
}


/* ================================
   Carousel & Scroll Components
   ================================ */
.carousel-wrapper {
    display: flex;
    align-items: center;
    position: relative;
    width: 100%; /* Take full width of parent */
    max-width: 100%; /* Don't exceed parent width */
    box-sizing: border-box;
}

.card-container {
    display: flex;
    overflow-x: hidden;
    scroll-behavior: smooth;
    flex: 1; /* Take remaining space after buttons */
    min-width: 0; /* Allow shrinking below content size */
}

.viewer-dashboard-section-status {
    min-height: 1.25rem;
}

.scroll-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 10;
    flex-shrink: 0; /* Never shrink scroll buttons */
    min-width: 44px; /* Minimum touch target */
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Responsive scroll buttons */
@media (max-width: 768px) {
    .scroll-button {
        padding: 8px;
        min-width: 40px;
    }
    
    .scroll-button img {
        width: 22px;
        height: 22px;
    }
}

@media (max-width: 480px) {
    .scroll-button {
        padding: 6px;
        min-width: 36px;
    }
    
    .scroll-button img {
        width: 20px;
        height: 20px;
    }
}


/* ================================
   Specific Card Types
   ================================ */
/* "My Library" playlists carousel — reuse the library.html .playlist-card
   design (css/playlists.css) inside the horizontal carousel. A fixed width
   keeps cards from stretching/collapsing in the flex row and makes the
   scroll-by-one-card math in bindPlaylistCarouselScroll() work. */
.card-container .playlist-card-carousel {
    flex: 0 0 auto;
    width: 160px;
    margin-right: 12px;
}

@media (max-width: 480px) {
    .card-container .playlist-card-carousel {
        width: 140px;
        margin-right: 10px;
    }
}

/* Playlists carousel (unchanged size) */
.playlists {
    width: 150px;
    height: 200px;
    padding: 5px;
    background-color: transparent;
    border: 1px solid var(--card-border-color);
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.125rem;
    color: var(--card-text-light);
    flex-shrink: 0;
    margin-right: 10px;
}

/* Following carousel (index.html #viewer-dashboard #card-container.viewer-dashboard-following-cards) */
#card-container.viewer-dashboard-following-cards .subscription.card {
    width: 113px;
    height: auto;
    min-height: 0;
    max-height: none;
    padding: 10px 4px 4px;
    margin-right: 8px;
    font-size: 0.65rem;
    color: var(--card-text-light);
    flex-shrink: 0;
    box-sizing: border-box;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    background-color: transparent;
    border: 1px solid var(--card-border-color);
}

#card-container.viewer-dashboard-following-cards .subscription.card > img.rounded-circle {
    width: 54px !important;
    height: 54px !important;
    max-width: 54px;
    flex-shrink: 0;
    margin-top: 2px;
}

#card-container.viewer-dashboard-following-cards .subscription .card-body {
    padding: 0.2rem 0.12rem 0 !important;
    width: 100%;
    min-height: 0;
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0.18rem;
}

#card-container.viewer-dashboard-following-cards .subscription .card-text {
    height: auto !important;
    max-height: 2.35em;
    margin: 0 !important;
    padding: 0;
    font-size: 0.72rem;
    line-height: 1.15;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    word-break: break-word;
}

#card-container.viewer-dashboard-following-cards .subscription .btn {
    padding: 0.1rem 0.28rem;
    font-size: 0.62rem;
    line-height: 1.1;
    margin-bottom: 0;
}

/* Watch history carousel cards — 125px × 1.5 ≈ 188px wide; Play stays top-right via grid */
.history {
    --history-card-width: 188px;
    width: var(--history-card-width);
    max-width: 100%;
    background-color: transparent;
    border: 1px solid var(--card-border-color);
    border-radius: 8px;
    position: relative;
    font-size: 0.75rem;
    color: var(--card-text-color);
    flex-shrink: 0;
    margin-right: 8px;
    overflow: hidden;
    box-sizing: border-box;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

/* The whole card is the play target (role="button"); give keyboard users a
   visible focus ring. */
.history:focus-visible {
    outline: 2px solid var(--bs-primary, #379bfe);
    outline-offset: 2px;
}

.history > .p-2 {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    padding: 0.5rem !important;
}

/* Title/creator stack — full width now that the whole card is the play target. */
.history .history-text-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 0.25rem 0.35rem;
}

.history .history-title-stack {
    min-width: 0;
}

/* Up to two lines, then ellipsis */
.history .history-title-line {
    font-size: 0.8rem;
    line-height: 1.25;
    margin: 0;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.history .history-creator-line {
    font-size: 0.68rem;
    line-height: 1.25;
}

/* Owner name + avatar row (home "Keep watching"). The avatar is optional; when
   absent the `.history-creator-line` renders on its own exactly as before. */
.history .history-creator-row {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    min-width: 0;
}

.history .history-creator-avatar {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background-color: var(--bs-secondary-bg);
}

.history .history-meta-row small {
    font-size: 0.62rem;
}

.creatorVideoList {
    width: 110px;
    height: 240px;
    background-color: transparent;
    border: 1px solid var(--card-border-color);
    border-radius: var(--border-radius-standard);
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.125rem;
    color: var(--card-text-color);
    flex-shrink: 0;
    margin-right: 10px;
}

/* ================================
   Image Wrappers
   ================================ */
.image-square-wrapper {
    padding-top: 100%;
    position: relative;
    height: 0;
}

.image-square-wrapper img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}


/* ================================
   Dashboard Heading Styles
   ================================ */
/* Match Ads Manager Overview color */
main .h2,
main h1.h2 {
    font-size: 28px;
    font-weight: 600;
    color: rgb(55, 155, 254);
}
