/* gallery-styles.css */
.custom-gallery-container {
    --primary-color: #E50023;
    --background-color: #f5f5f5;
    --text-color: #333;
    --card-background: #fff;
    /* Default: desktop ratio */
    --thumb-ratio: 16/9;
}

/* Modal styles for videos */
.msg-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.msg-modal-content {
    background: #111;
    color: #fff;
    max-width: 1000px;
    width: 100%;
    border-radius: 8px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.msg-modal-header { padding: 12px 48px 8px 16px; }
.msg-modal-title { font-size: 1.1rem; }
.msg-modal-close {
    position: absolute;
    top: 8px; right: 8px;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}
.msg-modal-open { overflow: hidden; }

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.album-card, .media-card {
    background: var(--card-background);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
    text-decoration: none;
    color: var(--text-color);
}

.album-card:hover, .media-card:hover {
    transform: translateY(-5px);
}

/* Unified thumbnail sizing with fixed height */
.card-image {
    display: block;
    width: 100%;
    height: 200px;
    object-fit: cover;
    object-position: center;
    background: #000; /* prevents white bars during load */
}

/* Ensure media cards also have proper image sizing */
.media-card .card-image,
.media-card img {
    display: block;
    width: 100%;
    height: 200px;
    object-fit: cover;
    object-position: center;
    background: #000;
}

/* Video thumbnails in media cards */
.media-card .video-thumbnail { position: relative; }
.media-card .video-thumbnail img {
    height: 200px;
    object-fit: cover;
    object-position: center;
}
/* Title overlay on video thumbnails */
.media-card .video-thumbnail .video-title {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    padding: 8px 10px;
    color: #fff;
    background: linear-gradient(transparent, rgba(0,0,0,0.75));
    font-size: 0.95rem;
}
/* PDF/doc thumbnails title overlay */
.media-card .doc-thumbnail { position: relative; }
.media-card .doc-thumbnail .doc-title {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    padding: 8px 10px;
    color: #fff;
    background: linear-gradient(transparent, rgba(0,0,0,0.75));
    font-size: 0.95rem;
}

/* Ensure album cards (folders) also have proper image sizing */
.album-card .card-image,
.album-card img {
    display: block;
    width: 100%;
    height: 200px;
    object-fit: cover;
    object-position: center;
    background: #000;
}

.card-content {
    padding: 15px;
}

.card-title {
    margin: 0;
    font-size: 1.2em;
    color: var(--primary-color);
}

.card-description {
    margin: 10px 0;
    font-size: 0.9em;
}

.subalbum-count {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    margin-top: 5px;
}

.breadcrumb {
    margin: 20px 0;
    padding: 10px;
    background: var(--card-background);
    border-radius: 4px;
}

.breadcrumb a {
    color: var(--primary-color);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.video-thumbnail {
    position: relative;
}

.video-thumbnail::after {
    content: '▶';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2em;
    color: white;
    text-shadow: 0 0 10px rgba(0,0,0,0.5);
}

.back-link {
    display: inline-block;
    margin: 20px 0;
    padding: 10px 20px;
    background: var(--primary-color);
    color: white !important;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.back-link:hover {
    background-color: #2980b9;
    text-decoration: none;
}

/* Responsive columns */
@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    .card-image,
    .media-card .card-image,
    .media-card img,
    .media-card .video-thumbnail img,
    .album-card .card-image,
    .album-card img {
        height: 180px;
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: 1fr;
    }
    .card-image,
    .media-card .card-image,
    .media-card img,
    .media-card .video-thumbnail img,
    .album-card .card-image,
    .album-card img {
        height: 160px;
    }
}

/* Video default thumbnail matches image sizing */
.default-video-thumbnail {
    background: #2c3e50;
    width: 100%;
    height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    position: relative;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

@media (max-width: 768px) {
    .default-video-thumbnail {
        height: 180px;
    }
}

@media (max-width: 480px) {
    .default-video-thumbnail {
        height: 160px;
    }
}

.default-video-thumbnail:hover {
    background: #34495e;
}

.video-icon {
    font-size: 3em;
    margin-bottom: 10px;
}

.video-title {
    font-size: 1.1em;
    padding: 0 15px;
    text-align: center;
    position: absolute;
    bottom: 15px;
    left: 0;
    right: 0;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
}

.video-thumbnail .default-video-thumbnail:hover .video-icon {
    transform: scale(1.1);
    transition: transform 0.3s ease;
}

/* Fallback for browsers without aspect-ratio support - not needed with fixed heights */
