/*
============================================================
    TUTORIALS PAGE STYLES
============================================================
*/

/* --- 1. Main Page Layout --- */

.learning-hub-container {
    max-width: var(--container-width-lg);
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

/* --- 2. Filter Bar & Custom Dropdowns --- */

.filter-bar-container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: var(--space-lg);
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: var(--space-lg);
}

.filter-group {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.filter-group-label {
    font-weight: 600;
    font-size: 1rem;
    color: var(--color-text-subtle);
}

.filter-btn {
    display: inline-block;
    height: 40px;
    padding: 0 1.25rem;
    background-color: #fff;
    color: var(--color-text-body);
    border: 1px solid #ddd;
    border-radius: 999px;
    font-weight: 500;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-btn:hover {
    border-color: #bbb;
    background-color: #f9f9f9;
}

.filter-btn.active {
    background-color: var(--color-primary-gold-hover);
    color: var(--color-text-light);
    border-color: var(--color-primary-gold);
    font-weight: 600;
    box-shadow: 0 4px 12px -2px hsla(45, 100%, 28%, 0.3);
}

.filter-select {
    display: none; /* Hidden because we use a custom dropdown */
}

.custom-select-wrapper {
    position: relative;
    width: 220px;
}

.custom-select-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 40px;
    padding: 0 1.25rem;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 999px;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.custom-select-wrapper:hover .custom-select-trigger {
    border-color: #bbb;
}

.custom-select-trigger.filtered {
    background-color: var(--color-primary-gold-hover);
    color: var(--color-text-light);
    font-weight: 600;
}

.custom-select-trigger::after {
    content: '';
    width: 1em;
    height: 1em;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23333' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 1em;
    transition: transform 0.3s ease;
}

.custom-options {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 100%;
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.custom-option {
    padding: 12px 20px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-weight: 500;
}
.custom-option:first-of-type { border-top-left-radius: 12px; border-top-right-radius: 12px; }
.custom-option:last-of-type { border-bottom-left-radius: 12px; border-bottom-right-radius: 12px; }
.custom-option:hover { background-color: #f5f5f7; }
.custom-option.selected { background-color: var(--color-primary-gold); color: white; font-weight: 600; }

.custom-select-wrapper.open .custom-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.custom-select-wrapper.open .custom-select-trigger::after {
    transform: rotate(180deg);
}

/* --- 3. Tutorial Grid & Items --- */

.tutorial-grid {
    /* FIX: Use Flexbox for initial placeholder layout */
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 30px; /* Should match Isotope gutter */
    margin-left: auto;
    margin-right: auto;
}

/* This is a structural element for Isotope and should not be visible */
.grid-sizer {
    width: 0;
}

.tutorial-item {
    width: 380px;
    margin-bottom: 30px;
}

.tutorial-item:has(.is-playlist) {
    padding-bottom: 20px;
}

/* --- 4. Tutorial Card Styles --- */

.tutorial-card-link {
    display: block;
    text-decoration: none;
    position: relative;
}

.card-thumbnail-wrapper {
    background-color: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    transition: box-shadow 0.3s ease;
    position: relative;
    z-index: 2;
}

.tutorial-card-link:hover .card-thumbnail-wrapper {
    box-shadow: 0 12px 32px rgba(0,0,0,0.12);
}

.card-thumbnail {
    width: 100%;
    display: block;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

/* Stacked card effect for playlists */
.tutorial-card-link.is-playlist::before,
.tutorial-card-link.is-playlist::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    left: 50%;
    z-index: 1;
    background-color: #e9e9e9; 
}

.tutorial-card-link.is-playlist::before {
    background-color: #888;
    bottom: 20px;
    transform: translateX(-50%) scale(0.94);
}

.tutorial-card-link.is-playlist::after {
    background-color: #5c5c5c;
    bottom: 10px;
    transform: translateX(-50%) scale(0.97);
}

/* Card Info & Overlays */
.tutorial-card-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding-top: var(--space-xs);
}
.tutorial-card-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0;
    margin-top: 0.5rem;
}

.instructor-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 4px 0 0.75rem 0; 
}

.instructor-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-subtle);
    margin-bottom: 0.5rem;
    margin-top: 0.5rem;
}

.video-count {
    background-color: var(--color-bg-light);
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 500;
    font-size: 12px;
    margin-left: 1rem;
}

.software-tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem; 
    margin-top: 0rem; 
}

.software-tag {
    display: inline-block;
    background-color: var(--color-bg-light);
    color: var(--color-text-subtle);
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.card-top {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 3;
}
.difficulty-pill {
    display: inline-block;
    background-color: rgba(222, 222, 222, 0.3);
    backdrop-filter: blur(10px);
    color: #fff;
    padding: 6px 12px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}
.card-middle {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3;
}
.play-button-container {
    background-color: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s ease;
}
.tutorial-card-link:hover .play-button-container {
    opacity: 1;
    transform: scale(1);
}
.play-icon {
    width: 32px;
    height: 32px;
    fill: #fff;
}


/* --- 5. Featured Tutorial Section --- */

.featured-tutorial-section {
    padding: 6.25rem 0;
    margin-top: 6.25rem;
    background-color: #f5f5f7;
}

.featured-tutorial-wrapper {
    display: flex;
    align-items: center; /* Vertically center content */
    justify-content: center;
    gap: 5rem;
    max-width: 1200px; /* Use max-width for responsiveness */
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.featured-video-player {
    width: 50%;
    max-width: 600px;
    flex-shrink: 0;
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    display: block;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    aspect-ratio: 16 / 9; /* Ensure correct proportions */
}

.featured-video-player img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.featured-video-player .play-button-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s ease;
}
.featured-video-player:hover .play-button-container {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
}
.featured-tutorial-info {
    width: 50%;
    max-width: 500px;
}

.featured-tutorial-info h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-primary-gold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.featured-tutorial-info h3 {
    font-size: 32px;
    font-weight: 700;
    color: #1d1d1f;
    line-height: 1.2;
    margin-top: 0;
    margin-bottom: 1rem;
}
.featured-tutorial-info p {
    font-size: 18px;
    line-height: 1.6;
    color: #4f4f52;
    margin-top: 0;
    margin-bottom: 2rem;
    /* Truncate text to 3 lines */
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.featured-tutorial-info .btn.btn-solid-gold {
    margin-top: 1rem;
}


/* --- 6. Philosophy Section --- */

.philosophy-section {
    padding: 6.25rem 0;
    text-align: center;
}
.philosophy-section h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 1.5rem 0;
}
.philosophy-text {
    max-width: var(--container-width-sm);
    margin: 0 auto;
    font-size: 1.25rem;
    font-weight: 400;
    line-height: 1.6;
    color: var(--color-text-body);
}

/* --- 7. Placeholder & Skeleton Loading Styles --- */

.tutorial-item.is-placeholder .placeholder-thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    background-color: #e0e0e0;
    border-radius: 16px;
    animation: placeholder-shimmer 2s linear infinite;
    background-image: linear-gradient(to right, #e9e9e9 0%, #f5f5f5 40%, #e9e9e9 80%, #e9e9e9 100%);
    background-repeat: no-repeat;
    background-size: 2000px 100%;
}

.tutorial-item.is-placeholder .placeholder-line {
    height: 20px;
    background-color: #e0e0e0;
    border-radius: var(--radius-xs);
    animation: placeholder-shimmer 2s linear infinite;
    background-image: linear-gradient(to right, #e9e9e9 0%, #f5f5f5 40%, #e9e9e9 80%, #e9e9e9 100%);
    background-repeat: no-repeat;
    background-size: 2000px 100%;
    margin-bottom: 0.75rem;
}

.tutorial-item.is-placeholder .placeholder-line.title {
    height: 24px;
    width: 80%;
    margin-top: 0.5rem;
}

.tutorial-item.is-placeholder .placeholder-line.text {
    width: 50%;
}

.tutorial-item.is-placeholder .placeholder-line.tags {
    width: 90%;
    height: 30px;
    margin-top: 0.75rem;
}

/* This is a global loading class on the BODY tag */
body.is-loading .has-skeleton {
    animation: placeholder-shimmer 2s linear infinite;
    background-color: #e0e0e0;
    background-image: linear-gradient(to right, #e9e9e9 0%, #f5f5f5 40%, #e9e9e9 80%, #e9e9e9 100%);
    background-repeat: no-repeat;
    background-size: 2000px 100%;
    color: transparent !important;
    border-radius: var(--radius-xs);
}

body.is-loading .has-skeleton.skeleton-btn {
    border-color: transparent;
    pointer-events: none;
}

body.is-loading .has-skeleton.skeleton-img {
    background-color: #e0e0e0; /* Solid color for images */
}


/* --- 8. Responsive Design --- */

@media (max-width: 1200px) {
    .featured-tutorial-wrapper {
        flex-direction: column;
        align-items: center;
        gap: 2rem;
        text-align: center;
    }
    .featured-video-player,
    .featured-tutorial-info {
        width: 100%;
        max-width: 600px;
    }
    .featured-tutorial-info .btn.btn-solid-gold {
        margin-left: auto;
        margin-right: auto;
    }
}

@media (max-width: 768px) {
    .learning-hub-container {
        padding: 0 var(--space-md);
    }

    .filter-bar-container {
        flex-direction: column;
        align-items: stretch;
        gap: 1.5rem;
    }

    .custom-select-wrapper {
        width: 100%;
    }

    .tutorial-item {
        width: 100%;
        max-width: 380px; /* Allow cards to shrink but not exceed their design width */
    }

    .featured-tutorial-section {
        padding: 3rem 0;
        margin-top: 3rem;
    }

    .philosophy-section {
        padding: 3rem var(--space-md);
    }
    .philosophy-section h2 {
        font-size: 1.75rem;
    }
    .philosophy-text {
        font-size: 1.1rem;
    }
}
