.smartwoo-audio-playlist {
    width: 100%;
    max-width: 400px;
    max-height: 500px;
    display: block;
    position: relative;
    background-color: #FFFFFF;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    padding: 10px;
    margin: 8px auto;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.smartwoo-audio-player {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.smartwoo-audio-player__thumbnail {
    width: 100%;
    height: 200px;
    box-shadow: 2px 4px 9px 2px rgb(0 0 0 / 22%);
    border-radius: 10px;
    transition: all 0.5s ease-in-out;
}

.smartwoo-audio-playlist.playlist-active .smartwoo-audio-player__thumbnail {
    height: 0;
    box-shadow: none;
    border-radius: 0;
}

.smartwoo-audio-player__thumbnail img.smartwoo-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
}

.smartwoo-audio-player__layout {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin-top: 10px;
    gap: 10px;
    transition: all 0.5s ease-in-out;
}

.smartwoo-audio-player__now-playing {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap:  5px;
}

.smartwoo-audio-player__now-playing  span:first-child {
    font-weight: bold;
}
.smartwoo-audio-player__now-playing span:nth-last-of-type(2) {
    font-size: 26px;
    color: #88806e;
}
.smartwoo-audio-player__now-playing span:last-child {
    font-size: 14px;
    color: #333333;
}

.smartwoo-audio-player__seek {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.smartwoo-audio-player__progress {
    width: 100%;
    height: 8px;
    background-color: #eee;
    border-radius: 4px;
    position: relative;
    cursor: pointer;
    overflow: hidden;
}
.smartwoo-audio-player__progress .smartwoo-progress-bar {
    height: 100%;
    background-color: #4caf50;
    width: 0%;
    transition: width 0.1s ease-in-out;
    border-radius: 4px;
}

.smartwoo-audio-player__time {
    display: block;
    font-size: 12px;
    color: #666;
}

.smartwoo-audio-player__controls {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-left: 8px;
    padding-right: 10px;
}

.smartwoo-audio-playlist.playlist-active .smartwoo-audio-player__layout {
    padding: 10px;
    background-color: #f9f9f9;
    border-radius: 10px;
    box-shadow: 2px 4px 9px 2px rgb(0 0 0 / 22%);

}

.smartwoo-audio-player__controls .smartwoo-audio-player__control-group {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 5px;
}

.smartwoo-audio-player__control-group.smartwoo-audio-player-controls {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    width: 60%;
    padding: 5px;
    
}
.smartwoo-audio-player__control-group.smartwoo-audio-player-controls .smartwoo-control {
    font-size: 34px;
    color: #4caf50;
}

.smartwoo-audio-player__control-group.smartwoo-audio-player-controls .smartwoo-control.smartwoo-prev:before {
    font-family: 'dashicons';
    content: "\f516";
}

.smartwoo-audio-player .play-pause-toggle{
    border: 1px solid #dcdcde;
    border-radius: 50%;
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.smartwoo-audio-player__control-group.smartwoo-audio-player-controls .smartwoo-control.smartwoo-next:before {
    margin-left: -15px;
}


.smartwoo-audio-player__control-group.smartwoo-audio-player-controls .smartwoo-control.smartwoo-pause:before {
    font-family: 'dashicons';
    content: "\f523";
    vertical-align: middle;
    font-size: 40px;
}

.smartwoo-audio-player__control-group.smartwoo-audio-player-controls .smartwoo-control.smartwoo-play:before {
    font-family: 'dashicons';
    content: "\f522";
    vertical-align: middle;
    font-size: 40px;
    margin-left: 8px;
}

.smartwoo-audio-player__controls .smartwoo-audio-player__control-group span {
    cursor: pointer;
    font-size: 26px;
    color: #333;
}

.smartwoo-audio-player__playlist {
    display: block;
    position: relative;
    width: 100%;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.5s ease-in-out, padding 0.5s ease-in-out;
}

ul.smartwoo-playlist {
    display: flex;
    flex-direction: column;
    gap: 10px;
    list-style: none;
    padding: 0;
    margin: 10px 0;
    transform: translateY(100%);
    transition: all 0.5s ease-in-out;
}
.smartwoo-audio-playlist.playlist-active .smartwoo-audio-player__playlist {
    max-height: 500px;
    overflow-y: auto;
    height: 200px;
}
.smartwoo-audio-playlist.playlist-active ul.smartwoo-playlist {
    transform: translateY(0);
    transition: all 0.5s ease-in-out;
}

ul.smartwoo-playlist li.smartwoo-playlist__item {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.5s ease-in-out;
    position: relative;
    min-height: 30px;
    width: 90%;
}

ul.smartwoo-playlist li.smartwoo-playlist__item:hover {
    background-color: #f0f0f0;
}

ul.smartwoo-playlist li.smartwoo-playlist__item.is-active {
    background-color: #4caf50;
    color: #fff;
}
.smartwoo-playlist__title {
    overflow-wrap: anywhere;
}

audio.smartwoo-audio {
    display: none;
}

.smartwoo-audio-player__control-group.smartwoo-audio-player-volume-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    position: relative;
}
.smartwoo-volume-slider {
    opacity: 0;
    width: 70px;
    height: 6px;
    background-color: #eee;
    border-radius: 4px;
    position: absolute;
    bottom: -15px;
    left: -4px;
    cursor: pointer !important;
    transition: opacity 0.3s ease-in-out;
}
.smartwoo-audio-player__control-group.smartwoo-audio-player-volume-container:hover .smartwoo-volume-slider {
    opacity: 1;
}
.smartwoo-volume-slider .smartwoo-volume-progress {
    height: 100%;
    background-color: #4caf50;
    width: 0%;
    transition: width 0.1s ease-in-out;
    border-radius: 4px;
    cursor: pointer !important;
}

.smartwoo-video-player-container {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    overflow: hidden;
}

.smartwoo-video-player-container:focus {
    outline: none;
}

.smartwoo-video-player-left {
    width: 65%;
    box-shadow: 2px 4px 9px 2px rgb(0 0 0 / 22%);
    background-color: transparent;
    border-radius: 10px;
    overflow: hidden;
    max-height: 400px;
}

.smartwoo-video-player-right {
    position: relative;
    width: 32%;
    box-shadow: 2px 4px 9px 2px rgb(0 0 0 / 22%);
    border-radius: 10px;
    padding: 5px;
    max-height: 400px;
    background-color: #FFFFFF;
}

.smartwoo-video-player-right h3 {
    font-size: 20px;
    font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
    color: #6600ff;
    padding: 5px 10px;
    margin: 8px;
}
.smartwoo-video-player__frame {
    position: relative;
    width: 100%;
    height: 400px;
    background-color: #000000;
    aspect-ratio: 16 / 9;
}

.smartwoo-video-player__frame span.mce-preview-object.mce-object-video {
    position: relative;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: unset;
}

video.smartwoo-video-player__video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.smartwoo-video-player__frame.is-portriate video.smartwoo-video-player__video {
    object-fit: contain;
}
.smartwoo-video-nowplaying-info {
    position: absolute;
    color: #FFFFFF;
    font-weight: 700;
    font-size: 16px;
    width: 100%;
    padding: 10px;
    margin: 0;
    background-color: #33333361;
    opacity: 0;
    transition: all .5s ease-in-out;
}
.smartwoo-video-playlist-toggle {
    margin-right: 20px;
    position: absolute;
    right: 0;
    font-size: 30px;
    display: none;
}
.smartwoo-video-player__frame.is-paused .smartwoo-video-nowplaying-info,
.smartwoo-video-player__frame.is-hovered .smartwoo-video-nowplaying-info {
    opacity: 1;
}

.smartwoo-video-player-controls {
    position: absolute;
    bottom: 0;
    color: #FFFFFF;
    display: flex;
    flex-direction: column;
    padding: 5px;
    width: 100%;
    background-color: #333333c1;
    opacity: 0;
    max-height: 0;
    transition: all .5s ease-in-out;
}

.smartwoo-video-player__frame.is-paused .smartwoo-video-player-controls,
.smartwoo-video-player__frame.is-hovered .smartwoo-video-player-controls {
    opacity: 1;
    max-height: 400px;
    transition: all .5s ease-in-out;
}

.smartwoo-video-player__controls {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    margin: 10px 15px 7px 5px;
}

.smartwoo-video-player__controls-right {
    display: flex;
    flex-direction: row;
    gap: 10px;
    position: relative;
    align-items: center;
}

.smartwoo-video-volume-slider {
    display: inline-flex;
    align-items: center;
    width: 100px;
    height: 6px;
    background-color: #FFFFFF;
    border-radius: 10px;
    transition: width 0.1s ease-in-out;
    cursor: pointer;
}
.smartwoo-video-volume-slider .smartwoo-video-volume-progress {
    background-color: #4caf50;
    height: 100%;
    width: 0%;
    transition: width 0.1s ease-in-out;
    border-radius: 10px;
}

.smartwoo-video-volume-scrubber {
    border-radius: 50%;
    height: 12px;
    width: 12px;
    margin-left: -3px;
    background-color: #4caf50;
}

.smartwoo-video-player_controls-timing {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    margin: 0px 16px 3px 0px;
}

.smartwoo-seek-tooltip {
    position: absolute;
    display: none;
    padding: 2px 6px;
    background: #000;
    color: #fff;
    font-size: 12px; 
    border-radius: 4px;
    pointer-events: none;
    white-space: nowrap;
    z-index: 1000;
}


.smartwoo-video-player_controls-timing span {
    font-size: 1rem;
    color: #dcdcde;
}

.smartwoo-video-player__controls-control {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 20px;

}

.smartwoo-video-player__controls-control span,
.smartwoo-video-player__controls-right span {
    cursor: pointer !important;
}

.smartwoo-video-player__controls-control .smartwoo-control {
    font-size: 1.5rem;
}
.smartwoo-video-player__progress {
    position: relative;
    background-color: #fff;
    height: 6px;
    width: 80%;
    border-radius: 10px;
    cursor: pointer;
}
.smartwoo-video-player__progress .smartwoo-progress-bar {
    height: 100%;
    background-color: #4caf50;
    width: 30%;
    transition: width 0.1s ease-in-out;
    border-radius: 4px;
}

.smartwoo-video-player-playlist-container {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    margin: 0;
    padding: 0;
    max-height: 335px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #6600ff #fff;
}

.smartwoo-video-playlist-item {
    position: relative;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    border-radius: 4px;
    overflow-wrap: anywhere;
    transition: background-color .5s ease-in-out;
}
.smartwoo-video-playlist-item:hover {
    background-color: #dcdcde;
}
.smartwoo-video-playlist-item img {
    height: 60px;
}

.smartwoo-video-playlist-item p {
    overflow-wrap: anywhere;
}

.smartwoo-video-playlist-item.is-active {
    box-shadow: inset -1px -1px 5px 0px rgb(0 0 0 / 22%);
}

.smartwoo-toast {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.8);
    color: #fff;
    padding: 6px 12px;
    font-size: 14px;
    border-radius: 6px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 99;
}

.smartwoo-toast.visible {
    opacity: 1;
}

/* ========================================================================= */
/* ===== 1. Base Gallery Structure (Applies to both Editor & Front-end) ===== */
/* ========================================================================= */
.smartwoo-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 12px; /* Consistent spacing between items */
    /*
     * Important: The .smartwoo-gallery div has contenteditable="false" in editor,
     * but this attribute is removed for final output.
     * The flex container itself is always present.
     */
}

.smartwoo-gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 6px;
    box-sizing: border-box;
    
    /* Default flex sizing for a 3-column layout, resilient if not in grid/masonry */
    flex: 1 1 calc(33.333% - 8px); /* Adjusts for 12px gap: (100% - 2 * 12px) / 3 */
    min-width: 150px; /* Minimum width for responsiveness */
    display: flex;
    flex-direction: column;
}

/* ========================================================= */
/* ===== 3. Image Elements (Applies to both Editor & Front-end) ===== */
/* ========================================================= */
.smartwoo-image-wrapper {
    position: relative;
    width: 100%;
    /* No fixed height here, let the image determine it for masonry/natural flow,
       or let variations define height. */
}

.smartwoo-image-wrapper img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
    border-radius: inherit;
}

/* ======================================================= */
/* ===== 4. Image Actions (Applies to both Editor & Front-end) ===== */
/* ======================================================= */
.smartwoo-image-actions {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    z-index: 2; /* Ensure actions are above the image */
    pointer-events: none; /* Allows clicks through when hidden */
}

/* Show actions on item hover */
.smartwoo-gallery-item:hover .smartwoo-image-actions {
    opacity: 1;
    pointer-events: auto; /* Enable clicks when visible */
}

.smartwoo-image-actions button {
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: inline-flex; /* Align icon and text */
    align-items: center;
    gap: 5px; /* Space between icon and text */
}

.smartwoo-image-actions button .dashicons {
    font-size: 1.2em; /* Adjust Dashicon size */
}

.smartwoo-image-actions button:hover {
    background: rgba(0, 0, 0, 0.8);
}

/* ======================================================== */
/* ===== 5. Image Metadata (Applies to both Editor & Front-end) ===== */
/* ======================================================== */
.smartwoo-meta {
    padding: 8px;
    background-color: transparent;
    color: #333; 
}

.smartwoo-meta .smartwoo-image-title {
    font-size: 14px;
    font-weight: bold;
    margin: 0 0 4px;
    color: #333;
}

.smartwoo-meta .smartwoo-image-caption {
    font-size: 12px;
    color: #666;
    margin: 0;
}

.smartwoo-gallery-hover-overlay .smartwoo-meta .smartwoo-image-title,
.smartwoo-gallery-hover-overlay .smartwoo-meta .smartwoo-image-caption {
    color: #FFFFFF;
}

/* ======================================== */
/* ===== 6. Gallery Type Variations ===== */
/* ======================================== */

/* --- 6.1 Hover Overlay Gallery --- */
.smartwoo-gallery-hover-overlay .smartwoo-image-wrapper {
    position: relative;
    height: 100%;
}

.smartwoo-gallery-hover-overlay .smartwoo-image-wrapper img {
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease, opacity 0.4s ease;
}
.smartwoo-gallery-hover-overlay .smartwoo-gallery-item {
    max-width: 200px;
}
.smartwoo-gallery-hover-overlay .smartwoo-gallery-item:hover .smartwoo-image-wrapper img {
    transform: scale(1.1);
    opacity: 0.85;
}

.smartwoo-gallery-hover-overlay .smartwoo-meta {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px;
    background: linear-gradient(to top, rgba(0,0,0,0.8), rgba(0,0,0,0)); /* Gradient overlay */
    color: #fff;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 1;
    pointer-events: none;
}

.smartwoo-gallery-hover-overlay .smartwoo-gallery-item:hover .smartwoo-meta {
    transform: translateY(0);
    pointer-events: auto;
}

/* --- 6.2 Card-Style Gallery --- */
.smartwoo-gallery-card-style {
    justify-content: center;
}
.smartwoo-gallery-card-style .smartwoo-gallery-item {
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    background-color: #fff;
    border: none;
    max-width: 200px;
}

.smartwoo-gallery-card-style .smartwoo-image-wrapper img {
    width: 100%;
}

.smartwoo-gallery-card-style .smartwoo-gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

.smartwoo-gallery-card-style .smartwoo-meta {
    background: #fff;
    border-top: 1px solid #eee;
    flex-grow: 1;
    color: #333;
}
.smartwoo-gallery-card-style .smartwoo-image-title {
    color: #222;
}
.smartwoo-gallery-card-style .smartwoo-image-caption {
    color: #555;
}


/* --- 6.3 Masonry Gallery (CSS Columns) --- */
.smartwoo-gallery-masonry {
    display: block; /* Override flex for column-count */
    column-count: 3;
    column-gap: 12px;
    /* Responsive column-count for smaller screens can be added with media queries */
}

.smartwoo-gallery-masonry .smartwoo-gallery-item {
    display: inline-block; /* Essential for masonry layout */
    width: 100%; /* Item takes full column width */
    margin-bottom: 12px; /* Spacing between items in a column */
    break-inside: avoid; /* Prevent items from breaking across columns */
    box-shadow: 0 2px 6px rgba(0,0,0,0.1); /* Add shadow for definition */
    background-color: #fff; /* Item background */
    border: none;
}
.smartwoo-gallery-masonry .smartwoo-image-wrapper img {
    height: auto; /* Allow image to scale freely within its masonry item */
    object-fit: contain; /* Don't crop, show full image */
}
.smartwoo-gallery-masonry .smartwoo-meta {
    padding-top: 0; /* Reduce top padding if image is flush to the top */
    color: #333; /* Ensure readability */
}

/* --- 6.4 Grid Gallery (CSS Grid) --- */
.smartwoo-gallery-grid {
    display: grid; /* Use CSS Grid for robust grid layout */
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); /* Responsive columns */
    gap: 12px; /* Consistent spacing */
}

.smartwoo-gallery-grid .smartwoo-gallery-item {
    flex: none; /* Override flex property from base gallery */
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    border: solid 1px #dcdcde;
    display: flex; /* Ensure inner content can be flexed if needed */
    flex-direction: column; /* Stack image and meta vertically */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.smartwoo-gallery-grid .smartwoo-gallery-item:hover {
    transform: translateY(-2px); /* Subtle lift */
    box-shadow: 0 4px 10px rgba(0,0,0,0.15); /* Slightly larger shadow on hover */
}
.smartwoo-gallery-grid .smartwoo-meta {
    background-color: #f9f9f9; /* Light background for meta */
    color: #333; /* Ensure readability */
    flex-grow: 1; /* Allow meta to take available space */
}

/* Fullscreen Overlay */
.smartwoo-gallery-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Close button */
.smartwoo-gallery-preview-close {
    position: absolute;
    top: 50px;
    right: 20px;
    color: #fff;
    cursor: pointer;
    font-size: 30px;
    z-index: 10000;
}
.smartwoo-gallery-preview-close .dashicons {
    font-size: inherit;
    width: auto;
    height: auto;
}

/* Navigation buttons */
.smartwoo-gallery-preview-nav {
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 10000;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}
.smartwoo-gallery-preview-nav .dashicons {
    font-size: 24px;
    width: auto;
    height: auto;
}
.smartwoo-gallery-preview-nav:hover {
    background: rgba(0, 0, 0, 0.6);
}
.smartwoo-gallery-preview-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Main preview content */
.smartwoo-gallery-preview-content {
    position: relative;
    max-width: 80%;
    max-height: 80%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Preview image */
.smartwoo-preview-image {
    max-width: 100%;
    max-height: 100%;
    transition: opacity 0.3s ease;
}

.smartwoo-preview-loader {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #fff;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    position: absolute;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@media (min-width: 280px) and (max-width: 768px) {
    body:not(#tinymce) .smartwoo-video-player-container {
        position: relative;
        flex-wrap: wrap-reverse;
    }
    body:not(#tinymce) .smartwoo-video-player-left {
        width: 100%;
    }
    body:not(#tinymce) .smartwoo-video-player-right {
        position: absolute;
        right: 0;
        width: 80%;
        transform: translateX(100%);
        transition: transform 0.5s ease-in-out;
    }
    body:not(#tinymce) .smartwoo-video-playlist-toggle {
        display: inline;
    }
    body:not(#tinymce) .smartwoo-video-player-right.is-active {
        transform: translateX(0);
    }
}