/* Thumbnail Grid */
#thumbnail-grid-container {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    margin: 20px 0px;
    padding: 20px;
    width: 75vw;
    max-width: 450px;
    backdrop-filter: blur(5px);
    max-height: 60vh;
    overflow-y: auto;
    align-content: start;

    /* --- Fade Effect with Masking --- */
    -webkit-mask-image: linear-gradient(to bottom,
        rgba(0, 0, 0, 0.25) 0%,
        rgba(0, 0, 0, 1.0) 5%,
        rgba(0, 0, 0, 1.0) 95%,
        rgba(0, 0, 0, 0.25) 100%
    );
    mask-image: linear-gradient(to bottom,
        rgba(0, 0, 0, 0.25) 0%,
        rgba(0, 0, 0, 1.0) 5%,
        rgba(0, 0, 0, 1.0) 95%,
        rgba(0, 0, 0, 0.25) 100%
    );
}

.thumbnail {
    flex: none;
    width: 175px;
    height: 210px;
    margin: 0px auto;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 10px;
    transition: transform 0.2s ease-in-out;
    
    &:hover {
        transform: translateY(-5px);
    }
    
    img {
    display: block;
    width: 150px;
    height: 125px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid rgb(145, 145, 145, 0.15);
    box-shadow: 0 2px 4px rgba(145, 145, 145, 0.35);
    cursor: pointer;
    }
    
    &:not(:has(img)):not(:has(video)) {
        display: none;
    }
}

@media screen and (max-width: 515px) {
    #thumbnail-grid-container {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        padding-top: 10px;
        gap: 10px;
        width: 75vw;
        max-width: 350px;
    }
    .thumbnail {
        width: 125px;
        height: 190px;
        padding: 20px;
    }
    .thumbnail-caption {
        padding: 5px 0px 20px;
    }   
}

@media screen and (max-width: 475px) {
    #thumbnail-grid-container {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        padding: 15px;
        width: 75vw;
        max-width: 350px;
    }
    .thumbnail {
        width: 55vw;
        height: 200px;
        margin-top: 10px;
    }
    .thumbnail-caption {
        padding: 5px 0px 20px;
    }   
}

.thumbnail-caption {
    font-size: 14px;
    color: #fff;
    padding: 5px 0px 10px;
    margin: 0px 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 90%;
}

.thumbnail-actions-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: 8px;
    gap: 10px;
    width: 100%;
}

.thumbnail-action-btn {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 5px;
    padding: 0;
    font-size: 14px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
}

.thumbnail-action-btn:hover {
    background-color: rgba(255, 255, 255, 0.4);
}
.thumbnail-action-btn.thumbnail-delete-btn:hover {
    background-color: rgba(255, 100, 100, 0.3);
    color: white;
}

.no-media-message,
.error-message {
    width: 100%;
    text-align: center;
    color: #aaa;
    font-style: italic;
    margin: 20px auto;
    grid-column: 1 / -1;
}

.error-message {
    color: #ff6b6b;
}

.hidden {
    display: none !important;
}

/* Media Lightbox */
#lightbox {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 1050;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.lightbox-content-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.lightbox-content {
    position: relative;
    max-width: 100%;
    max-height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: default;
    box-sizing: border-box;
}

#lightbox-image,
#lightbox-video {
    max-width: 100%;
    max-height: 100%;
    margin: 0;
    display: none;
    object-fit: contain;
    width: 100%;
    height: 100%;
    cursor: grab;
}

.lightbox-close {
    position: absolute;
    top: 55px;
    right: 75px;
    color: #bc1515;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1051;
}

.lightbox-action-btn {
    background-color: rgba(255, 255, 255, 0.75);
    color: rgba(60, 60, 60, 0.75);
    border: 1px solid rgba(60, 60, 60, 0.25);
    border-radius: 5px;
    padding: 0;
    font-size: 16px;
    width: 38px;
    height: 38px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
    z-index: 1052;
}

.lightbox-action-btn:hover {
    background-color: rgba(255, 255, 255, 0.4);
}

.lightbox-delete-above-btn {
    position: absolute;
    top: 2.5%;
}

.lightbox-actions-below {
    display: flex;
    gap: 15px;
    margin-top: 15px;
    position: absolute;
    bottom: 2.5%;
}

.lightbox-content-wrapper {
  overflow: auto;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
}

.lightbox-content {
  position: relative;
}

#lightbox-image {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  margin: auto;
}

#lightbox.hidden {
  display: none !important;
}

/* Audio Container */
.audio-catalog-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    margin: 20px 0px;
    padding: 15px;
    width: 75vw;
    max-width: 450px;
    backdrop-filter: blur(5px);
    max-height: 60vh;
    overflow-y: auto;

    /* --- Fade Effect with Masking --- */
    -webkit-mask-image: linear-gradient(to bottom,
        rgba(0, 0, 0, 0.25) 0%,
        rgba(0, 0, 0, 1.0) 5%,
        rgba(0, 0, 0, 1.0) 95%,
        rgba(0, 0, 0, 0.25) 100%
    );
    mask-image: linear-gradient(to bottom,
        rgba(0, 0, 0, 0.25) 0%,
        rgba(0, 0, 0, 1.0) 5%,
        rgba(0, 0, 0, 1.0) 95%,
        rgba(0, 0, 0, 0.25) 100%
    );
}

.audio-catalog-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.audio-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 5px;
    border: 1px solid rgba(255,255,255,0.1);
}

.audio-item-title {
    color: #eee;
    font-size: 0.9em;
    flex-grow: 1;
    margin-right: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.audio-transcription-text {
    color: #ccc;
    font-size: 0.8em;
    margin-top: 5px;
    margin-bottom: 10px;
    text-align: left;
    width: 100%;
    max-height: 4.5em; /* Limit height to about 3 lines */
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.5em;
}

.audio-item-controls button.audio-play-pause-btn {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.2);
    width: 30px;
    height: 30px;
    font-size: 14px;
    border-radius: 50%;
}

.audio-item-controls {
    display: flex;
    gap: 8px;
}

.audio-item-controls button.audio-play-pause-btn,
.audio-item-controls button.audio-view-entry-btn {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.audio-item-controls button.audio-play-pause-btn:hover,
.audio-item-controls button.audio-view-entry-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Media Type Filter */
.media-page-actions-container {
    display: flex;
    justify-content: center;
    gap: 15px;              
    margin: 10px 0px 20px;        
    width: 80%;            
}

.media-page-actions-container .neumorphic-btn {
    padding: 10px 25px;
    min-width: 120px;
    background-color: rgba(45, 45, 45, 0.5);
}

.media-page-actions-container .neumorphic-btn.active-filter {
    background-color: rgba(55,55,55,0.75);
    color: white;
    box-shadow: inset 1px 1px 3px rgba(0,0,0,0.3), inset -1px -1px 3px rgba(255,255,255,0.1);
}

/* Audio Catalog */
.audio-catalog-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    margin: 20px 0px;
    padding: 15px;
    width: 75vw;
    max-width: 450px;
    backdrop-filter: blur(5px);
    max-height: 60vh;
    overflow-y: auto;

    /* --- Fade Effect with Masking (same as thumbnail grid) --- */
    -webkit-mask-image: linear-gradient(to bottom,
        rgba(0, 0, 0, 0.25) 0%,
        rgba(0, 0, 0, 1.0) 5%,
        rgba(0, 0, 0, 1.0) 95%,
        rgba(0, 0, 0, 0.25) 100%
    );
    mask-image: linear-gradient(to bottom,
        rgba(0, 0, 0, 0.25) 0%,
        rgba(0, 0, 0, 1.0) 5%,
        rgba(0, 0, 0, 1.0) 95%,
        rgba(0, 0, 0, 0.25) 100%
    );
}

.audio-catalog-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.audio-list-item {
    display: flex;
    justify-content: space-between;
    flex-direction: column; 
    align-items: center;
    padding: 10px 15px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 5px;
    border: 1px solid rgba(255,255,255,0.1);
}

.audio-item-title {
    color: #eee;
    width: 100%;
    text-align: left;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.audio-waveform-wrapper {
    width: 100%;
    margin-bottom: 8px;
}

.audio-player-ui {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.audio-waveform-canvas {
    width: 100%;
    height: 50px;
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    border: 1px solid rgba(128, 128, 128, 0.5);
    display: block;
}

.audio-time-controls {
    width: 100%;
}

.audio-progress-slider {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    cursor: pointer;
    outline: none;
}

.audio-progress-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: #ccc;
    border-radius: 50%;
    cursor: pointer;
}

.audio-progress-slider::-moz-range-thumb { /* Firefox */
    width: 14px;
    height: 14px;
    background: #ccc;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.audio-time-display {
    font-size: 0.75em;
    color: #bbb;
    text-align: right;
    margin-top: 4px;
}

.audio-item-all-actions-wrapper {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    width: 100%;
    margin-top: 8px;
}

.audio-item-controls {
    display: flex;
    gap: 8px; 
}

.audio-item-controls button.audio-play-pause-btn,
.audio-item-controls button.audio-view-entry-btn,
.audio-item-all-actions-wrapper button.audio-delete-btn {
    color: #fff;
    border: 1px solid rgba(255,255,255,0.2);
    width: 30px;
    height: 30px;
    font-size: 14px;
    border-radius: 50%;
    transition: background-color 0.2s ease-in-out;
}

.audio-item-controls button.audio-play-pause-btn {
    background-color: rgba(255, 255, 255, 0.1);
}

.audio-item-controls button.audio-view-entry-btn {
    background-color: rgba(100, 100, 100, 0.3);
}

.audio-item-all-actions-wrapper button.audio-delete-btn {
    background-color: transparent;
    border: 1px solid rgba(255, 100, 100, 0.4);
    color: rgba(255, 100, 100, 0.7);
    border-radius: 5px;
    width: 32px;
    height: 32px;
    padding: 0;
}

.audio-item-controls button.audio-play-pause-btn:hover,
.audio-item-controls button.audio-view-entry-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.audio-item-all-actions-wrapper button.audio-delete-btn:hover {
    background-color: rgba(255, 100, 100, 0.2);
    color: rgba(255, 100, 100, 1);
    border-color: rgba(255, 100, 100, 0.7);
}