/* Dream-Girl Chat Plugin - Complete CSS
 * Production-ready with fixed background system and responsive design
 */

:root {
    --bg-color: #1a1a1a;
    --radius: 15px;
    --border-color: rgba(255, 255, 255, 0.2);
    --text-color: #ffffff;
    --primary-accent: #ff1493;
    --secondary-accent: #8a2be2;

    /* Chat background customization defaults (can be overridden per-container or globally). */
    --dgc-bg-size: cover;
    --dgc-bg-position: center center;
    --dgc-bg-repeat: no-repeat;
    --dgc-bg-attachment: scroll;
    --dgc-bg-overlay: rgba(0, 0, 0, 0.5);

    /* Image display modes */
    --dgc-img-portrait-contain: 1;
    --dgc-img-landscape-stretch: 1;
    --dgc-img-disable-top-crop: 1;
}

:root {
    --dgc-safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

/* Prevent horizontal scroll on mobile */
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden !important;
        width: 100%;
        max-width: 100%;
    }
}

/* =========================================
   BASE CONTAINER & BACKGROUND SYSTEM - RESPONSIVE
   ======================================== */

.dgc-chat-container {
    /* Base styles - responsive sizing with clamp for fluid scaling */
    width: clamp(320px, 90vw, 400px);
    height: clamp(500px, 85vh, 720px);
    aspect-ratio: 9 / 16;
    border-radius: clamp(20px, 5vw, 30px);
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.2);
    margin: clamp(12px, 4vh, 20px) auto;
    overflow: hidden;
    background: #000000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #ffffff;
    position: relative;
    display: flex;
    flex-direction: column;
    max-width: 100%; /* Prevent overflow on mobile - use 100% instead of 100vw */
    box-sizing: border-box;
    padding: 0; /* Remove default padding to prevent horizontal scroll */
    /* Ensure stable layout on initialization */
    min-height: 500px;
    contain: layout style;

    /* Background customization via CSS variables */
    background-size: var(--dgc-bg-size, cover) !important;
    background-position: var(--dgc-bg-position, center center) !important;
    background-repeat: var(--dgc-bg-repeat, no-repeat) !important;
    background-attachment: var(--dgc-bg-attachment, scroll) !important;
}

/* Desktop standalone chat sizing: match the dashboard Chat tab "phone" proportions.
   Dashboard uses a fixed-height panel and sets height:100% + aspect-ratio:9/16 + max-width:520.
   Apply the same rule to standalone shortcodes so both UIs render identically. */
@media (min-width: 1024px) {
    .dgc-chat-container:not(.mobile-fullscreen):not(.desktop-fullscreen):not([data-dashboard-mode="1"]) {
        height: calc(100vh - 32px);
        max-height: calc(100vh - 32px);
        aspect-ratio: 9 / 16;
        width: auto;
        max-width: min(520px, 100%);
        margin: 16px auto;
    }
}

/* Dashboard mode uses the same rounded container as shortcode mode.
   Only fullscreen states force true edge-to-edge square corners. */
.dgc-chat-container.mobile-fullscreen[data-dashboard-mode="1"],
.dgc-chat-container.desktop-fullscreen[data-dashboard-mode="1"] {
    border-radius: 0 !important;
}

/* Mobile fullscreen mode - activated by double tap */
@media (max-width: 768px) {
    .dgc-chat-container:not(.mobile-fullscreen):not([data-dashboard-mode="1"]) {
        /* Mobile embedded shortcode chat: full width with 9:16 aspect ratio */
        width: 100% !important;
        height: 100vh !important;
        aspect-ratio: 9 / 16;
        max-width: 100% !important;
        margin: 0 auto !important;
        padding: 2px !important;
        border-radius: clamp(20px, 5vw, 30px) !important;
        border: 0 !important;
        box-shadow: none !important;
        position: relative !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
        /* Prevent container from moving when keyboard opens */
        transform: translateZ(0) !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        z-index: auto !important;
    }

    .dgc-chat-container[data-dashboard-mode="1"] {
        /* Dashboard mode - no padding, full width, no rounded corners */
        width: 100% !important;
        max-width: 100% !important;
        /* Use viewport height directly so returning from fullscreen matches the pre-fullscreen layout. */
        height: calc(100vh - var(--dgc-chat-outer-offset, 0px)) !important;
        height: calc(100svh - var(--dgc-chat-outer-offset, 0px)) !important;
        height: calc(100dvh - var(--dgc-chat-outer-offset, 0px)) !important;
        margin: 0 !important;
        padding: 0 !important;
        border-radius: clamp(20px, 5vw, 30px) !important;
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        z-index: auto !important;
    }

    .dgc-chat-container.mobile-fullscreen {
        /* Fullscreen state overrides - keep rounded corners */
        width: 100vw !important;
        height: var(--dgc-vv-max-height, 100vh) !important;
        aspect-ratio: 9 / 16;
        margin: 0 !important;
        padding: 2px !important;
        /* Keep rounded corners even in fullscreen */
        border-radius: clamp(20px, 5vw, 30px) !important;
        border: none !important;
        box-shadow: none !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        z-index: 9999 !important;
        overflow: hidden !important;
        /* Prevent container from resizing when keyboard opens */
        min-height: var(--dgc-vv-max-height, 100vh) !important;
        max-height: var(--dgc-vv-max-height, 100vh) !important;
        height: var(--dgc-vv-max-height, 100vh) !important;
    }

    /* In fullscreen mode with keyboard open, input attaches to keyboard */
    .dgc-chat-container.mobile-fullscreen.keyboard-open:not([data-dashboard-mode="1"]) .dgc-chat-input {
        position: fixed !important;
        bottom: var(--dgc-keyboard-offset, 0px) !important;
        left: 0 !important;
        right: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        top: auto !important;
        z-index: 10001 !important;
        transform: none !important;
        background: transparent !important;
        border-top: none !important;
        box-shadow: none !important;
        padding: 8px 2px 0 2px !important;
        margin: 0 !important;
        height: auto !important;
        box-sizing: border-box !important;
    }
    
    /* In non-fullscreen mode with keyboard open, also attach input to keyboard */
    .dgc-chat-container:not(.mobile-fullscreen):not([data-dashboard-mode="1"]).keyboard-open .dgc-chat-input {
        position: fixed !important;
        bottom: var(--dgc-keyboard-offset, 0px) !important;
        left: 0 !important;
        right: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        top: auto !important;
        z-index: 10001 !important;
        transform: none !important;
        background: transparent !important;
        border-top: none !important;
        box-shadow: none !important;
        padding: 8px 2px 0 2px !important;
        margin: 0 !important;
        height: auto !important;
        box-sizing: border-box !important;
    }

        /* User-to-user chats: voice/mic UI is bot-only; hide it completely.
           (Dating injects a separate user-video button via dgc_after_voice_button.) */
        .dgc-chat-container[data-target-type="user"] #dgc-voice-btn,
        .dgc-chat-container[data-target-type="user"] #dgc-voice-chat {
            display: none !important;
        }

    /* Dashboard mode - prevent container resize on keyboard open */
    .dgc-chat-container[data-dashboard-mode="1"] {
        /* Use JS-provided stable height, don't let keyboard affect container size */
        min-height: auto !important;
    }

    /* Keep background fixed and prevent movement in fullscreen */
    .dgc-chat-container.mobile-fullscreen.keyboard-open {
        /* Don't fight the viewport, let it resize naturally */
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: var(--dgc-vv-max-height, 100vh) !important;
        min-height: var(--dgc-vv-max-height, 100vh) !important;
        max-height: var(--dgc-vv-max-height, 100vh) !important;
        overflow: hidden !important;
        /* Keep background */
        background-attachment: var(--dgc-bg-attachment) !important;
        background-size: cover !important;
        background-position: var(--dgc-bg-position) !important;
    }

    /* Keyboard-open in embedded (non-fullscreen) mode: keep container stable.
       position:fixed prevents the browser viewport-resize from shrinking the container
       when the virtual keyboard opens.  100vh resolves against the layout viewport (ICB)
       which does NOT change on keyboard open (resizes-visual default), so the height
       stays correct regardless of any prior fullscreen round-trip. */
    .dgc-chat-container.keyboard-open:not(.mobile-fullscreen):not([data-dashboard-mode="1"]) {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        min-height: 100vh !important;
        max-height: 100vh !important;
        z-index: 9998 !important;
        overflow: hidden !important;
        transform: none !important;
        border-radius: clamp(20px, 5vw, 30px) !important;
        background-attachment: var(--dgc-bg-attachment) !important;
        background-position: var(--dgc-bg-position) !important;
        background-size: cover !important;
    }

    /* Keyboard-open (non-fullscreen): respect the configured background attachment.
       Forcing scroll here breaks the “fixed background” requirement for shortcode chat. */
    .dgc-chat-container.keyboard-open:not(.mobile-fullscreen) {
        background-attachment: var(--dgc-bg-attachment) !important;
    }

    /* X close button for mobile fullscreen */
    .dgc-chat-container.mobile-fullscreen .dgc-mobile-close-btn {
        display: flex !important;
        position: absolute;
        top: 2px;
        right: 2px;
        width: 40px;
        height: 40px;
        background: transparent;
        border: none;
        border-radius: 50%;
        color: white;
        font-size: 24px;
        font-weight: bold;
        cursor: pointer;
        z-index: 10000;
        align-items: center;
        justify-content: center;
        transition: background 0.2s;
    }

    .dgc-chat-container.mobile-fullscreen .dgc-mobile-close-btn:hover {
        background: rgba(255, 255, 255, 0.1);
    }

    /* Hide X button when not in fullscreen */
    .dgc-chat-container:not(.mobile-fullscreen) .dgc-mobile-close-btn {
        display: none !important;
    }
}

/* Mobile keyboard open background fix */
@media (max-width: 768px) {
    .dgc-chat-container.keyboard-open {
        background-attachment: var(--dgc-bg-attachment) !important;
        background-size: cover !important;
        background-position: var(--dgc-bg-position) !important;
        background-repeat: no-repeat !important;
    }
}

/* =========================================
   DESKTOP FULLSCREEN MODE
   ======================================== */

@media (min-width: 769px) {
    .dgc-chat-container.desktop-fullscreen {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        /* Prevent the composer from being clipped by a few pixels on some desktop UAs. */
        padding-bottom: 6px !important;
        max-width: none !important;
        aspect-ratio: auto !important;
        margin: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        border: none !important;
        z-index: 99999 !important;
        display: flex !important;
        flex-direction: column !important;
        /* Break out of dashboard parent stacking context */
        transform: none !important;
        clip-path: unset !important;
    }

    /* Respect admin bar if present */
    body.admin-bar .dgc-chat-container.desktop-fullscreen {
        top: 32px !important;
        height: calc(100vh - 32px) !important;
        height: calc(100dvh - 32px) !important;
    }

    @media (max-width: 782px) {
        body.admin-bar .dgc-chat-container.desktop-fullscreen {
            top: 46px !important;
            height: calc(100vh - 46px) !important;
            height: calc(100dvh - 46px) !important;
        }
    }

    /* Lock page scroll when fullscreen is active */
    body.dgc-chat-desktop-fullscreen {
        overflow: hidden;
        position: fixed;
        width: 100%;
        height: 100vh;
        height: 100dvh;
    }

    /* Messages container should grow to fill available space */
    .dgc-chat-container.desktop-fullscreen .dgc-chat-messages {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
    }

    /* Input should stay at bottom */
    .dgc-chat-container.desktop-fullscreen .dgc-chat-input {
        flex-shrink: 0;
    }

    /* Background should cover entire viewport */
    .dgc-chat-container.desktop-fullscreen {
        background-attachment: fixed !important;
        background-size: var(--dgc-bg-size, cover) !important;
        background-position: var(--dgc-bg-position) !important;
    }

    /* Ensure fullscreen chat breaks out of dashboard wrapper properly */
    .dgc-dashboard-wrapper .dgc-chat-container.desktop-fullscreen {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        /* Match the base fullscreen container nudge to avoid bottom clipping. */
        padding-bottom: 6px !important;
        margin: 0 !important;
        z-index: 99999 !important;
        /* Explicitly break out of dashboard stacking context */
        transform: none !important;
        filter: none !important;
        clip-path: unset !important;
    }

    /* When fullscreen in dashboard with admin bar */
    body.admin-bar .dgc-dashboard-wrapper .dgc-chat-container.desktop-fullscreen {
        top: 32px !important;
        height: calc(100vh - 32px) !important;
        height: calc(100dvh - 32px) !important;
    }

    @media (max-width: 782px) {
        body.admin-bar .dgc-dashboard-wrapper .dgc-chat-container.desktop-fullscreen {
            top: 46px !important;
            height: calc(100vh - 46px) !important;
            height: calc(100dvh - 46px) !important;
        }
    }
}

/* Mobile fullscreen: tiny bottom padding to avoid composer clipping on some devices */
@media (max-width: 768px) {
    .dgc-chat-container.mobile-fullscreen {
        padding-bottom: 6px;
    }
}

/* Overlay for text readability - appears when background is set */
.dgc-chat-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    background: var(--dgc-bg-overlay, rgba(0, 0, 0, 0.5));
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Show overlay when background media is present */
.dgc-chat-container.dgc-bg-image::before,
.dgc-chat-container.dgc-bg-video::before {
    opacity: 1;
}

/* Ensure all child content sits above overlay */
.dgc-chat-container > *:not(.dgc-background-video) {
    position: relative;
    z-index: 2;
}

.dgc-background-video {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
    border-radius: inherit;
}

.dgc-background-video video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* =========================================
   RESPONSIVE IMAGE DISPLAY - NO CROP, PROPER SCALING
   ======================================== */

/* Portrait image: fit to height, center horizontally */
/* When using cover mode, crop from bottom (center bottom) instead of top */
.dgc-img-portrait {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center bottom;
    background: radial-gradient(ellipse at center, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.3) 100%);
}

/* Landscape image: stretch/fill to cover screen without cropping */
.dgc-img-landscape {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center center;
    background: linear-gradient(90deg, rgba(0,0,0,0.2) 0%, transparent 20%, transparent 80%, rgba(0,0,0,0.2) 100%);
}

/* Desktop fullscreen portrait: centered with blurred background fill */
.dgc-chat-container.desktop-fullscreen .dgc-img-portrait {
    object-fit: contain;
    object-position: center center;
    width: auto;
    height: 100%;
    max-width: 100%;
    margin: 0 auto;
    background: inherit;
    filter: drop-shadow(0 0 20px rgba(0,0,0,0.3));
}

/* Desktop fullscreen landscape: stretch to fit */
.dgc-chat-container.desktop-fullscreen .dgc-img-landscape {
    object-fit: contain;
    width: 100%;
    height: 100%;
}

/* Mobile: scale to fit current viewport height */
@media (max-width: 768px) {
    .dgc-img-portrait,
    .dgc-img-landscape {
        width: 100% !important;
        height: auto !important;
        max-height: 100vh;
    }
}

/* Profile frame: ensure image never crops and fits properly */
.dgc-profile-dashboard-portrait-frame > img,
.dgc-profile-dashboard-portrait-frame > video {
    object-fit: contain;
    object-position: center center !important;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.3);
}

/* Card images in grids/discover: maintain aspect ratio, no crop */
.dgc-card-image,
.dgc-discover-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center center;
    background: linear-gradient(135deg, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.1) 100%);
}

/* =========================================
   HEADER SECTION
   ======================================== */

.dgc-chat-header {
    background: transparent;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
    min-height: 50px;
}

/* Mobile safe area support */
@media (max-width: 768px) {
    .dgc-chat-container .dgc-chat-header {
        padding-top: max(20px, env(safe-area-inset-top));
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
        background: transparent;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
}

.dgc-chatbot-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.dgc-avatar-container {
    position: relative;
    flex-shrink: 0;
}

.dgc-chatbot-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.3);
    object-fit: cover;
}

.dgc-status {
    display: none;
}

.dgc-chatbot-details {
    flex: 1;
    min-width: 0;
}

.dgc-chatbot-name {
    margin: 0;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dgc-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dgc-balance-display {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.18);
    flex-shrink: 0;
}

.dgc-coin-icon {
    width: 23px;
    height: 23px;
    object-fit: contain;
}

.dgc-balance {
    color: #ffffff;
    font-weight: 600;
    font-size: 14px;
}

.dgc-topup-btn {
    background: linear-gradient(45deg, #ff1493, #8a2be2);
    color: #ffffff;
    border: none;
    padding: 4px 10px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 500;
    font-size: 11px;
    transition: transform 0.2s;
    white-space: nowrap;
}

.dgc-topup-btn:hover {
    transform: translateY(-2px);
}

.dgc-login-btn {
    background: rgba(255, 255, 255, 0.10);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: 6px 10px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 11px;
    white-space: nowrap;
    transition: transform 0.2s, background 0.2s;
}

/* Disabled control state (used to keep UI layout consistent across chat modes) */
.dgc-chat-container .dgc-disabled,
.dgc-chat-container .dgc-disabled[disabled] {
    opacity: 0.55;
    cursor: not-allowed !important;
    pointer-events: none !important;
}

/* Desktop fullscreen toggle button */
.dgc-desktop-fullscreen-toggle,
.dgc-desktop-fullscreen-exit {
    background: rgba(255, 255, 255, 0.10);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.18);
    width: 36px;
    height: 36px;
    padding: 6px;
    border-radius: 12px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.dgc-desktop-fullscreen-toggle:hover,
.dgc-desktop-fullscreen-exit:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: scale(1.05);
}

.dgc-desktop-fullscreen-toggle:active,
.dgc-desktop-fullscreen-exit:active {
    transform: scale(0.95);
}

/* Show on desktop only */
@media (min-width: 769px) {
    .dgc-desktop-fullscreen-toggle {
        display: inline-flex !important;
    }
    
    .dgc-chat-container.desktop-fullscreen .dgc-desktop-fullscreen-toggle {
        display: none !important;
    }
    
    .dgc-chat-container.desktop-fullscreen .dgc-desktop-fullscreen-exit {
        display: inline-flex !important;
    }
}

/* Hide mobile close button on desktop */
@media (min-width: 769px) {
    .dgc-mobile-close-btn {
        display: none !important;
    }
}

.dgc-guest-usage {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #fff;
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
    backdrop-filter: blur(6px);
}

.dgc-guest-usage-label {
    opacity: 0.9;
}

.dgc-guest-usage-value {
    font-weight: 700;
}

@media (max-width: 480px) {
    .dgc-guest-usage {
        padding: 5px 8px;
        font-size: 11px;
    }
}

.dgc-login-btn:hover {
    background: rgba(255, 255, 255, 0.16);
    transform: translateY(-1px);
}

.dgc-history-btn {
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    margin-right: 10px;
    transition: all 0.3s;
}

/* =========================================
   MESSAGES AREA
   ======================================== */

.dgc-chat-messages {
    flex: 1;
    position: relative;
    margin: 10px;
    border-radius: 15px;
    overflow: hidden;
    z-index: 1;
    display: flex;
    flex-direction: column;
    /* Ensure proper sizing within flex container */
    min-height: 0;
}

.dgc-messages-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 20px 40px 20px;
    background: transparent;
    scrollbar-width: none; /* Firefox */
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    /* Ensure proper sizing calculations */
    min-height: 0;
    position: relative;
}

.dgc-messages-content::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Edge */
}

/* Scroll to bottom button */
.dgc-scroll-to-bottom {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(45deg, #ff1493, #8a2be2);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s, transform 0.2s;
    z-index: 100;
}

.dgc-scroll-to-bottom.visible {
    opacity: 1;
    visibility: visible;
}

.dgc-scroll-to-bottom:hover {
    transform: translateY(-2px);
}

.dgc-scroll-to-bottom:active {
    transform: translateY(0);
}


.dgc-message {
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
    z-index: 1;
}

.dgc-message.user {
    justify-content: flex-end;
}

.dgc-message.bot .dgc-message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.3);
    object-fit: cover;
}

.dgc-message-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    object-position: center;
}

.dgc-message-content {
    max-width: 70%;
    padding: 12px 18px;
    border-radius: 18px;
    position: relative;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid #ffffff;
    color: #ffffff;
}

/* Generated images (OpenRouter image responses) */
.dgc-generated-images {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 10px;
}

/* Fullscreen overlay for AI-generated images (chat UI) */
.dgc-generated-image-overlay {
    position: fixed;
    inset: 0;
    /* Must be above dashboard/chat overlays (some mobile banners use max-int z-index). */
    z-index: 2147483647;
    background: rgba(0,0,0,0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
}

body.dgc-generated-image-open {
    overflow: hidden;
}

.dgc-generated-image-stage {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

.dgc-generated-image-stage.has-bg::before {
    content: '';
    position: absolute;
    inset: -24px;
    background-image: inherit;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    filter: blur(18px);
    transform: scale(1.08);
    opacity: 0.85;
}

.dgc-generated-image-stage.has-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 20%, rgba(0,0,0,0.15), rgba(0,0,0,0.72));
}

.dgc-generated-image-stage img {
    position: relative;
    z-index: 1;
    height: 100%;
    width: 100%;
    max-width: none;
    max-height: none;
    object-fit: cover;
    border-radius: 0;
    box-shadow: none;
}

.dgc-generated-image-close {
    position: absolute;
    top: max(10px, env(safe-area-inset-top));
    right: max(10px, env(safe-area-inset-right));
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    font-size: 28px;
    line-height: 1;
    color: #fff;
    background: rgba(255,255,255,0.12);
}

.dgc-generated-image-actions {
    width: 100%;
    max-width: 980px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 14px;
}

.dgc-generated-image-actions {
    transition: opacity 180ms ease, transform 180ms ease;
}

.dgc-generated-image-overlay.is-actions-hidden .dgc-generated-image-actions {
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
}

.dgc-generated-image-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.18);
    background: rgba(255,255,255,0.08);
    color: #fff;
    text-decoration: none;
    cursor: pointer;
    font-weight: 600;
}

.dgc-generated-image-discard {
    border-color: rgba(255, 82, 82, 0.55);
    background: rgba(255, 82, 82, 0.12);
}

/* Make generated thumbnails act like buttons */
.dgc-generated-image {
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.dgc-generated-image {
    display: block;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.18);
}

.dgc-generated-image img {
    width: 100%;
    height: auto;
    display: block;
}

.dgc-message.user .dgc-message-content {
    border-bottom-right-radius: 4px;
}

.dgc-message.bot .dgc-message-content {
    border-bottom-left-radius: 4px;
}

/* Fullscreen overlay for AI-generated videos (chat UI) */
.dgc-generated-video-overlay {
    position: fixed;
    inset: 0;
    /* Must be above dashboard/chat overlays (some mobile banners use max-int z-index). */
    z-index: 2147483647;
    background: rgba(0,0,0,0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
}

body.dgc-generated-video-open {
    overflow: hidden;
}

.dgc-generated-video-stage {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

.dgc-generated-video-stage.has-bg::before {
    content: '';
    position: absolute;
    inset: -24px;
    background-image: inherit;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    filter: blur(18px);
    transform: scale(1.08);
    opacity: 0.85;
}

.dgc-generated-video-stage.has-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 20%, rgba(0,0,0,0.15), rgba(0,0,0,0.72));
}

.dgc-generated-video-stage video {
    position: relative;
    z-index: 1;
    height: 100%;
    width: 100%;
    max-width: none;
    max-height: none;
    object-fit: cover;
    border-radius: 0;
    box-shadow: none;
}

.dgc-generated-video-close {
    position: absolute;
    top: max(10px, env(safe-area-inset-top));
    right: max(10px, env(safe-area-inset-right));
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    font-size: 28px;
    line-height: 1;
    color: #fff;
    background: rgba(255,255,255,0.12);
}

.dgc-generated-video-actions {
    width: 100%;
    max-width: 980px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 14px;
}

.dgc-generated-video-actions {
    transition: opacity 180ms ease, transform 180ms ease;
}

.dgc-generated-video-overlay.is-actions-hidden .dgc-generated-video-actions {
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
}

.dgc-generated-video-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.18);
    background: rgba(255,255,255,0.08);
    color: #fff;
    text-decoration: none;
    cursor: pointer;
    font-weight: 600;
}

.dgc-generated-video-discard {
    border-color: rgba(255, 82, 82, 0.55);
    background: rgba(255, 82, 82, 0.12);
}

/* Make generated video thumbnails act like buttons */
.dgc-generated-video {
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.dgc-generated-video {
    display: block;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.18);
}

.dgc-generated-video video {
    width: 100%;
    height: auto;
    display: block;
}

.dgc-welcome-message {
    text-align: center;
    color: rgba(255,255,255,0.8);
    font-style: italic;
}

/* Typing Indicator */
.dgc-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    color: rgba(255,255,255,0.8);
    font-size: 14px;
}

.dgc-typing-indicator span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #d186ae;
    animation: typing-dots 1.4s infinite ease-in-out;
}

.dgc-typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.dgc-typing-indicator span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing-dots {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* =========================================
   INPUT AREA
   ======================================== */

/* =========================================
   CHATBOT PROFILE DRAWER (below chat)
   Base styles for standalone chat usage.
   Dashboard pages override these in dashboard.css.
   ======================================== */

.dgc-chatbot-profile-drawer {
    margin: 12px auto 0;
    max-width: 100%;
    background: rgba(10, 10, 14, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 18px;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    position: relative;
    overflow: hidden;
}

.dgc-chatbot-profile-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 16px;
    background: transparent;
    color: #ffffff;
    border: 0;
    cursor: pointer;
}

.dgc-chatbot-profile-toggle-label {
    font-weight: 800;
    letter-spacing: 0.2px;
}

.dgc-chatbot-profile-toggle-hint {
    margin-left: auto;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

.dgc-chatbot-profile-toggle-caret {
    transition: transform 0.2s ease;
    opacity: 0.85;
}

.dgc-chatbot-profile-drawer.is-open .dgc-chatbot-profile-toggle-caret {
    transform: rotate(180deg);
}

.dgc-chatbot-profile-drawer-body {
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    padding: 14px;
}

.dgc-chatbot-profile-drawer-body .dgc-profile-shell {
    margin: 0;
}

.dgc-chat-input {
    position: relative;
    padding: 10px 20px 20px 20px;
    background: transparent;
    z-index: 10;
    box-sizing: border-box; /* Ensure padding doesn't cause overflow */
}

/* Mobile: Sticky input with transparent background */
@media (max-width: 768px) {
    /* Non-fullscreen: input positioned at bottom but will attach to keyboard when opened */
    .dgc-chat-container:not(.mobile-fullscreen):not([data-dashboard-mode="1"]) .dgc-chat-input {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 10px 2px; /* Minimal 2px side padding */
        padding-bottom: max(10px, env(safe-area-inset-bottom));
        background: transparent;
        border-top: none;
        box-shadow: none;
        z-index: 10;
        box-sizing: border-box; /* Prevent padding overflow */
        width: 100%;
    }

    /* Fullscreen input in non-keyboard state - positioned absolute at bottom of container */
    .dgc-chat-container.mobile-fullscreen:not(.keyboard-open) .dgc-chat-input {
        position: absolute !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        z-index: 10 !important;
        padding: 10px 2px !important;
        padding-bottom: max(10px, env(safe-area-inset-bottom, 0px)) !important;
        box-sizing: border-box !important;
        margin: 0 !important;
    }

    /* In dashboard mode, position input flush with top of dashboard menu */
    .dgc-dashboard-wrapper[data-active-tab="chat"] .dgc-chat-container[data-dashboard-mode="1"] .dgc-chat-input {
        position: absolute;
        /* The chat tab content already reserves space above the fixed bottom tabs. */
        bottom: 0;
        left: 0;
        right: 0;
        padding: 10px 15px;
        background: transparent;
        z-index: 10;
    }

    /* In mobile fullscreen inside dashboard, tabs/menus are hidden; do not reserve bottom space. */
    .dgc-dashboard-wrapper.dgc-chat-mobile-fullscreen[data-active-tab="chat"] .dgc-chat-container.mobile-fullscreen[data-dashboard-mode="1"] .dgc-chat-input {
        bottom: 0 !important;
    }

    /* CRITICAL FIX: In mobile fullscreen inside dashboard WITH keyboard, override bottom to use keyboard offset */
    .dgc-dashboard-wrapper.dgc-chat-mobile-fullscreen.dgc-keyboard-open[data-active-tab="chat"] .dgc-chat-container.mobile-fullscreen[data-dashboard-mode="1"].keyboard-open .dgc-chat-input,
    .dgc-dashboard-wrapper.dgc-chat-mobile-fullscreen.dgc-keyboard-open[data-active-tab="chat"] .dgc-chat-container.mobile-fullscreen[data-dashboard-mode="1"] .dgc-chat-input {
        position: fixed !important;
        bottom: calc(var(--dgc-keyboard-offset, 0px) + env(safe-area-inset-bottom, 0px)) !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        z-index: 9999 !important;
    }

    /* Add padding to messages to prevent overlap with input */
    .dgc-chat-container .dgc-messages-content {
        /* Reserve room for the absolutely-positioned input block
           (pricing line + textarea + send button ≈ 100-110px).
           140px gives modest clearance so the last bubble is visible. */
        padding-bottom: max(140px, calc(120px + env(safe-area-inset-bottom, 0px))) !important;
        scroll-padding-bottom: max(140px, calc(120px + env(safe-area-inset-bottom, 0px))) !important;
        max-height: none;
    }

    /* When keyboard opens: input is position:fixed above keyboard and no longer in layout flow.
       Padding must cover keyboard offset + input height (~100px) + gap so last bubble clears.
       JS updateMessagePadding / dashboard.js sets a more precise inline value; this is the fallback. */
    .dgc-chat-container.keyboard-open .dgc-messages-content {
        padding-bottom: calc(100px + var(--dgc-keyboard-offset, 0px) + 14px);
        scroll-padding-bottom: calc(100px + var(--dgc-keyboard-offset, 0px) + 14px);
        max-height: none;
    }

    /* Fullscreen + keyboard: same logic */
    .dgc-chat-container.mobile-fullscreen.keyboard-open .dgc-messages-content {
        padding-bottom: calc(100px + var(--dgc-keyboard-offset, 0px) + 14px);
        scroll-padding-bottom: calc(100px + var(--dgc-keyboard-offset, 0px) + 14px);
        max-height: none;
    }

    /* Dashboard keyboard watcher uses the wrapper class */
    .dgc-dashboard-wrapper.dgc-keyboard-open .dgc-chat-container[data-dashboard-mode="1"] .dgc-messages-content {
        padding-bottom: calc(100px + var(--dgc-keyboard-offset, 0px) + 14px);
        scroll-padding-bottom: calc(100px + var(--dgc-keyboard-offset, 0px) + 14px);
    }

    /* Keyboard-open (embedded shortcode, not dashboard):
       Input attaches to keyboard - fixed positioning overrides absolute positioning above */
    /* (superseded by the .keyboard-open rule above which uses fixed positioning) */

    /* Dashboard mobile keyboard input positioning is handled by dashboard.css
       using position:absolute (stays within the chat container's overflow:hidden).
       Do NOT use position:fixed here — it escapes the container and misaligns with
       the dashboard's fixed bottom tabs after fullscreen/keyboard transitions. */

    /* When keyboard closes on chat tab, ensure chat container sits above the restored tab bar. */
    .dgc-dashboard-wrapper[data-active-tab="chat"]:not(.dgc-keyboard-open) .dgc-chat-container[data-dashboard-mode="1"]:not(.mobile-fullscreen) {
        --dgc-chat-outer-offset: var(--dgc-dashboard-tabs-total-height, 0px);
    }

    /* In mobile fullscreen inside dashboard with keyboard, attach to keyboard */
    .dgc-dashboard-wrapper.dgc-chat-mobile-fullscreen.dgc-keyboard-open[data-active-tab="chat"] .dgc-chat-container.mobile-fullscreen[data-dashboard-mode="1"].keyboard-open .dgc-chat-input {
        position: fixed !important;
        bottom: calc(var(--dgc-keyboard-offset, 0px) + env(safe-area-inset-bottom, 0px)) !important;
        transform: none !important;
        padding: 10px 2px 6px !important;
    }

    /* Dashboard mode: use the dashboard keyboard watcher (wrapper class) to pin the input to the keyboard. */
    .dgc-dashboard-wrapper.dgc-keyboard-open .dgc-chat-container[data-dashboard-mode="1"] .dgc-chat-input {
        position: fixed;
        bottom: calc(var(--dgc-keyboard-offset, 0px) + env(safe-area-inset-bottom, 0px));
        left: 0;
        right: 0;
        top: auto;
        width: 100%;
        z-index: 10100;
        background: transparent;
        margin: 0;
        border-top: none;
        padding: 10px 15px 6px;
        display: flex !important;
        flex-direction: column;
        visibility: visible !important;
        gap: 8px;
        align-items: stretch;
        box-shadow: none;
        transform: none !important;
    }

    /* Keyboard-open: keep the controls row layout and avoid flex squeeze. */
    .dgc-chat-container.keyboard-open .dgc-input-controls {
        display: flex;
        align-items: flex-end;
        gap: 10px;
        margin-bottom: 0;
        width: 100%;
    }

    .dgc-chat-container.keyboard-open #dgc-message-input {
        min-width: 0;
        flex: 1 1 auto;
    }
}

.dgc-input-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

#dgc-message-input {
    flex: 1;
    width: 100%;
    min-height: 44px;
    max-height: 120px; /* Allow expansion up to ~5 lines */
    padding: 12px 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 25px;
    background: transparent;
    color: #ffffff;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s, background 0.3s;
    resize: none;
    overflow-y: auto;
    font-family: inherit;
    line-height: 1.4;
    box-sizing: border-box; /* Ensure padding is included in width */
}

/* Mobile: constrain input to single line and maintain stable width */
@media (max-width: 768px) {
    #dgc-message-input {
        min-height: 44px;
        max-height: 44px; /* Force single line on mobile */
        height: 44px;
        overflow-y: hidden; /* Hide overflow for single line */
        overflow-x: auto; /* Allow horizontal scroll if needed */
        line-height: 20px; /* Adjust line height for proper centering */
        padding: 12px 15px; /* Slightly reduced padding */
    }
    
    /* Ensure input controls maintain layout on mobile with 2px padding */
    .dgc-input-controls {
        width: calc(100% - 4px);
        box-sizing: border-box;
        align-items: center;
        flex-wrap: nowrap; /* Prevent wrapping */
        margin: 0 2px; /* 2px side padding */
        padding: 0;
    }
    
    /* Ensure buttons don't get cut off */
    .dgc-gift-button,
    .dgc-voice-button,
    .dgc-send-button {
        flex-shrink: 0; /* Prevent buttons from shrinking */
        min-width: 44px;
        width: 44px;
        height: 44px;
    }
    
    /* Keyboard open: maintain stable width and prevent layout shift */
    .dgc-chat-container.keyboard-open #dgc-message-input {
        width: 100% !important;
        max-width: none !important;
        flex: 1 1 auto !important;
        min-width: 0 !important;
    }
    
    .dgc-chat-container.keyboard-open .dgc-input-controls {
        width: calc(100% - 4px) !important;
        margin: 0 2px !important;
        flex-wrap: nowrap !important;
    }
}

#dgc-message-input:focus {
    border-color: #ff1493;
    background: rgba(255,255,255,0.1);
}

/* Hide scrollbar in expanding textarea */
#dgc-message-input::-webkit-scrollbar {
    display: none;
}

#dgc-message-input {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.dgc-gift-button,
.dgc-voice-button,
.dgc-send-button {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    background: rgba(255,255,255,0.2);
    color: white;
    flex-shrink: 0;
}

.dgc-send-button {
    background: linear-gradient(45deg, #ff1493, #8a2be2);
}

.dgc-send-button:hover {
    transform: scale(1.05);
}

/* Ensure Dashicons display properly */
.dgc-gift-button .dashicons,
.dgc-voice-button .dashicons,
.dgc-send-button .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
    line-height: 1;
    display: inline-block;
}

.dgc-gift-button .dgc-gift-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    display: block;
}

/* Mobile - ensure icons are visible */
@media (max-width: 768px) {
    .dgc-gift-button .dashicons,
    .dgc-voice-button .dashicons,
    .dgc-send-button .dashicons {
        font-size: 22px;
        width: 22px;
        height: 22px;
    }

    .dgc-gift-button .dgc-gift-icon {
        width: 22px;
        height: 22px;
    }
}

.dgc-pricing-info {
    text-align: center;
    color: rgba(255,255,255,0.7);
    font-size: 12px;
}

.dgc-media-buttons {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dgc-media-buttons .dgc-video-button {
    display: none;
    position: absolute;
    top: -54px; /* Position it directly above the microphone button */
    left: 0;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.dgc-media-buttons.reveal-video .dgc-video-button {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

/* =========================================
   USER-USER VIDEO OVERLAY
   ======================================== */

body.dgc-user-video-open {
    overflow: hidden;
}

.dgc-user-video-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(0,0,0,0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
}

.dgc-user-video-shell {
    width: min(1100px, 100%);
    height: min(720px, 100%);
    background: rgba(18, 18, 22, 0.92);
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 22px 65px rgba(0,0,0,0.6);
}

.dgc-user-video-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    background: rgba(0,0,0,0.22);
    border-bottom: 1px solid rgba(255,255,255,0.10);
}

.dgc-user-video-title {
    font-weight: 800;
    color: rgba(255,255,255,0.92);
}

.dgc-user-video-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.dgc-user-video-hangup {
    appearance: none;
    border: 1px solid rgba(255, 20, 147, 0.45);
    background: rgba(255, 20, 147, 0.14);
    color: #fff;
    border-radius: 999px;
    padding: 8px 12px;
    font-weight: 800;
    cursor: pointer;
}

.dgc-user-video-close {
    appearance: none;
    border: 1px solid rgba(255,255,255,0.18);
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.92);
    border-radius: 999px;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-size: 20px;
    line-height: 34px;
}

.dgc-user-video-stage {
    position: relative;
    flex: 1;
    background: #000;
}

.dgc-user-video-status {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 2;
    background: rgba(0,0,0,0.45);
    border: 1px solid rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.92);
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
}

.dgc-user-video-remote {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
}

.dgc-user-video-local {
    position: absolute;
    right: 12px;
    bottom: 12px;
    width: min(260px, 42vw);
    height: min(160px, 28vw);
    object-fit: cover;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.22);
    background: rgba(0,0,0,0.35);
    z-index: 2;
}

.dgc-user-video-iframe {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.dgc-user-video-open-link{
    position: absolute;
    right: 12px;
    top: 12px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.18);
    background: rgba(0,0,0,0.40);
    color: rgba(255,255,255,0.92);
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
}
.dgc-user-video-open-link:hover{
    background: rgba(0,0,0,0.55);
}

.dgc-user-video-iframe iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

@media (max-width: 720px) {
    .dgc-user-video-overlay {
        padding: 0;
    }

    .dgc-user-video-shell {
        width: 100%;
        height: 100%;
        border-radius: 0;
    }
}

/* =========================================
   VOICE CALL OVERLAY (NO LAYOUT SHIFT)
   ======================================== */

/* Overlay/modal styles removed: voice chat is always inline */

/* Inline voice panel (responsive, sits above input controls) */
.dgc-chat-input .dgc-voice-interface {
    width: 100%;
    margin: 0 0 10px;
    padding: 10px;
    background: rgba(18, 18, 22, 0.55);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 14px;
    box-shadow: none;
}

/* Keep the panel focused by default */
.dgc-chat-input .dgc-voice-status,
.dgc-chat-input .dgc-voice-visualizer {
    display: none;
}

/* Minimal animated indicator while listening */
.dgc-chat-container.dgc-voice-mode #dgc-voice-chat.is-listening .dgc-voice-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.10);
    margin-top: 8px;
}

.dgc-chat-container.dgc-voice-mode #dgc-voice-chat.is-listening .dgc-voice-visualizer {
    display: inline-flex;
    align-items: center;
}

.dgc-chat-container.dgc-voice-mode #dgc-voice-chat.is-listening .dgc-voice-bars {
    display: inline-flex;
    gap: 3px;
    height: 14px;
}

.dgc-chat-container.dgc-voice-mode #dgc-voice-chat.is-listening .dgc-voice-bars span {
    display: inline-block;
    width: 3px;
    height: 6px;
    border-radius: 3px;
    background: rgba(255,255,255,0.85);
    opacity: 0.65;
    transform-origin: bottom;
    animation: dgc-voice-listen 0.9s ease-in-out infinite;
}

.dgc-chat-container.dgc-voice-mode #dgc-voice-chat.is-listening .dgc-voice-bars span:nth-child(2) { animation-delay: 0.10s; }
.dgc-chat-container.dgc-voice-mode #dgc-voice-chat.is-listening .dgc-voice-bars span:nth-child(3) { animation-delay: 0.20s; }
.dgc-chat-container.dgc-voice-mode #dgc-voice-chat.is-listening .dgc-voice-bars span:nth-child(4) { animation-delay: 0.30s; }
.dgc-chat-container.dgc-voice-mode #dgc-voice-chat.is-listening .dgc-voice-bars span:nth-child(5) { animation-delay: 0.40s; }

.dgc-chat-container.dgc-voice-mode #dgc-voice-chat.is-listening #dgc-voice-text {
    margin: 0;
    font-size: 12px;
    color: rgba(255,255,255,0.88);
    letter-spacing: 0.2px;
}

@keyframes dgc-voice-listen {
    0%, 100% { transform: scaleY(0.55); opacity: 0.55; }
    50% { transform: scaleY(1.20); opacity: 0.95; }
}

.dgc-chat-input .dgc-voice-header {
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.dgc-chat-input .dgc-voice-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.dgc-chat-input .dgc-voice-controls {
    margin-top: 0;
}

.dgc-chat-input .dgc-voice-controls button {
    height: 38px;
    border-radius: 12px;
}

/* Keep output toggles obvious in the inline panel */
.dgc-chat-input .dgc-voice-output-controls {
    display: flex !important;
    gap: 10px;
    margin-top: 10px;
}

.dgc-chat-input .dgc-voice-output-controls button {
    height: 34px;
    border-radius: 12px;
    font-size: 12px;
    letter-spacing: 0.2px;
}

.dgc-voice-settings[data-dgc-voice-selector-visible="0"] {
    display: none !important;
}

@media (max-width: 768px) {
    .dgc-chat-input .dgc-voice-controls {
        gap: 8px;
    }
    .dgc-chat-input .dgc-voice-settings {
        margin: 8px 0 0;
        gap: 8px;
    }
    .dgc-chat-input .dgc-voice-settings label {
        min-width: 40px;
    }
}

.dgc-voice-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.dgc-voice-title {
    color: #fff;
    font-size: 14px;
    letter-spacing: 0.2px;
}

.dgc-voice-timer {
    color: rgba(255,255,255,0.85);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    padding: 4px 8px;
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 10px;
    background: rgba(255,255,255,0.06);
}

.dgc-voice-close {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.14);
    background: rgba(255,255,255,0.08);
    color: #fff;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}

.dgc-voice-settings {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 0 10px;
}

.dgc-voice-settings label {
    color: rgba(255,255,255,0.8);
    font-size: 12px;
    min-width: 44px;
}

.dgc-voice-settings select {
    flex: 1;
    height: 36px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.16);
    background: rgba(255,255,255,0.08);
    color: #fff;
    padding: 0 10px;
    outline: none;
}

/* Basic voice panel typography (in case theme has no styles for it) */
.dgc-voice-status #dgc-voice-text {
    color: rgba(255,255,255,0.9);
    margin: 10px 0 0;
    font-size: 13px;
}

.dgc-voice-controls {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.dgc-voice-controls button {
    flex: 1;
    height: 40px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    color: #fff;
    background: rgba(255,255,255,0.14);
}

.dgc-voice-controls button#dgc-voice-start {
    background: linear-gradient(45deg, #ff1493, #8a2be2);
}

.dgc-voice-controls button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Voice output controls (Speak/Text + Mute) */
.dgc-voice-output-controls {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.dgc-voice-output-controls button {
    flex: 1;
    height: 34px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    color: rgba(255,255,255,0.95);
    background: rgba(255,255,255,0.12);
}

.dgc-voice-output-controls button.is-active {
    background: rgba(255,255,255,0.22);
}

/* =========================================
   MINIMAL VOICE MODE HUD (timer + mute only)
   Visible only while voice mode is active
   ========================================= */

/* Default: keep the full voice panel hidden (JS toggles voice mode) */
.dgc-chat-container:not(.dgc-voice-mode) #dgc-voice-chat {
    display: none !important;
}

/* Voice mode: show a minimal, no-background row */
.dgc-chat-container.dgc-voice-mode #dgc-voice-chat {
    display: flex !important;
    align-items: center;
    gap: 10px;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 0 8px 0;
}

.dgc-chat-container.dgc-voice-mode #dgc-voice-chat .dgc-voice-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    width: 100%;
    margin: 0;
}

/* Remove timer pill styling in voice mode (no background/table look) */
.dgc-chat-container.dgc-voice-mode #dgc-voice-chat .dgc-voice-timer {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: rgba(255,255,255,0.9);
}

/* Hide everything except timer + mute */
.dgc-chat-container.dgc-voice-mode #dgc-voice-chat .dgc-voice-title,
.dgc-chat-container.dgc-voice-mode #dgc-voice-chat .dgc-voice-close,
.dgc-chat-container.dgc-voice-mode #dgc-voice-chat .dgc-voice-status,
.dgc-chat-container.dgc-voice-mode #dgc-voice-chat .dgc-voice-controls,
.dgc-chat-container.dgc-voice-mode #dgc-voice-chat .dgc-voice-settings,
.dgc-chat-container.dgc-voice-mode #dgc-voice-chat .dgc-voice-output-controls .dgc-voice-toggle-reply-mode,
.dgc-chat-container.dgc-voice-mode #dgc-voice-chat .dgc-voice-output-controls #dgc-voice-cutoff {
    display: none !important;
}

.dgc-chat-container.dgc-voice-mode #dgc-voice-chat .dgc-voice-output-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 0 auto;
}

.dgc-chat-container.dgc-voice-mode #dgc-voice-chat .dgc-voice-output-controls button {
    flex: 0 0 auto;
}

/* Voice state pill (visible indicator in voice mode) */
.dgc-chat-container.dgc-voice-mode #dgc-voice-chat .dgc-voice-state {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1;
    letter-spacing: 0.2px;
    color: rgba(255,255,255,0.92);
    background: rgba(255,255,255,0.10);
    border: 1px solid rgba(255,255,255,0.14);
    box-shadow: 0 1px 8px rgba(0,0,0,0.22);
    white-space: nowrap;
}

.dgc-chat-container.dgc-voice-mode #dgc-voice-chat.is-listening .dgc-voice-state,
.dgc-chat-container.dgc-voice-mode #dgc-voice-chat.is-processing .dgc-voice-state,
.dgc-chat-container.dgc-voice-mode #dgc-voice-chat.is-speaking .dgc-voice-state {
    display: inline-flex;
}

.dgc-chat-container.dgc-voice-mode #dgc-voice-chat.is-listening .dgc-voice-state::before,
.dgc-chat-container.dgc-voice-mode #dgc-voice-chat.is-processing .dgc-voice-state::before,
.dgc-chat-container.dgc-voice-mode #dgc-voice-chat.is-speaking .dgc-voice-state::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: rgba(255,255,255,0.92);
    box-shadow: 0 0 0 0 rgba(255, 20, 147, 0.0);
}

.dgc-chat-container.dgc-voice-mode #dgc-voice-chat.is-listening .dgc-voice-state::before {
    background: rgba(46, 229, 157, 0.95);
    box-shadow: 0 0 0 0 rgba(46, 229, 157, 0.5);
    animation: dgc-voice-pulse 1.2s ease-in-out infinite;
}

.dgc-chat-container.dgc-voice-mode #dgc-voice-chat.is-processing .dgc-voice-state::before {
    background: rgba(255, 204, 0, 0.95);
}

.dgc-chat-container.dgc-voice-mode #dgc-voice-chat.is-speaking .dgc-voice-state::before {
    background: rgba(255, 20, 147, 0.95);
}

@keyframes dgc-voice-pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(46, 229, 157, 0.45); }
    70% { transform: scale(1.0); box-shadow: 0 0 0 10px rgba(46, 229, 157, 0.0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(46, 229, 157, 0.0); }
}

.dgc-chat-container.dgc-voice-mode #dgc-voice-chat .dgc-voice-toggle-mute {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.22);
    color: rgba(255,255,255,0.95);
}

.dgc-chat-container.dgc-voice-mode #dgc-voice-chat .dgc-voice-toggle-mute.is-active {
    background: rgba(255,255,255,0.18);
    border-color: rgba(255,255,255,0.28);
}

/* Background effects overlay container (optional, safe even if unused) */
.dgc-bg-effects {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    border-radius: inherit;
}

/* =========================================
   MODAL SYSTEM - FULL SCREEN WITHIN CHAT CONTAINER
   ======================================== */

/* Modal positioned relative to chat container, takes full space */
.dgc-chat-container .dgc-modal {
    position: absolute;
    z-index: 10100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    overflow: hidden;
}

/* Modal content takes full available space */
.dgc-chat-container .dgc-modal-content {
    background: transparent;
    flex: 1;
    display: flex;
    flex-direction: column;
    color: #ffffff;
    box-sizing: border-box;
    overflow: hidden;
    padding: 0;
    margin: 0;
    width: 100%;
    height: 100%;
}

/* Modal header styling - fixed at top */
.dgc-chat-container .dgc-modal-content h3 {
    margin: 0;
    padding: 25px 20px 20px;
    color: #ffffff;
    font-size: 22px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    flex-shrink: 0;
}

/* Modal close button */
.dgc-chat-container .dgc-modal-close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 32px;
    font-weight: 300;
    cursor: pointer;
    color: #ffffff;
    z-index: 10101;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s, transform 0.2s;
    background: transparent;
    border: none;
}

.dgc-chat-container .dgc-modal-close:hover {
    background: rgba(255,255,255,0.15);
    transform: scale(1.1);
}

.dgc-chat-container .dgc-modal-close:active {
    transform: scale(0.9);
}

/* WooCommerce login/register inside chat login modal: stack vertically */
.dgc-chat-container .dgc-login-modal-woo .woocommerce .u-columns,
.dgc-chat-container .dgc-login-modal-woo .woocommerce .col2-set,
.dgc-chat-container .dgc-login-modal-woo .woocommerce-page .u-columns {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.dgc-chat-container .dgc-login-modal-woo .woocommerce .u-column1,
.dgc-chat-container .dgc-login-modal-woo .woocommerce .u-column2,
.dgc-chat-container .dgc-login-modal-woo .woocommerce .col-1,
.dgc-chat-container .dgc-login-modal-woo .woocommerce .col-2 {
    float: none !important;
    width: 100% !important;
    max-width: 100% !important;
}

/* Scrollable content area - takes remaining space */
.dgc-chat-container #dgc-gift-list,
.dgc-chat-container #dgc-coin-packages,
.dgc-chat-container #dgc-transactions-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    -webkit-overflow-scrolling: touch;
}

/* Hide scrollbars but keep functionality */
.dgc-chat-container #dgc-gift-list::-webkit-scrollbar,
.dgc-chat-container #dgc-coin-packages::-webkit-scrollbar,
.dgc-chat-container #dgc-transactions-content::-webkit-scrollbar {
    display: none;
}

.dgc-chat-container #dgc-gift-list,
.dgc-chat-container #dgc-coin-packages,
.dgc-chat-container #dgc-transactions-content {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* =========================================
    TOP-UP & COIN PACKAGES
    ======================================== */

.dgc-chat-container .dgc-packages {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    padding: 0;
}

@media (max-width: 768px) {
    .dgc-chat-container .dgc-packages {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }
}

.dgc-chat-container .dgc-package {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 15px;
    padding: 20px 15px;
    text-align: center;
    color: #ffffff;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 160px;
}

.dgc-chat-container .dgc-package:hover {
    transform: translateY(-4px);
    border-color: #ff1493;
    background: rgba(255,255,255,0.08);
    box-shadow: 0 8px 20px rgba(255, 20, 147, 0.3);
}

.dgc-chat-container .dgc-package h4 {
    margin: 0 0 10px 0;
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
}

.dgc-chat-container .dgc-package p {
    margin: 6px 0;
    color: rgba(255,255,255,0.8);
    font-size: 13px;
}

.dgc-chat-container .dgc-price {
    font-weight: bold;
    color: #ff1493 !important;
    font-size: 20px !important;
    margin: 10px 0 !important;
}

.dgc-chat-container .dgc-buy-package {
    background: linear-gradient(45deg, #ff1493, #8a2be2);
    color: #ffffff;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    margin-top: 12px;
    width: 100%;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dgc-chat-container .dgc-buy-package:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 20, 147, 0.4);
}


/* Loading State */
.dgc-chat-container .dgc-buy-package.loading,
.dgc-chat-container .dgc-stripe-pay-btn.loading {
	position: relative;
	color: transparent;
}

.dgc-chat-container .dgc-buy-package.loading::after,
.dgc-chat-container .dgc-stripe-pay-btn.loading::after {
	content: '';
	position: absolute;
	width: 14px;
	height: 14px;
	top: 50%;
	left: 50%;
	margin-left: -7px;
	margin-top: -7px;
	border: 2px solid #ffffff;
	border-radius: 50%;
	border-top-color: transparent;
	animation: spin 1s linear infinite;
}

@keyframes spin {
	0% { transform: rotate(0deg); }
	100% { transform: rotate(360deg); }
}

/* WooCommerce Popup Styles - Fixed positioning relative to chat container */
.dgc-chat-container .dgc-woocommerce-popup-overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.85);
	display: flex;
	justify-content: center;
	align-items: center;
	z-index: 10000;
	padding: 15px;
	box-sizing: border-box;
	overflow: hidden;
}

.dgc-chat-container .dgc-woocommerce-popup {
	background: #000000;
	border-radius: 15px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
	width: 100%;
	height: 100%;
	max-width: 100%;
	max-height: 100%;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	animation: popupSlideIn 0.3s ease-out;
	border: 1px solid rgba(255,255,255,0.2);
}

@keyframes popupSlideIn {
	from { opacity: 0; transform: translateY(-30px) scale(0.95); }
	to { opacity: 1; transform: translateY(0) scale(1); }
}

.dgc-chat-container .dgc-popup-header {
	padding: 15px 20px;
	border-bottom: 1px solid rgba(255,255,255,0.2);
	display: flex;
	justify-content: space-between;
	align-items: center;
	background: linear-gradient(135deg, #ff1493, #8a2be2);
	color: white;
	border-radius: 15px 15px 0 0;
}

.dgc-chat-container .dgc-popup-header h3 {
	margin: 0;
	font-size: 16px;
	font-weight: 600;
}

.dgc-chat-container .dgc-popup-close {
	background: rgba(255, 255, 255, 0.2);
	border: 1px solid rgba(255, 255, 255, 0.3);
	color: white;
	border-radius: 50%;
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	font-size: 18px;
	transition: background 0.2s;
	font-weight: bold;
}

.dgc-chat-container .dgc-popup-close:hover {
	background: rgba(255, 255, 255, 0.3);
	transform: rotate(90deg);
}

.dgc-chat-container .dgc-popup-content {
	flex: 1;
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.dgc-chat-container .dgc-popup-summary {
	padding: 12px 15px;
	background: rgba(255,255,255,0.05);
	font-size: 13px;
	color: rgba(255,255,255,0.8);
}

.dgc-chat-container .dgc-popup-summary p {
	margin: 4px 0;
}

.dgc-chat-container .dgc-popup-summary .dgc-price {
	font-size: 16px;
	font-weight: bold;
	color: #ff1493;
}

.dgc-chat-container .dgc-popup-checkout {
	flex: 1;
	overflow: hidden;
	position: relative;
}

.dgc-chat-container .dgc-popup-checkout iframe {
	width: 100%;
	height: 100%;
	border: none;
	display: block;
}

.dgc-chat-container .dgc-popup-footer {
	padding: 12px 15px;
	background: rgba(255,255,255,0.05);
	font-size: 11px;
	color: rgba(255,255,255,0.6);
	text-align: center;
	border-radius: 0 0 15px 15px;
}


/* =========================================
   MOBILE OPTIMIZATIONS
   ======================================== */

/* Ensure proper viewport behavior on mobile */
@media (max-width: 768px) {
    /* Prevent body scroll when chat is in fullscreen mode */
    body.dgc-chat-fullscreen {
        overflow: hidden;
        overscroll-behavior: none;
        width: 100%;
    }

    /* If native fullscreen is actually active, keep scroll-lock strict. */
    body.dgc-chat-fullscreen.dgc-native-fullscreen {
        overflow: hidden;
    }
    
    /* Optimize button sizes for touch */
    .dgc-send-button,
    .dgc-gift-button,
    .dgc-voice-button {
        min-width: 44px;
        min-height: 44px;
    }
    
    /* Ensure input is accessible above mobile keyboard */
    #dgc-message-input {
        font-size: 16px; /* Prevent iOS zoom on focus */
    }
    
    /* Adjust pricing info for mobile */
    .dgc-pricing-info {
        font-size: 11px;
        margin-top: 8px;
    }
}

/* Improve touch behavior in fullscreen on mobile browsers */
@media (max-width: 768px) {
    .dgc-chat-container.mobile-fullscreen button,
    .dgc-chat-container.mobile-fullscreen a {
        touch-action: manipulation;
    }
}

/* Landscape mobile adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    .dgc-chat-container.mobile-fullscreen .dgc-chat-header {
        padding-top: 10px;
        padding-bottom: 15px;
    }
    
    .dgc-chat-container.mobile-fullscreen .dgc-chat-input {
        padding-top: 10px;
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }
    
    .dgc-chat-container.mobile-fullscreen .dgc-messages-content {
        padding-bottom: 140px;
        max-height: calc(100vh - 150px);
    }
}

/* Loading State */
.dgc-buy-package.loading,
.dgc-stripe-pay-btn.loading {
    position: relative;
    color: transparent;
}

.dgc-buy-package.loading::after,
.dgc-stripe-pay-btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spinner 0.8s linear infinite;
}

@keyframes spinner {
    to { transform: rotate(360deg); }
}

/* =========================================
   TRANSACTION HISTORY & RECEIPTS
   ======================================== */

.dgc-transaction-history-mini {
    background: rgba(0,0,0,0.6);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 15px;
    margin-top: 15px;
}

.dgc-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 8px;
}

.dgc-history-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.dgc-history-header h4 {
    margin: 0;
    color: #ffffff;
    font-size: 16px;
}

.dgc-refresh-transactions {
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s;
}

.dgc-toggle-transactions {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.14);
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s;
}

.dgc-toggle-transactions:hover {
    background: rgba(255,255,255,0.16);
}

.dgc-refresh-transactions:hover {
    background: rgba(255,255,255,0.2);
}

.dgc-history-list {
    max-height: 200px;
    overflow-y: auto;
}

.dgc-history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 12px;
}

.dgc-history-item:last-child {
    border-bottom: none;
}

.dgc-history-item.positive {
    color: #4CAF50;
}

.dgc-history-item.negative {
    color: #f44336;
}

.dgc-history-type {
    flex: 1;
    text-transform: capitalize;
    opacity: 0.8;
}

.dgc-history-amount {
    font-weight: bold;
    margin: 0 10px;
}

.dgc-history-date {
    opacity: 0.6;
    font-size: 11px;
}

/* Transaction Receipts */
.dgc-receipts-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: 400px;
    overflow-y: auto;
    padding: 10px 0;
}

.dgc-transaction-receipt {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 15px;
    padding: 18px;
    color: #ffffff;
    font-size: 14px;
    transition: all 0.3s ease;
}

.dgc-transaction-receipt:hover {
    transform: translateY(-2px);
    background: rgba(255,255,255,0.08);
    border-color: #ff1493;
    box-shadow: 0 6px 20px rgba(255, 20, 147, 0.2);
}

.dgc-receipt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.dgc-receipt-type {
    font-weight: 600;
    text-transform: capitalize;
    color: #ffffff;
    font-size: 16px;
}

.dgc-receipt-amount {
    font-weight: 700;
    font-size: 18px;
}

.dgc-receipt-amount.positive {
    color: #4CAF50;
}

.dgc-receipt-amount.negative {
    color: #f44336;
}

.dgc-receipt-body {
    margin-bottom: 12px;
}

.dgc-receipt-description {
    color: rgba(255,255,255,0.9);
    margin-bottom: 8px;
    line-height: 1.4;
}

.dgc-receipt-date {
    color: rgba(255,255,255,0.6);
    font-size: 12px;
}

.dgc-receipt-footer {
    text-align: right;
    padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.dgc-chat-container .dgc-receipt-id {
    color: rgba(255,255,255,0.5);
    font-size: 10px;
    font-family: monospace;
}


/* =========================================
   CHECKOUT & PAYMENT SYSTEM
   ======================================== */

.dgc-checkout-container {
    background: rgba(0,0,0,0.8);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 10px;
    padding: 15px;
    margin-top: 10px;
    max-height: 70vh;
    overflow-y: auto;
}

.dgc-checkout-content {
    max-width: 400px;
}

.dgc-checkout-summary {
    background: rgba(255,255,255,0.05);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    text-align: center;
}

.dgc-checkout-summary h4 {
    margin: 0 0 10px 0;
    color: #ffffff;
}

.dgc-checkout-summary p {
    margin: 5px 0;
    color: rgba(255,255,255,0.8);
}

.dgc-checkout-price {
    font-size: 24px !important;
    font-weight: bold;
    color: #ff1493 !important;
    margin-top: 10px !important;
}

.dgc-checkout-item {
    text-align: center;
}

.dgc-checkout-item h4 {
    margin: 0 0 5px 0;
    color: #ffffff;
    font-size: 18px;
}

.dgc-checkout-item p {
    margin: 5px 0;
    color: rgba(255,255,255,0.8);
}

.dgc-payment-form {
    margin-top: 20px;
}

.dgc-stripe-fields {
    margin-bottom: 15px;
}

.dgc-card-element,
#dgc-card-element {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
}

#dgc-card-element.StripeElement--focus {
    border-color: #007bff;
    background: rgba(255,255,255,0.1);
}

.dgc-error-message {
    color: #f44336;
    font-size: 14px;
    margin-top: 5px;
}

.dgc-payment-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(45deg, #ff1493, #8a2be2);
    color: #ffffff;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.dgc-payment-btn:hover:not(:disabled) {
    transform: translateY(-2px);
}

.dgc-payment-btn:disabled {
    background: rgba(255,255,255,0.2);
    cursor: not-allowed;
    transform: none;
}

/* Gift animation overlay */
.dgc-gift-animation {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    animation: giftPop 0.5s ease-out;
}

/* Full-size gift video overlay (covers entire chat interface) */
.dgc-chat-container > .dgc-gift-video-overlay {
    position: absolute;
    inset: 0;
    z-index: 9998;
    display: block;
    overflow: hidden;
    pointer-events: auto;
    background: transparent;
}

.dgc-chat-container > .dgc-gift-video-overlay video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.dgc-chat-container > .dgc-gift-video-overlay .dgc-gift-video-close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 9999;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.35);
    background: rgba(0,0,0,0.35);
    color: #ffffff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.dgc-chat-container > .dgc-gift-video-overlay .dgc-gift-video-close:hover {
    background: rgba(0,0,0,0.55);
}

/* Full-size gift image overlay (covers entire chat interface) */
.dgc-chat-container > .dgc-gift-image-overlay {
    position: absolute;
    inset: 0;
    z-index: 9998;
    display: block;
    overflow: hidden;
    pointer-events: auto;
    background: transparent;
}

.dgc-chat-container > .dgc-gift-image-overlay img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.dgc-chat-container > .dgc-gift-image-overlay .dgc-gift-image-close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 9999;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.35);
    background: rgba(0,0,0,0.35);
    color: #ffffff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.dgc-chat-container > .dgc-gift-image-overlay .dgc-gift-image-close:hover {
    background: rgba(0,0,0,0.55);
}

@keyframes giftPop {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1);
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

.dgc-gift-animation video,
.dgc-gift-animation img {
    filter: drop-shadow(0 8px 20px rgba(255, 20, 147, 0.6));
    animation: giftFloat 2s ease-in-out infinite;
}

@keyframes giftFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Container fixes for overflow */
.dgc-modal-content {
    background: #000000;
    margin: 0 auto;
    padding: 20px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.2);
    width: 100%;
    max-width: min(500px, calc(100vw - 24px));
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    color: #ffffff;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

@media (max-width: 768px) {
    /* On phones, modals/popups should fit the screen width (no cutoffs or horizontal scrolling). */
    .dgc-modal-content {
        width: 100%;
        max-width: 100%;
        margin: 0;
        border-radius: 0;
        padding: 16px;
    }
}

/* Fix for checkout container */
.dgc-checkout-container {
    background: rgba(0,0,0,0.8);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 10px;
    padding: 15px;
    margin-top: 10px;
    max-height: 70vh;
    overflow-y: auto;
}

/* Gift grid - simplified layout sorted by price */
.dgc-gift-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    padding: 0;
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .dgc-gift-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

/* Gift items - minimal design */
.dgc-gift-item {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 12px;
    padding: 12px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.dgc-approval-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
    background: rgba(255, 193, 7, 0.18);
    border: 1px solid rgba(255, 193, 7, 0.45);
    color: rgba(255, 193, 7, 0.95);
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.2px;
    text-transform: uppercase;
    pointer-events: auto;
}

.dgc-media-approval-note {
    margin: 8px 0 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(255, 193, 7, 0.10);
    border: 1px solid rgba(255, 193, 7, 0.25);
    color: rgba(255,255,255,0.92);
    font-size: 12px;
    line-height: 1.35;
}

.dgc-gift-item:hover {
    transform: translateY(-3px);
    border-color: #ff1493;
    background: rgba(255,255,255,0.08);
    box-shadow: 0 6px 16px rgba(255, 20, 147, 0.3);
}

.dgc-gift-item img,
.dgc-gift-item video {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
}

.dgc-gift-item h4 {
    margin: 0;
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
}

.dgc-gift-item strong {
    color: #ff1493;
    font-size: 14px;
    font-weight: 700;
}

.dgc-send-gift-btn {
    background: linear-gradient(45deg, #ff1493, #8a2be2);
    color: #ffffff;
    border: none;
    padding: 8px 12px;
    border-radius: 16px;
    cursor: pointer;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    transition: all 0.3s;
    width: 100%;
}

.dgc-send-gift-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(255, 20, 147, 0.4);
}

/* Gift message input */
.dgc-gift-message-input {
    margin-top: 20px;
    padding: 20px;
    background: rgba(255,255,255,0.03);
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.1);
}

.dgc-gift-message-input label {
    display: block;
    margin-bottom: 8px;
    color: rgba(255,255,255,0.8);
    font-size: 13px;
    font-weight: 500;
}

.dgc-gift-message-input input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.05);
    color: white;
    font-size: 14px;
    outline: none;
    transition: all 0.3s;
}

.dgc-gift-message-input input:focus {
    border-color: #ff1493;
    background: rgba(255,255,255,0.1);
}

/* Selected gift indicator (appears above the input when a gift/media is selected) */
.dgc-gift-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.18);
    background: rgba(0,0,0,0.35);
    backdrop-filter: blur(6px);
}

.dgc-gift-indicator .dgc-gift-preview {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    object-fit: cover;
    display: block;
    flex: 0 0 auto;
}

.dgc-gift-indicator video.dgc-gift-preview {
    background: rgba(0,0,0,0.5);
}

.dgc-gift-indicator > span {
    flex: 1 1 auto;
    color: rgba(255,255,255,0.95);
    font-weight: 600;
    font-size: 13px;
    line-height: 1.2;
}

.dgc-gift-indicator .dgc-cancel-gift {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.22);
    background: rgba(255,255,255,0.08);
    color: #ffffff;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.dgc-gift-indicator .dgc-cancel-gift:hover {
    background: rgba(255,255,255,0.14);
}

/* Transaction history - full space usage */
.dgc-receipts-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 0;
}

/* Top-up modal transaction history */
#dgc-topup-transactions {
    margin-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 15px;
}

#dgc-topup-transactions .dgc-transaction-history-mini {
    background: transparent;
    border: none;
    padding: 0;
    margin-top: 0;
}

#dgc-topup-transactions .dgc-history-header h4 {
    font-size: 14px;
    color: rgba(255,255,255,0.8);
}

.dgc-coin-balance-shortcode {
    font-weight: bold;
    color: inherit;
}

/* =========================================
   Minimal UX: Toasts + Balance Animations
   ========================================= */

/* Bottom-anchored low-balance banner (overlays inside chat container) */
.dgc-chat-container .dgc-low-balance-banner {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10005;
    pointer-events: none;
    padding: 10px;
    box-sizing: border-box;
}

/* On mobile in dashboard mode, increase z-index to overlay bottom tabs and input */
@media (max-width: 1023px) {
    .dgc-chat-container[data-dashboard-mode="1"] .dgc-low-balance-banner {
        /* Center it so it never sits under/pushes the keyboard-attached composer. */
        position: absolute;
        left: 50% !important;
        right: auto !important;
        top: 50% !important;
        bottom: auto !important;
        transform: translate(-50%, -50%) !important;
        width: min(420px, calc(100% - 20px));
        max-width: calc(100% - 20px);
        z-index: 2147483647;
    }
}

.dgc-chat-container .dgc-low-balance-banner__inner {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 12px;
    border-radius: 16px;
    border: 1px solid rgba(255, 193, 7, 0.35);
    background: rgba(0,0,0,0.78);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}

.dgc-chat-container .dgc-low-balance-banner__msg {
    flex: 1 1 auto;
    font-size: 13px;
    line-height: 1.25;
    color: rgba(255,255,255,0.95);
}

.dgc-chat-container .dgc-low-balance-banner__btn {
    border: 1px solid rgba(255,255,255,0.22);
    background: rgba(255,255,255,0.10);
    color: #fff;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 12px;
    cursor: pointer;
}

.dgc-chat-container .dgc-low-balance-banner__btn:hover {
    background: rgba(255,255,255,0.14);
}

.dgc-chat-container .dgc-low-balance-banner__close {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.18);
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.9);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.dgc-chat-container .dgc-low-balance-banner__close:hover {
    background: rgba(255,255,255,0.10);
}

.dgc-toast-stack {
    position: fixed;
    top: calc(12px + env(safe-area-inset-top, 0px));
    right: calc(12px + env(safe-area-inset-right, 0px));
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: min(360px, calc(100vw - 24px));
    width: auto;
    box-sizing: border-box;
    pointer-events: none;
}

.dgc-toast {
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.18);
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(10px);
    color: rgba(255,255,255,0.95);
    box-shadow: 0 10px 30px rgba(0,0,0,0.35);
    transform: translateY(-4px);
    opacity: 0;
    animation: dgc-toast-in 180ms ease forwards;
}

.dgc-toast.is-hiding {
    animation: dgc-toast-out 180ms ease forwards;
}

.dgc-toast__msg {
    font-size: 13px;
    line-height: 1.25;
    flex: 1 1 auto;
}

.dgc-toast__btn {
    border: 1px solid rgba(255,255,255,0.22);
    background: rgba(255,255,255,0.10);
    color: #fff;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    cursor: pointer;
}

.dgc-toast__btn:hover {
    background: rgba(255,255,255,0.14);
}

.dgc-toast--warn {
    border-color: rgba(255, 193, 7, 0.35);
}

.dgc-toast--error {
    border-color: rgba(244, 67, 54, 0.35);
}

.dgc-toast--success {
    border-color: rgba(76, 175, 80, 0.35);
}

@keyframes dgc-toast-in {
    to { opacity: 1; transform: translateY(0); }
}

@keyframes dgc-toast-out {
    to { opacity: 0; transform: translateY(-4px); }
}

/* Balance animation hooks (applied to .dgc-balance-display wrapper) */
.dgc-balance-display.dgc-balance-bump {
    animation: dgc-balance-bump 520ms ease;
}

.dgc-balance-display.dgc-balance-drop {
    animation: dgc-balance-drop 520ms ease;
}

.dgc-balance-display.dgc-balance-low {
    box-shadow: 0 0 0 1px rgba(255, 193, 7, 0.25), 0 10px 30px rgba(0,0,0,0.25);
}

@keyframes dgc-balance-bump {
    0% { transform: translateY(0); }
    35% { transform: translateY(-2px); }
    100% { transform: translateY(0); }
}

@keyframes dgc-balance-drop {
    0% { transform: translateY(0); }
    35% { transform: translateY(1px); }
    100% { transform: translateY(0); }
}

.dgc-balance-float {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 6px;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.18);
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(10px);
    animation: dgc-balance-float 900ms ease forwards;
    pointer-events: none;
}

.dgc-balance-float--pos { color: rgba(160, 255, 200, 0.95); }
.dgc-balance-float--neg { color: rgba(255, 170, 170, 0.95); }

@keyframes dgc-balance-float {
    0% { opacity: 0; transform: translateY(4px); }
    20% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-6px); }
}
/* Image generation indicator */
@keyframes dgc-image-generating-pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

.dgc-message-bot[data-generating-image="1"]::after,
.dgc-generating-image::after {
    content: '🖼️ Generating image...';
    display: block;
    font-size: 0.85em;
    opacity: 0.75;
    margin-top: 6px;
    padding: 4px 8px;
    background: rgba(255, 165, 0, 0.15);
    border-left: 2px solid rgba(255, 165, 0, 0.5);
    border-radius: 4px;
    animation: dgc-image-generating-pulse 1.5s ease-in-out infinite;
}

.dgc-message-bot[data-generating-image="1"],
.dgc-generating-image {
    animation: dgc-image-generating-pulse 1.5s ease-in-out infinite;
}