/* SAT CMS - Social Media & Content Embed Stylesheet */

/* --- 1. In-Editor Embed Block Styling --- */
.sat-embed-block {
    display: block;
    margin: 20px 0;
    padding: 0;
    background: #ffffff;
    border: 1.5px solid #cbd5e1;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
    overflow: hidden;
    user-select: none;
    clear: both;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.sat-embed-block:hover {
    border-color: #3b82f6;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.12);
}

.sat-embed-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
}

.sat-embed-block-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 9px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
}

.sat-embed-block-badge.badge-x { background: #0f172a; color: #ffffff; }
.sat-embed-block-badge.badge-youtube { background: #fee2e2; color: #dc2626; }
.sat-embed-block-badge.badge-facebook { background: #dbeafe; color: #1d4ed8; }
.sat-embed-block-badge.badge-instagram { background: #fce7f3; color: #be185d; }
.sat-embed-block-badge.badge-tiktok { background: #f3f4f6; color: #111827; }
.sat-embed-block-badge.badge-spotify { background: #dcfce7; color: #15803d; }
.sat-embed-block-badge.badge-soundcloud { background: #ffedd5; color: #c2410c; }
.sat-embed-block-badge.badge-maps { background: #e0e7ff; color: #4338ca; }
.sat-embed-block-badge.badge-custom { background: #f1f5f9; color: #475569; }

.sat-embed-block-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sat-embed-delete-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fca5a5;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.sat-embed-delete-btn:hover {
    background: #dc2626;
    color: #ffffff;
    border-color: #dc2626;
}

.sat-embed-block-body {
    padding: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #fafafa;
    min-height: 80px;
    position: relative;
}

/* In-Editor only: prevent accidental click hijacking while typing */
.editor-area[contenteditable="true"] .sat-embed-block iframe,
#editor[contenteditable="true"] .sat-embed-block iframe,
.editor-wrapper [contenteditable="true"] .sat-embed-block iframe {
    pointer-events: none;
}

/* --- 2. Frontend Embed Containers & Responsiveness --- */
.sat-embed-container {
    width: 100%;
    max-width: 100%;
    margin: 28px auto;
    clear: both;
    display: flex;
    justify-content: center;
}

/* 16:9 Responsive Video Aspect Ratio */
.sat-embed-container.embed-aspect-16-9 {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: 12px;
    background: #0f172a;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.sat-embed-container.embed-aspect-16-9 iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    border: 0;
    pointer-events: auto !important;
}

/* Ensure all iframes in the frontend have pointer-events enabled */
.article-body-content iframe,
.post-content iframe,
.sat-embed-container iframe,
.sat-embed-block iframe {
    pointer-events: auto !important;
}

/* Spotify Audio Player */
.sat-embed-container.embed-spotify iframe {
    width: 100%;
    max-width: 100%;
    height: 152px;
    border-radius: 12px;
    border: 0;
    pointer-events: auto !important;
}

/* SoundCloud Audio Player */
.sat-embed-container.embed-soundcloud iframe {
    width: 100%;
    max-width: 100%;
    height: 166px;
    border: 0;
    pointer-events: auto !important;
}

/* Google Maps */
.sat-embed-container.embed-maps iframe {
    width: 100%;
    height: 400px;
    border-radius: 12px;
    border: 0;
    pointer-events: auto !important;
}

/* Social Media Specific Widths */
.sat-embed-container.embed-x .twitter-tweet {
    margin: 0 auto !important;
    max-width: 550px !important;
}

.sat-embed-container.embed-facebook .fb-post,
.sat-embed-container.embed-facebook .fb-video {
    max-width: 100% !important;
}

.sat-embed-container.embed-instagram .instagram-media {
    margin: 0 auto !important;
    max-width: 540px !important;
    min-width: 326px !important;
    width: 100% !important;
    border-radius: 12px !important;
}

.sat-embed-container.embed-tiktok .tiktok-embed {
    margin: 0 auto !important;
    max-width: 605px !important;
    min-width: 325px !important;
}

@media (max-width: 640px) {
    .sat-embed-container.embed-instagram .instagram-media,
    .sat-embed-container.embed-tiktok .tiktok-embed {
        min-width: 100% !important;
    }
}

/* --- 3. Frontend Fallback: Hide any admin UI if .sat-embed-block is rendered outside editor --- */
body:not(.admin-editor) .sat-embed-block-header,
.article-body-content .sat-embed-block-header,
.article-content .sat-embed-block-header,
.post-content .sat-embed-block-header,
.content-body .sat-embed-block-header {
    display: none !important;
}

body:not(.admin-editor) .sat-embed-block,
.article-body-content .sat-embed-block,
.article-content .sat-embed-block,
.post-content .sat-embed-block,
.content-body .sat-embed-block {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 28px 0 !important;
}

body:not(.admin-editor) .sat-embed-block-body,
.article-body-content .sat-embed-block-body,
.article-content .sat-embed-block-body,
.post-content .sat-embed-block-body,
.content-body .sat-embed-block-body {
    background: transparent !important;
    padding: 0 !important;
    min-height: auto !important;
}

body:not(.admin-editor) .sat-embed-block .sat-embed-preview-wrapper iframe,
.article-body-content .sat-embed-block .sat-embed-preview-wrapper iframe,
.article-content .sat-embed-block .sat-embed-preview-wrapper iframe,
.post-content .sat-embed-block .sat-embed-preview-wrapper iframe,
.content-body .sat-embed-block .sat-embed-preview-wrapper iframe {
    pointer-events: auto !important;
}

/* --- 4. Custom HTML Element Enhancements in Content --- */
.article-body-content table,
.page-body-content table,
.post-content table {
    width: 100% !important;
    max-width: 100% !important;
    border-collapse: collapse !important;
    margin: 24px 0 !important;
    font-size: 14.5px !important;
    background: #ffffff !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

.article-body-content th,
.page-body-content th,
.post-content th {
    background: #f1f5f9 !important;
    color: #0f172a !important;
    font-weight: 700 !important;
    padding: 10px 14px !important;
    border: 1px solid #cbd5e1 !important;
    text-align: left !important;
}

.article-body-content td,
.page-body-content td,
.post-content td {
    padding: 10px 14px !important;
    border: 1px solid #e2e8f0 !important;
    color: #334155 !important;
}

.article-body-content tr:nth-child(even),
.page-body-content tr:nth-child(even),
.post-content tr:nth-child(even) {
    background: #f8fafc !important;
}

/* --- 5. Frontend In-Content Hyperlink Distinct Styling --- */
.article-body-content a:not(.btn):not(.sat-embed-delete-btn):not([class*="badge"]):not(.twitter-tweet a),
.article-content a:not(.btn):not(.sat-embed-delete-btn):not([class*="badge"]):not(.twitter-tweet a),
.page-body-content a:not(.btn):not(.sat-embed-delete-btn):not([class*="badge"]):not(.twitter-tweet a),
.post-content a:not(.btn):not(.sat-embed-delete-btn):not([class*="badge"]):not(.twitter-tweet a),
.content-body a:not(.btn):not(.sat-embed-delete-btn):not([class*="badge"]):not(.twitter-tweet a),
.sat-lv-update-content a:not(.btn):not(.sat-embed-delete-btn):not([class*="badge"]):not(.twitter-tweet a),
.prose a:not(.btn):not(.sat-embed-delete-btn):not([class*="badge"]):not(.twitter-tweet a) {
    color: #2563eb !important;
    font-weight: 500 !important;
    text-decoration: underline !important;
    text-decoration-color: rgba(37, 99, 235, 0.4) !important;
    text-underline-offset: 3px !important;
    transition: color 0.15s ease, text-decoration-color 0.15s ease !important;
}

.article-body-content a:not(.btn):not(.sat-embed-delete-btn):not([class*="badge"]):not(.twitter-tweet a):hover,
.article-content a:not(.btn):not(.sat-embed-delete-btn):not([class*="badge"]):not(.twitter-tweet a):hover,
.page-body-content a:not(.btn):not(.sat-embed-delete-btn):not([class*="badge"]):not(.twitter-tweet a):hover,
.post-content a:not(.btn):not(.sat-embed-delete-btn):not([class*="badge"]):not(.twitter-tweet a):hover,
.content-body a:not(.btn):not(.sat-embed-delete-btn):not([class*="badge"]):not(.twitter-tweet a):hover,
.sat-lv-update-content a:not(.btn):not(.sat-embed-delete-btn):not([class*="badge"]):not(.twitter-tweet a):hover,
.prose a:not(.btn):not(.sat-embed-delete-btn):not([class*="badge"]):not(.twitter-tweet a):hover {
    color: #1d4ed8 !important;
    text-decoration-color: #1d4ed8 !important;
}

/* --- 6. Custom Page Layout Width Enforcement (99%) --- */
.custom-page-layout-wrapper {
    width: 99% !important;
    max-width: 99% !important;
    margin-left: auto !important;
    margin-right: auto !important;
}



