.zps-video-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--zps-video-badge-bg, #2563eb);
    color: var(--zps-video-badge-text, #fff);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    margin-left: 6px;
}

.zps-video-badge-inline {
    margin-left: 0;
    margin-bottom: 8px;
}

.zps-special-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #2563eb;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.zps-special-badge-inline {
    margin: 0;
}

.zps-video-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--zps-video-badge-bg, #2563eb);
    color: var(--zps-video-badge-text, #fff);
}

.zps-special-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.zps-video-cover-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    position: absolute;
    left: 8px;
    top: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--zps-video-badge-bg, #2563eb);
    color: var(--zps-video-badge-text, #fff);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    z-index: 10;
    pointer-events: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.zps-special-cover-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    position: absolute;
    left: 8px;
    top: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #0f766e;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    z-index: 10;
    pointer-events: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

/* Ensure parent has relative positioning for badge - Zibll compatible */
.zps-video-flag ~ .item-thumbnail,
.zps-special-flag ~ .item-thumbnail,
.posts-item:has(.zps-video-flag) .item-thumbnail,
.posts-item:has(.zps-special-flag) .item-thumbnail,
posts.posts-item:has(.zps-video-flag) .item-thumbnail,
posts.posts-item:has(.zps-special-flag) .item-thumbnail {
    position: relative;
}

.zps-video-badge.has-image,
.zps-special-badge.has-image,
.zps-video-tag.has-image,
.zps-video-cover-badge.has-image,
.zps-special-tag.has-image,
.zps-special-cover-badge.has-image {
    background: transparent;
    padding: 0;
}

.zps-video-tag-img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    display: inline-block;
}

.zps-video-cover-img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    display: block;
}

.zps-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.zps-video-tutorial {
    border: 1px solid rgba(17, 24, 39, 0.08);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 16px;
    background: #fff;
}

/* Prevent whitespace from hidden fields */
#zps-video-tutorial-fields {
    display: none !important;
    position: absolute !important;
    left: -9999px !important;
    height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
}

.zps-video-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 10px;
}

.zps-video-player video {
    width: 100%;
    max-width: 100%;
    border-radius: 10px;
    background: #000;
}

.zps-video-embed {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: 10px;
    background: #000;
}

.zps-video-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.zps-video-protect {
    user-select: none;
}

.zps-video-widget .zps-video-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.zps-video-widget .zps-video-field {
    margin-top: 12px;
}

.zps-embed-preview-wrapper {
    position: relative;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
}

.zps-embed-preview {
    position: relative;
    width: 100%;
    padding-bottom: var(--zps-embed-ratio, 56%);
    height: 0;
}

.zps-embed-preview iframe {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Zibll Theme Integration - Better compatibility */
.zibll-theme .zps-video-badge,
.zibll-theme .zps-special-badge,
.zibll-theme .zps-video-tag,
.zibll-theme .zps-video-cover-badge,
.zibll-theme .zps-special-tag,
.zibll-theme .zps-special-cover-badge {
    font-family: inherit;
}

/* Fix for Zibll's posts grid layout */
.zibll-theme .posts-item .zps-video-cover-badge,
.zibll-theme .posts-item .zps-special-cover-badge {
    z-index: 15;
}

/* Ensure badge doesn't break Zibll's flex layouts */
.zibll-theme .item-tags .zps-video-tag,
.zibll-theme .item-tags .zps-special-tag {
    flex-shrink: 0;
}

/* Video player responsive for Zibll content area */
.zibll-theme .zps-video-tutorial {
    max-width: 100%;
}

.zibll-theme .zps-video-embed,
.zibll-theme .zps-video-player {
    max-width: 100%;
}

/* Dark mode support for Zibll */
.dark-theme .zps-video-tutorial,
.zibll-theme.dark .zps-video-tutorial {
    background: #1e293b;
    border-color: rgba(255, 255, 255, 0.1);
}

.dark-theme .zps-video-badge,
.zibll-theme.dark .zps-video-badge {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.dark-theme .zps-special-badge,
.zibll-theme.dark .zps-special-badge {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* ========================================
   Badge Motion Effects - Modern & Professional
   Applies to video badges and Zibll theme badges
   ======================================== */

/* Base effect class - ensures proper containment */
.zps-effect-glow,
.zps-effect-neon,
.zps-effect-shimmer,
.zps-effect-shine,
.zps-effect-glint,
.zps-effect-pulse,
.zps-effect-bounce,
.zps-effect-float,
.zps-effect-wiggle,
.zps-effect-gradient,
.zps-effect-rainbow,
.zps-effect-aurora,
.zps-effect-border-glow,
.zps-effect-ripple,
.zps-effect-breathing,
.zps-effect-heartbeat,
.zps-effect-blink,
.zps-effect-sparkle,
.zps-effect-glass {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    z-index: 1;
}

/* ----------------------------------------
   GLOW EFFECTS
   ---------------------------------------- */

/* Soft Glow - Ánh sáng mềm */
.zps-effect-glow {
    animation: zps-glow 2s ease-in-out infinite;
}

@keyframes zps-glow {
    0%, 100% { box-shadow: 0 0 5px rgba(255,255,255,0.4), 0 0 10px rgba(37,99,235,0.3); }
    50% { box-shadow: 0 0 10px rgba(255,255,255,0.6), 0 0 20px rgba(37,99,235,0.5); }
}

/* Neon Glow - Neon rực rỡ */
.zps-effect-neon {
    animation: zps-neon 1.5s ease-in-out infinite alternate;
}

@keyframes zps-neon {
    0% { box-shadow: 0 0 5px currentColor, 0 0 10px currentColor; }
    100% { box-shadow: 0 0 10px currentColor, 0 0 20px currentColor, 0 0 30px currentColor; }
}

/* ----------------------------------------
   LIGHT SWEEP EFFECTS
   ---------------------------------------- */

/* Shimmer - Lấp lánh nhẹ */
.zps-effect-shimmer::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.5) 50%, transparent 100%);
    animation: zps-shimmer 2s ease-in-out infinite;
    z-index: 10;
    pointer-events: none;
}

@keyframes zps-shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Shine - Tia sáng lướt ngang */
.zps-effect-shine::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.6) 50%, transparent 100%);
    transform: skewX(-20deg);
    animation: zps-shine 2.5s ease-in-out infinite;
    z-index: 10;
    pointer-events: none;
}

@keyframes zps-shine {
    0% { left: -100%; }
    100% { left: 200%; }
}

/* Glint - Ánh lấp lánh nhỏ */
.zps-effect-glint::before {
    content: '';
    position: absolute;
    top: 0;
    left: -50%;
    width: 30%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.8), transparent);
    transform: skewX(-15deg);
    animation: zps-glint 3s ease-in-out infinite;
    z-index: 10;
    pointer-events: none;
}

@keyframes zps-glint {
    0%, 60%, 100% { left: -50%; opacity: 0; }
    10% { opacity: 1; }
    40% { left: 130%; opacity: 0; }
}

/* ----------------------------------------
   MOTION EFFECTS
   ---------------------------------------- */

/* Pulse - Nhịp đập */
.zps-effect-pulse {
    animation: zps-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes zps-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}

/* Bounce - Nhảy nhẹ */
.zps-effect-bounce {
    animation: zps-bounce 2s ease infinite;
}

@keyframes zps-bounce {
    0%, 100% { transform: translateY(0); }
    25% { transform: translateY(-2px); }
    50% { transform: translateY(0); }
    75% { transform: translateY(-1px); }
}

/* Float - Lơ lửng */
.zps-effect-float {
    animation: zps-float 3s ease-in-out infinite;
}

@keyframes zps-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

/* Wiggle - Lắc nhẹ */
.zps-effect-wiggle {
    animation: zps-wiggle 2.5s ease-in-out infinite;
}

@keyframes zps-wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-1deg); }
    75% { transform: rotate(1deg); }
}

/* ----------------------------------------
   GRADIENT & COLOR EFFECTS
   ---------------------------------------- */

/* Gradient Flow - Gradient chảy */
.zps-effect-gradient {
    background-size: 200% 100% !important;
    animation: zps-gradient 3s linear infinite;
}

.zps-effect-gradient:not([style*="background"]) {
    background: linear-gradient(90deg, #667eea, #764ba2, #f093fb, #667eea) !important;
}

@keyframes zps-gradient {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

/* Rainbow - Cầu vồng */
.zps-effect-rainbow {
    background: linear-gradient(90deg, #ff6b6b, #feca57, #48dbfb, #ff9ff3, #ff6b6b) !important;
    background-size: 300% 100% !important;
    animation: zps-rainbow 4s linear infinite;
}

@keyframes zps-rainbow {
    0% { background-position: 0% 50%; }
    100% { background-position: 300% 50%; }
}

/* Aurora - Cực quang */
.zps-effect-aurora {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #5ee7df 75%, #667eea 100%) !important;
    background-size: 400% 400% !important;
    animation: zps-aurora 6s ease infinite;
}

@keyframes zps-aurora {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* ----------------------------------------
   BORDER & OUTLINE EFFECTS
   ---------------------------------------- */

/* Border Glow - Viền phát sáng */
.zps-effect-border-glow {
    animation: zps-border-glow 2s ease-in-out infinite;
}

@keyframes zps-border-glow {
    0%, 100% { box-shadow: inset 0 0 0 1px rgba(255,255,255,0.2), 0 1px 3px rgba(0,0,0,0.1); }
    50% { box-shadow: inset 0 0 0 1px rgba(255,255,255,0.5), 0 1px 6px rgba(0,0,0,0.15); }
}

/* Ripple - Gợn sóng */
.zps-effect-ripple::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: 0 0 0 0 currentColor;
    opacity: 0.4;
    animation: zps-ripple 2s ease-out infinite;
    z-index: -1;
    pointer-events: none;
}

@keyframes zps-ripple {
    0% { box-shadow: 0 0 0 0 currentColor; opacity: 0.4; }
    100% { box-shadow: 0 0 0 8px currentColor; opacity: 0; }
}

/* ----------------------------------------
   SPECIAL EFFECTS
   ---------------------------------------- */

/* Breathing - Thở nhẹ */
.zps-effect-breathing {
    animation: zps-breathing 3s ease-in-out infinite;
}

@keyframes zps-breathing {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.85; transform: scale(0.98); }
}

/* Heartbeat - Nhịp tim */
.zps-effect-heartbeat {
    animation: zps-heartbeat 1.5s ease-in-out infinite;
}

@keyframes zps-heartbeat {
    0%, 100% { transform: scale(1); }
    14% { transform: scale(1.05); }
    28% { transform: scale(1); }
    42% { transform: scale(1.03); }
    56% { transform: scale(1); }
}

/* Blink Soft - Nhấp nháy nhẹ */
.zps-effect-blink {
    animation: zps-blink 3s ease-in-out infinite;
}

@keyframes zps-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Sparkle - Lấp lánh sao */
.zps-effect-sparkle::before,
.zps-effect-sparkle::after {
    content: '';
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(255,255,255,0.9);
    border-radius: 50%;
    z-index: 2;
    pointer-events: none;
    animation: zps-sparkle 2s ease-in-out infinite;
}

.zps-effect-sparkle::before {
    top: 15%;
    right: 15%;
}

.zps-effect-sparkle::after {
    bottom: 20%;
    left: 20%;
    animation-delay: 0.5s;
}

@keyframes zps-sparkle {
    0%, 100% { opacity: 0; transform: scale(0.5); }
    50% { opacity: 1; transform: scale(1); }
}

/* Glass Reflection - Phản chiếu kính */
.zps-effect-glass::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.25) 0%, transparent 100%);
    border-radius: inherit;
    z-index: 2;
    pointer-events: none;
}

/* ----------------------------------------
   RESET & ACCESSIBILITY
   ---------------------------------------- */

.zps-effect-none {
    animation: none !important;
}

.zps-effect-none::before,
.zps-effect-none::after {
    display: none !important;
}

@media (prefers-reduced-motion: reduce) {
    [class*="zps-effect-"] {
        animation: none !important;
    }
    [class*="zps-effect-"]::before,
    [class*="zps-effect-"]::after {
        animation: none !important;
        display: none !important;
    }
}

/* ----------------------------------------
   ZIBLL THEME BADGES INTEGRATION
   ---------------------------------------- */

/* Apply effects to Zibll badges */
.badg.zps-effect-shimmer::before,
.badg.zps-effect-shine::before,
.badg.zps-effect-glint::before,
.item-tags .zps-effect-shimmer::before,
.item-tags .zps-effect-shine::before,
.item-tags .zps-effect-glint::before {
    border-radius: inherit;
}

/* Ensure effects work on Zibll's common badge classes */
.zibll-theme .badg[class*="zps-effect-"],
.zibll-theme .label[class*="zps-effect-"],
.zibll-theme .tag[class*="zps-effect-"] {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

/* Keep cover badges out of layout flow even when effect classes are attached.
   The generic effect base sets position/z-index and can push Zibll cards out of alignment. */
.zps-video-cover-badge[class*="zps-effect-"],
.zps-special-cover-badge[class*="zps-effect-"] {
    position: absolute !important;
    z-index: 15 !important;
}
