/* static/css/index-styles.css */
/* Base styles */
@font-face {
    font-family: 'Scotch Roman MT';
    font-style: italic;
    src: local('Scotch Roman MT Italic'), local('ScotchRomanMT-Italic');
    font-display: swap;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Scotch Roman MT', 'Scotch Roman MT Italic', Baskerville, 'Baskerville Old Face', 'Hoefler Text', Garamond, 'Times New Roman', serif;
    font-style: italic;
    color: black;
    padding: 20px;
    background-image: url('../images/heartbackground1.png');
    background-attachment: fixed;
    background-position: center;
    background-repeat: no-repeat;
    background-size: 100vh auto;
    min-height: 100vh;
    margin: 0;
}


body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.0);
    z-index: -1;
}

/* Header layout styles */
.site-header {
    margin-bottom: 40px;
    padding: 20px 30px;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
}

/* Logo styles */
.logo-container {
    flex: 0 0 auto;
    margin-right: 15px;
}

.site-logo {
    height: 60px;
    width: auto;
}

/* Title styles */
.title-container {
    flex: 1 0 auto;
    min-width: 0;
    text-align: left;
    margin-right: 15px;
}

.site-title {
    font-size: 28px;
    color: #222;
    margin-bottom: 0;
    font-weight: 400;
    font-style: bold;
    letter-spacing: 0.05em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Handle switching from full title to short title*/
.full-title {
    display: inline;
    font-size: 32px;
    color: #222;
    margin-bottom: 0;
    font-weight: 400;
    font-style: bold;
    letter-spacing: 0.05em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.short-title {
    display: none;
}


/* Header Search Container styles */
.header-search-container {
    flex: 2 1 auto;
    margin: 0 15px;
    align-self: center;
    max-width: 500px;
}

.header-search-form {
    display: flex;
    width: 100%;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 30px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #ddd;
}

/* Update in static/css/index-styles.css */

/* Increase font size for the search input */
.header-search-input {
    flex: 1;
    padding: 10px 15px;
    border: none;
    background: transparent;
    font-family: inherit;
    font-style: italic;
    font-size: 18px; /* Increased from 14px */
    outline: none;
    min-width: 0;
}

/* Increase font size for the search button */
.header-search-button {
    padding: 10px 20px;
    border: none;
    background: #444;
    color: white;
    cursor: pointer;
    font-family: inherit;
    font-style: italic;
    font-size: 18px; /* Increased from 14px */
    transition: background 0.3s;
    white-space: nowrap;
}

/* Also update media query versions */
@media (max-width: 480px) {
    .header-search-input {
        min-height: 42px;
        padding: 12px 15px;
        border-radius: 20px 0 0 20px;
        font-size: 16px; /* Increased from 14px */
    }
    
    .header-search-button {
        width: auto;
        min-width: 70px;
        padding: 0 15px;
        height: 42px;
        border-radius: 0 20px 20px 0;
        font-size: 16px; /* Increased from 14px */
    }
}

/* Extra small devices */
@media (max-width: 360px) {
    .header-search-input {
        min-height: 38px;
        padding: 10px;
        font-size: 15px; /* Increased from 13px */
    }
    
    .header-search-button {
        min-width: 60px;
        height: 38px;
        font-size: 15px; /* Increased from 13px */
    }
}

.header-search-button:hover {
    background: #cc3333;
}

/* Navigation styles */
.nav-container {
    flex: 0 0 auto;
    margin-left: 10px;
}

.nav-links {
    display: flex;
    gap: 15px;
}

.nav-link {
    text-decoration: none;
    color: #444;
    font-size: 18px;
    font-weight: 500;
    padding: 8px 15px;
    border-radius: 20px;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.nav-link:hover {
    background-color: rgba(0, 0, 0, 0.1);
    color: #222;
}

/* Responsive styles for smaller screens */
@media (max-width: 1200px) {
    .site-title {
        font-size: 24px;
    }
    
    .header-search-input {
        font-size: 13px;
    }
}

@media (max-width: 1000px) {
    .header-container {
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
    }
    
    .logo-container {
        flex: 0 0 auto;
        margin-right: 15px;
    }
    
    .title-container {
        flex: 1 1 auto;
        text-align: left;
    }
    
    .header-search-container {
        flex: 0 0 100%;
        order: 3;
        max-width: 100%;
        margin: 10px 0 0 0;
    }
    
    .nav-container {
        flex: 0 0 auto;
        margin-left: auto;
    }
}

@media (max-width: 768px) {
    .site-header {
        padding: 15px;
    }
    
    .header-container {
        flex-direction: column;
        align-items: center;
    }
    
    .logo-container {
        margin-right: 0;
        margin-bottom: 10px;
    }
    
    .title-container {
        text-align: center;
        margin-right: 0;
        margin-bottom: 10px;
    }
    
    .site-title {
        font-size: 22px;
    }
    
    .nav-container {
        margin: 10px 0 0 0;
    }
}


@media (max-width: 480px) {

    .full-title {
    display: none;
    }
    .short-title {
    display: inline;
    font-size: 34px;
    color: #222;
    margin-bottom: 0;
    font-weight: 400;
    font-style: bold;
    letter-spacing: 0.05em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    }

    .site-logo {
        height: 80px;
    }

    .header-search-form {
        /* Keep horizontal layout instead of stacking */
        flex-direction: row;
        border-radius: 20px;
        height: auto;
    }
    
    .header-search-input {
        min-height: 42px; /* Enforce minimum height */
        padding: 12px 15px;
        border-radius: 20px 0 0 20px;
        font-size: 14px; /* Slightly larger font */
    }
    
    .header-search-button {
        width: auto; /* Let button size to content */
        min-width: 70px; /* Minimum width for button */
        padding: 0 15px;
        height: 42px; /* Match input height */
        border-radius: 0 20px 20px 0;
        font-size: 14px; /* Slightly larger font */
    }
    
    /* If the search field still feels too small */
    .header-container {
        padding: 5px 0;
    }

    .nav-link {
        font-size: 14px;
        padding: 6px 12px;
    }

    /* Create a horizontal logo-title section */
    .header-container {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: flex-start;
        align-items: center;
    }
    
    /* Adjust logo container */
    .logo-container {
        flex: 0 0 auto;
        margin-right: 8%;
        margin-bottom: 0;
        order: 1;
        text-align: center;
    }
    
    /* Position title next to logo */
    .title-container {
        flex: 1 1 auto;
        text-align: center;
        margin-right: 0;
        margin-bottom: 0;
        order: 2;
    }
    
    /* Position search below logo and title */
    .header-search-container {
        flex: 0 0 100%;
        margin: 15px 0 0 0;
        order: 3;
        width: 100%;
    }
    
    /* Position nav links below search */
    .nav-container {
        flex: 2 2 auto;
        margin: 15px 0 0 0;
        text-align: center;
        order: 3;
    }
    
    .nav-links {
        justify-content: center;
    }
}

/* Extra small devices */
@media (max-width: 360px) {

    .full-title {
    display: none;
    }

    .short-title {
    display: inline;
    font-size: 28px;
    color: #222;
    margin-bottom: 0;
    font-weight: 400;
    font-style: bold;
    letter-spacing: 0.05em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    }

    .header-search-input {
        min-height: 38px;
        padding: 10px;
        font-size: 13px;
    }
    
    .header-search-button {
        min-width: 60px;
        height: 38px;
        font-size: 13px;
    }
}

/* Scroll row container styles */
.scroll-row-container {
    background-color: rgba(255, 255, 255, 0.0);
    padding: 0px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.0);
    max-width: 1260px;
    margin: 0px auto;
    position: relative;
}

.row-title {
    font-size: 28px;
    font-weight: 400;
    margin-bottom: 0px;
    color: #333;
    text-align: center;
    font-style: italic;
    letter-spacing: 0.05em;
}

.row-title span {
    background-color: rgba(255, 255, 255, 0.8);
    padding: 10px 20px;
    border-radius: 12px;
    display: inline-block;
}

/* Scroll wrapper styles */
.scroll-wrapper {
    position: relative;
    overflow: hidden;
    background-color: transparent;
    height: 220px;
    display: flex;
    align-items: center;
}

/* Fade effect on left edge */
.scroll-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 40px;
    height: 100%;
    background: linear-gradient(to right, rgba(var(--bg-color-rgb), 1), rgba(var(--bg-color-rgb), 0));
    z-index: 2;
    pointer-events: none;
}

/* Fade effect on right edge */
.scroll-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 40px;
    height: 100%;
    background: linear-gradient(to left, rgba(var(--bg-color-rgb), 1), rgba(var(--bg-color-rgb), 0));
    z-index: 2;
    pointer-events: none;
}

.scroll-content {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    padding: 0px;
    justify-content: flex-start;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    background-color: transparent;
    align-items: center;
    height: 100%;
    overscroll-behavior-x: contain;
}

.scroll-content::-webkit-scrollbar {
    display: none;
}

/* Scroll item styles */
.scroll-item {
    flex: 0 0 auto;
    width: 280px;
    height: 180px;
    background-color: rgba(255, 255, 255, 1.0);
    border: 2px solid #444;
    border-radius: 8px;
    position: relative;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
}

.scroll-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.scroll-item.video-item {
    cursor: pointer;
    display: block;
}

/* Dark overlay scroll items */
.scroll-item-dark {
    flex: 0 0 auto;
    width: 280px;
    height: 180px;
    background-color: transparent;
    border: 2px solid #444;
    border-radius: 8px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    transform-origin: center center;
    overflow: hidden;
}

/* Video styling for dark items */
.scroll-item-dark .background-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

/* Dark semi-transparent overlay */
.scroll-item-dark .content-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1;
    transition: background-color 0.3s ease;
}

/* Lighten overlay slightly on hover */
.scroll-item-dark:hover .content-overlay {
    background-color: rgba(0, 0, 0, 0.4);
}

/* Content styling */
.scroll-item-dark .item-content {
    position: relative;
    z-index: 2;
    height: 100%;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background-color: transparent;
}

/* Text styling */
.scroll-item-dark .item-title {
    color: white;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
    padding: 20px 0px 0px 0px;
    font-size: 20px;
    font-weight: 400;
    margin-bottom: 8px;
    font-style: italic;
    letter-spacing: 0.02em;
}

.scroll-item-dark .item-description {
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    font-size: 14px;
    line-height: 1.5;
    font-style: italic;
}

/* Category badge for dark items */
.scroll-item-dark .category-container {
    position: absolute;
    bottom: -27px;
    left: 0px;
    display: flex;
    align-items: center;
    gap: 5px;
    z-index: 10;
}

/* Ellipse transform effect */
.scroll-content .scroll-item-dark {
    transform-origin: center center;
}

/* Play overlay styles */
.play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 10;
}

.play-icon {
    width: 0;
    height: 0;
    border-left: 20px solid #444;
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
    margin-left: 4px;
}

/* Item content styles */
.item-content {
    padding: 20px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background-color: rgba(255, 255, 255, 0.95);
    position: relative;
    z-index: 1;
    border-radius: 6px;
}

.item-title {
    padding: 20px 0px 0px 0px;
    font-size: 20px;
    font-weight: 400;
    margin-bottom: 8px;
    color: #222;
    font-style: italic;
    letter-spacing: 0.02em;
}

.item-description {
    font-size: 14px;
    color: #333;
    line-height: 1.5;
    font-style: italic;
}

/* Scroll arrow styles */
.scroll-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background-color: white;
    border: 2px solid #444;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    transition: all 0.2s ease;
    padding: 0;
    overflow: hidden;
}

.scroll-arrow:hover:not(:disabled) {
    background-color: #444;
    border-color: #222;
}

.scroll-arrow:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.scroll-arrow.left {
    left: 10px;
}

.scroll-arrow.right {
    right: 10px;
}

.probe-icon {
    width: 30px;
    height: 30px;
    object-fit: contain;
    transition: opacity 0.2s ease;
}

.probe-icon-default {
    display: block;
}

.probe-icon-hover {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.scroll-arrow:hover:not(:disabled) .probe-icon-default {
    display: none;
}

.scroll-arrow:hover:not(:disabled) .probe-icon-hover {
    display: block;
}

/* Category container styles */
.category-container {
    position: absolute;
    bottom: -27px;
    left: 0px;
    display: flex;
    align-items: center;
    gap: 5px;
    z-index: 10;
}

.category-icon {
    height: 22px;
    width: auto;
    object-fit: contain;
}

.category-badge {
    padding: 4px 12px;
    background-color: #444;
    color: white;
    font-size: 12px;
    font-weight: 400;
    text-transform: uppercase;
    border-radius: 4px;
    font-style: italic;
    letter-spacing: 0.1em;
    line-height: 1.15;
    border: 2px solid #444;
}

/* Modal styles */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay.show {
    opacity: 1;
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 1000px;
    background-color: #000;
    border-radius: 8px;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.show .modal-content {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 1001;
}

.modal-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.6);
}

.modal-close-icon {
    font-size: 24px;
    color: white;
    font-weight: 300;
    font-style: normal;
    line-height: 1;
}

.video-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
}

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

/* Search container styles */
.search-container {
    display: flex;
    justify-content: center;
    margin: 20px 0 40px 0;
}

.search-form {
    display: flex;
    width: 100%;
    max-width: 600px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 30px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.search-input {
    flex: 1;
    padding: 15px 20px;
    border: none;
    background: transparent;
    font-family: inherit;
    font-style: italic;
    font-size: 16px;
    outline: none;
}

.search-button {
    padding: 15px 25px;
    border: none;
    background: #444;
    color: white;
    cursor: pointer;
    font-family: inherit;
    font-style: italic;
    transition: background 0.3s;
}

.search-button:hover {
    background: #222;
}

/* Topic styles */
.topic-count {
    display: inline-block;
    background: #444;
    color: white;
    border-radius: 12px;
    padding: 3px 8px;
    font-size: 12px;
    margin-top: 10px;
}

a.scroll-item {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.scroll-item.topic-item:hover .item-content {
    background-color: rgba(255, 255, 255, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.scroll-content a.scroll-item.topic-item {
    transform-origin: center center;
    transition: all 0.3s ease;
}

/* Grid and card styles */
.valves-grid, .chambers-grid, .others-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(200px, 260px));
    gap: 20px;
    margin: 20px auto;
    max-width: 1120px;
    justify-content: center;
}

.valve-card {
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    border: 2px solid #444;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform 0.3s, box-shadow 0.3s;
    height: 200px;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.valve-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.valve-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    height: 100%;
    justify-content: space-between;
}

.valve-title {
    font-size: 20px;
    font-weight: 400;
    margin-bottom: 8px;
    color: #222;
    font-style: italic;
    letter-spacing: 0.02em;
}

.valve-description {
    font-size: 14px;
    color: #333;
    line-height: 1.5;
    font-style: italic;
}

.valve-badge {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 10px;
}

.valves-grid, .chambers-grid, .others-grid {
    display: grid;
}

.valves-carousel, .chambers-carousel, .others-carousel {
    display: none;
}

/* Special styling for pathology content */
.special-content {
    background-color: rgba(255, 245, 245, 0.95);
    border-left: 4px solid #e74c3c;
}

.pathology-badge {
    background-color: #e74c3c;
    color: white;
}

/* Video hover card styles */
.video-hover-card {
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease;
}

.background-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

.content-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    z-index: 1;
    transition: background-color 0.3s ease;
}

.video-hover-card:hover .content-overlay {
    background-color: rgba(255, 255, 255, 0.6);
}

.video-hover-card .valve-content,
.video-hover-card .item-content {
    position: relative;
    z-index: 2;
    background-color: transparent;
}

/* Dark overlay variant */
.video-hover-card.dark-overlay .content-overlay {
    background-color: rgba(0, 0, 0, 0.5);
    transition: background-color 0.3s ease;
}

.video-hover-card.dark-overlay:hover .content-overlay {
    background-color: rgba(0, 0, 0, 0.3);
}

/* White text for dark overlay */
.video-hover-card.dark-overlay .valve-title,
.video-hover-card.dark-overlay .valve-description,
.video-hover-card.dark-overlay .item-title,
.video-hover-card.dark-overlay .item-description {
    color: white;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.7);
}

.video-hover-card.dark-overlay:hover .valve-title,
.video-hover-card.dark-overlay:hover .valve-description,
.video-hover-card.dark-overlay:hover .item-title,
.video-hover-card.dark-overlay:hover .item-description {
    text-shadow: 1px 1px 5px rgba(0, 0, 0, 0.9);
}

/* Structural heart grid styles */
.structural-heart-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(200px, 260px));
    gap: 20px;
    margin: 20px auto;
    max-width: 1120px;
    justify-content: center;
}

.structural-heart-card {
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    border: 2px solid #444;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform 0.3s, box-shadow 0.3s;
    height: 200px;
    display: flex;
    flex-direction: column;
    width: 100%;
    position: relative;
}

.structural-heart-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: 100%;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.5;
    z-index: 0;
}

.structural-heart-card.shd-card::before {
    background-image: url('../images/sketched-heart.png');
    background-position: left 40%;
}

.structural-heart-card.imaging-card::before {
    background-image: url('../images/sketched-probe.png');
    background-position: center 70%;
    background-size: 120%;
}

.structural-heart-card.hf-card::before {
    background-image: url('../images/sketched-foxglove.png');
    background-position: left 50%;
    background-size: 120%;
}

.structural-heart-card.multi-card::before {
    background-image: url('../images/sketched-puzzle.png');
    background-position: center 45%;
}

.structural-heart-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.structural-heart-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    height: 100%;
    justify-content: space-between;
    position: relative;
    z-index: 1;
}

.structural-heart-title {
    font-size: 20px;
    font-weight: 400;
    margin-bottom: 8px;
    color: #222;
    font-style: italic;
    letter-spacing: 0.02em;
}

.structural-heart-description {
    font-size: 14px;
    color: #333;
    line-height: 1.5;
    font-style: italic;
}

.structural-heart-carousel {
    display: none;
}

/* Chamber card background image styles */
.chamber-card {
    position: relative;
    overflow: hidden;
}

.chamber-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: 100%;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.2;
    z-index: 0;
}

/* Right Atrium */
.chamber-card.ra-card::before {
    background-image: url('../images/sketched-right-atrium.png');
    background-position: center 40%;
}

/* Right Ventricle */
.chamber-card.rv-card::before {
    background-image: url('../images/sketched-right-ventricle.png');
    background-position: center 45%;
}

/* Left Atrium */
.chamber-card.la-card::before {
    background-image: url('../images/sketched-left-atrium.png');
    background-position: center 40%;
}

/* Left Ventricle */
.chamber-card.lv-card::before {
    background-image: url('../images/sketched-left-ventricle.png');
    background-position: center 60%;
}

/* Aorta */
.chamber-card.aorta-card::before {
    background-image: url('../images/aorta.png');
    background-position: center 50%;
}

/* Pulmonary Trunk */
.chamber-card.pt-card::before {
    background-image: url('../images/pulmonary-trunk.png');
    background-position: center 50%;
}

/* Left Atrial Appendage */
.chamber-card.la-appendage-card::before {
    background-image: url('../images/left-atrial-appendage.png');
    background-position: center 50%;
}

/* Congenital HD */
.chamber-card.congenital-hd-card::before {
    background-image: url('../images/vsd-repair.png');
    background-position: center 50%;
}

/* Ensure content appears above the background image */
.chamber-content {
    position: relative;
    z-index: 1;
}

/* Mobile chamber card styles for scroll items */
.scroll-item.topic-item.ra-card::before,
.scroll-item.topic-item.rv-card::before,
.scroll-item.topic-item.la-card::before,
.scroll-item.topic-item.lv-card::before,
.scroll-item.topic-item.aorta-card::before,
.scroll-item.topic-item.pt-card::before,
.scroll-item.topic-item.la-appendage-card::before,
.scroll-item.topic-item.congenital-hd-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: 100%;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.5;
    z-index: 0;
}

.scroll-item.topic-item.ra-card::before {
    background-image: url('../images/sketched-right-atrium.png');
    background-position: center 40%;
}

.scroll-item.topic-item.rv-card::before {
    background-image: url('../images/sketched-right-ventricle.png');
    background-position: center 45%;
}

.scroll-item.topic-item.la-card::before {
    background-image: url('../images/sketched-left-atrium.png');
    background-position: center 40%;
}

.scroll-item.topic-item.lv-card::before {
    background-image: url('../images/sketched-left-ventricle.png');
    background-position: center 45%;
}

.scroll-item.topic-item.aorta-card::before {
    background-image: url('../images/aorta.png');
    background-position: center 50%;
}

.scroll-item.topic-item.pt-card::before {
    background-image: url('../images/pulmonary-trunk.png');
    background-position: center 50%;
}

.scroll-item.topic-item.la-appendage-card::before {
    background-image: url('../images/left-atrial-appendage.png');
    background-position: center 50%;
}

.scroll-item.topic-item.congenital-hd-card::before {
    background-image: url('../images/vsd-repair.png');
    background-position: center 50%;
}

/* Ensure content appears above the background image for scroll items */
.scroll-item.topic-item .item-content {
    position: relative;
    z-index: 1;
}

/* Media query adjustments for smaller screens */
@media (max-width: 768px) {
    /* Ensure background images work in grid view */
    .chamber-card::before,
    .scroll-item.topic-item.ra-card::before,
    .scroll-item.topic-item.rv-card::before,
    .scroll-item.topic-item.la-card::before,
    .scroll-item.topic-item.lv-card::before,
    .scroll-item.topic-item.aorta-card::before,
    .scroll-item.topic-item.pt-card::before,
    .scroll-item.topic-item.la-appendage-card::before,
    .scroll-item.topic-item.congenital-hd-card::before {
        background-size: 120%; /* Slightly larger for better visibility on small screens */
    }
}

@media (max-width: 480px) {
    /* Further adjust for very small screens */
    .chamber-card::before,
    .scroll-item.topic-item.ra-card::before,
    .scroll-item.topic-item.rv-card::before,
    .scroll-item.topic-item.la-card::before,
    .scroll-item.topic-item.lv-card::before,
    .scroll-item.topic-item.aorta-card::before,
    .scroll-item.topic-item.pt-card::before,
    .scroll-item.topic-item.la-appendage-card::before,
    .scroll-item.topic-item.congenital-hd-card::before {
        background-size: 140%; /* Even larger for very small screens */
    }
}

/* NEW FEATURED VIDEO STYLES */
/* Full-width thumbnail styling */
.content-thumbnail {
    height: 100%;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.full-thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

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

/* Title overlay with blur effect */
.title-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 10px 15px;
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px); /* For Safari */
    z-index: 5;
}

.title-overlay .item-title {
    margin: 0;
    padding: 0;
    font-size: 16px;
    color: #222;
    font-weight: 400;
    line-height: 1.3;
}

/* Mobile Grid Styles (new) */
@media (max-width: 768px) {
    /* Hide carousels and show grids instead */
    .valves-carousel, .chambers-carousel, .others-carousel, .structural-heart-carousel {
        display: none !important;
    }
    
    .valves-grid, .chambers-grid, .others-grid, .structural-heart-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        padding: 0 10px;
    }
    
    /* Make grid items smaller to fit in 2 columns */
    .valve-card, .chamber-card, .other-card, .structural-heart-card {
        height: 180px;
        width: 100%;
    }
    
    /* Adjust titles and descriptions to fit in smaller cards */
    .valve-title, .chamber-title, .other-title, .structural-heart-title {
        font-size: 16px;
        margin-bottom: 5px;
    }
    
    .valve-description, .chamber-description, .other-description, .structural-heart-description {
        font-size: 12px;
        line-height: 1.3;
    }
    
    /* Convert scroll carousels to grids for content items */
    .scroll-wrapper {
        height: auto;
        overflow: visible;
    }
    
    .scroll-content {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        overflow: visible;
        padding: 0 10px;
        height: auto;
    }
    
    /* Hide scrolling controls for mobile */
    .scroll-arrow {
        display: none;
    }
    
    /* Adjust scroll items to fit grid */
    .scroll-item, .scroll-item-dark {
        width: 100%;
        height: 160px;
        margin-bottom: 20px; /* Add space between rows */
    }
    
    /* Ensure category badges don't overflow */
    .category-container {
        bottom: -20px;
    }
    
    .category-badge {
        padding: 2px 8px;
        font-size: 10px;
    }
    
    .category-icon {
        height: 18px;
    }
    
    /* Fix content that might overflow */
    .item-title {
        font-size: 16px;
        padding-top: 10px;
    }
    
    .item-description {
        font-size: 12px;
        line-height: 1.3;
    }
    
    /* Title overlay for featured content */
    .title-overlay {
        padding: 6px 10px;
    }
    
    .title-overlay .item-title {
        font-size: 13px;
    }
    
    /* Fix padding around grid containers */
    .scroll-row-container {
        margin: 0px auto;
    }
    
    /* Remove fade effects on wrapper edges since we're not scrolling */
    .scroll-wrapper::before, 
    .scroll-wrapper::after {
        display: none;
    }
    
    /* Fix for featured section - make it full width */
    .row-title span {
        width: 80%;
        display: inline-block;
    }
}

/* Even smaller screens (mobile phones) */
@media (max-width: 480px) {
    /* Adjust spacing and sizing for phone screens */
    .valves-grid, .chambers-grid, .others-grid, .structural-heart-grid,
    .scroll-content {
        gap: 10px;
    }
    
    .valve-card, .chamber-card, .other-card, .structural-heart-card,
    .scroll-item, .scroll-item-dark {
        height: 150px;
    }
    
    .valve-title, .chamber-title, .other-title, .structural-heart-title,
    .item-title {
        font-size: 14px;
    }
    
    .valve-description, .chamber-description, .other-description, 
    .structural-heart-description, .item-description {
        font-size: 11px;
    }
    
    /* Reduce padding for small screens */
    .valve-content, .chamber-content, .other-content, 
    .structural-heart-content, .item-content {
        padding: 12px;
    }
    
    /* Adjust search container for smaller screens */
    .search-container {
        margin: 15px 0 25px 0;
    }
    
    .search-input {
        padding: 10px 15px;
        font-size: 14px;
    }
    
    .search-button {
        padding: 10px 15px;
    }
    
    /* Fix popular topics section */
    .topic-count {
        font-size: 10px;
        padding: 2px 6px;
    }

    .adjusted-row-title {
        margin-bottom: 20px;
    }



}