/* Media Gallery Styles */

.media-gallery-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 20000;
    /* Top-most */
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* Light Theme Overrides for Gallery */
[data-theme="light"] .media-gallery-modal {
    background: #ffffff;
}

[data-theme="light"] .media-gallery-header {
    background: #f5f5f5;
    color: #000;
    border-bottom: 1px solid #ddd;
}

[data-theme="light"] .media-tab {
    color: #707579;
}

[data-theme="light"] .media-tab:hover {
    color: #3390ec;
    background-color: rgba(51, 144, 236, 0.1);
}

[data-theme="light"] .media-tab.active {
    color: #3390ec;
    border-bottom: 2px solid #3390ec;
}

/* Sidebar Open Adjustments for Desktop */
@media (min-width: 769px) {
    body.sidebar-open .media-gallery-modal {
        left: 320px !important;
        width: calc(100% - 320px) !important;
    }
}

.media-gallery-header {
    padding: 15px 20px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.media-tabs {
    display: flex;
    gap: 20px;
    padding: 10px;
    justify-content: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.media-tab {
    color: #aaa;
    cursor: pointer;
    padding: 10px 15px;
    font-weight: 500;
    transition: color 0.2s;
    border-radius: 4px 4px 0 0;
    /* Slight visual tweak */
}

.media-tab:hover {
    color: #eee;
}

.media-tab.active {
    color: white;
    border-bottom: 2px solid #3390ec;
}

.media-grid {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    grid-auto-rows: max-content;
    gap: 15px;
    align-content: start;
    padding-bottom: 50px;
}

.media-grid-item {
    aspect-ratio: 1;
    background: #222;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s;
}

[data-theme="light"] .media-grid-item {
    background: #f0f0f0;
    border: 1px solid #ddd;
}

.media-grid-item:hover {
    transform: scale(1.02);
}

.media-grid-item img,
.media-grid-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-grid-item .type-icon {
    position: absolute;
    bottom: 5px;
    right: 5px;
    font-size: 12px;
    background: rgba(0, 0, 0, 0.6);
    padding: 2px 4px;
    border-radius: 4px;
    color: white;
}

/* Audio Waveform Visualization */
.waveform-visual {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 40px;
    width: 80%;
}

.waveform-bar {
    width: 4px;
    background-color: white;
    border-radius: 2px;
    animation: wave 1.2s ease-in-out infinite;
}

[data-theme="light"] .waveform-bar {
    background-color: #3390ec;
}

@keyframes wave {

    0%,
    100% {
        height: 10px;
    }

    50% {
        height: 30px;
    }
}

/* Stagger animations */
.waveform-bar:nth-child(1) {
    animation-delay: 0.0s;
}

.waveform-bar:nth-child(2) {
    animation-delay: 0.1s;
}

.waveform-bar:nth-child(3) {
    animation-delay: 0.2s;
}

.waveform-bar:nth-child(4) {
    animation-delay: 0.3s;
}

.waveform-bar:nth-child(5) {
    animation-delay: 0.4s;
}

.waveform-bar:nth-child(6) {
    animation-delay: 0.5s;
}

/* Extended for 6 bars */

@media (max-width: 480px) {
    .media-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .media-gallery-modal {
        width: 100vw !important;
        left: 0 !important;
    }
}