/**
 * ACF YouTube Embed Block Styles
 * Save as: /assets/style.css in your plugin directory
 */

.youtube-embed-block {
    margin: 1.5em 0;
}

.youtube-embed-wrapper {
    position: relative;
    width: 100%;
    height: 0;
    overflow: hidden;
}

/* Default 16:9 aspect ratio (for videos) */
.youtube-embed-block.aspect-16-9 .youtube-embed-wrapper {
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
}

/* 9:16 aspect ratio (for shorts) */
.youtube-embed-block.aspect-9-16 .youtube-embed-wrapper {
    padding-bottom: 177.78%; /* 9:16 aspect ratio */
    max-width: 400px; /* Limit width for vertical videos */
    margin: 0 auto; /* Center the container */
}

.youtube-embed-wrapper iframe,
.youtube-embed-wrapper embed,
.youtube-embed-wrapper object,
.youtube-embed-wrapper video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Placeholder styles for editor preview */
.youtube-embed-placeholder {
    background: #f5f5f5;
    border: 2px dashed #ccc;
    padding: 2em;
    text-align: center;
    color: #666;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.youtube-embed-placeholder p {
    margin: 0.5em 0;
}

/* Alignment classes */
.youtube-embed-block.alignleft {
    float: left;
    margin-right: 1.5em;
    max-width: 50%;
}

.youtube-embed-block.alignright {
    float: right;
    margin-left: 1.5em;
    max-width: 50%;
}

.youtube-embed-block.aligncenter {
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

.youtube-embed-block.alignwide {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.youtube-embed-block.alignfull {
    width: 100vw;
    max-width: none;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .youtube-embed-block.alignleft,
    .youtube-embed-block.alignright {
        float: none;
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
    }
    
    /* Adjust max-width for shorts on mobile */
    .youtube-embed-block.aspect-9-16 .youtube-embed-wrapper {
        max-width: 300px;
    }
}

@media (max-width: 480px) {
    /* Further reduce max-width for shorts on very small screens */
    .youtube-embed-block.aspect-9-16 .youtube-embed-wrapper {
        max-width: 250px;
    }
}