/* CMS Blocks CSS - Tách từ inline styles */

/* Code Block Styles */
.code-block {
    background-color: #1f2937;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.code-block pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    color: #f3f4f6;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    overflow-x: auto;
}

.code-block code {
    display: block;
    padding: 0;
    background: transparent;
}

.code-block .copy-button {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: #9ca3af;
    transition: color 0.2s;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}

.code-block .copy-button:hover {
    color: #e5e7eb;
}

/* Embed Block Styles */
.embed-responsive {
    width: 100%;
    margin: 2rem 0;
    position: relative;
}

/* Wagtail native responsive-object - padding-bottom set inline by Wagtail */
/* FIX: Thêm padding-bottom mặc định để video YouTube hiển thị đầy đủ */
.responsive-object {
    position: relative;
    overflow: hidden;
    max-width: 100%;
    margin: 1.5rem 0;
    /* Đảm bảo có padding-bottom mặc định (16:9 aspect ratio) nếu Wagtail không set inline */
    padding-bottom: 56.25%;
    height: 0;
}

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

/* Legacy embed-container for custom templates - nền trong suốt tránh vạch đen */
.embed-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    max-width: 100%;
    background: transparent;
    border-radius: 8px;
}

.embed-container iframe,
.embed-container object,
.embed-container embed,
.embed-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    border: 0;
    /* Prevent rotation issues */
    transform: none !important;
    transform-origin: center center !important;
}

.embed-container .rich-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.embed-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #6b7280;
    padding: 2rem;
}

/* Alert Block Styles */
.alert-dismissible {
    position: relative;
}

.alert-dismiss-button {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.25rem;
    transition: color 0.2s, background-color 0.2s;
}

.alert-dismiss-button:hover {
    color: #6b7280;
    background-color: rgba(0, 0, 0, 0.05);
}

/* Pygments Syntax Highlighting Styles */
.highlight {
    background-color: #1f2937;
    border-radius: 0.5rem;
    padding: 1rem;
    margin: 0.5rem 0;
    overflow-x: auto;
}

.highlight pre {
    background: transparent;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 0;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    color: #f3f4f6;
}

.highlight .linenos {
    color: #6b7280;
    background-color: #374151;
    padding-right: 1rem;
    margin-right: 1rem;
    border-right: 1px solid #4b5563;
    user-select: none;
}

.highlight .code {
    color: #f3f4f6;
}

/* Syntax highlighting colors */
.highlight .k {
    color: #c678dd;
}

/* Keywords */
.highlight .s {
    color: #98c379;
}

/* Strings */
.highlight .c {
    color: #5c6370;
    font-style: italic;
}

/* Comments */
.highlight .n {
    color: #e06c75;
}

/* Names */
.highlight .o {
    color: #56b6c2;
}

/* Operators */
.highlight .p {
    color: #abb2bf;
}

/* Punctuation */
.highlight .nb {
    color: #e5c07b;
}

/* Name.Builtin */
.highlight .nf {
    color: #61afef;
}

/* Name.Function */
.highlight .nc {
    color: #e5c07b;
}

/* Name.Class */
.highlight .mi {
    color: #d19a66;
}

/* Number.Integer */
.highlight .mf {
    color: #d19a66;
}

/* Number.Float */


/* Mobile optimization */
@media (max-width: 639px) {
    .embed-responsive {
        margin: 1rem 0;
    }

    .code-block {
        padding: 0.75rem;
        margin-bottom: 1rem;
    }

    .code-block pre {
        font-size: 0.75rem;
    }

    .highlight {
        padding: 0.75rem;
    }

    .highlight pre {
        font-size: 0.75rem;
    }

}
