.fullscreen-embed {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    overflow: clip;
    /* Add this to ensure border-radius works properly */
    border: none;
    transition: height 0.3s cubic-bezier(0.2, 1.3, 0.64, 1), transform 0.3s ease, opacity 0.3s ease, border-radius 0.3s ease, filter 0.3s ease;
    filter: none;
}

.fullscreen-embed iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.fullscreen-embed.legacy {
    background-color: var(--background-color-tr);
}

.fullscreen-embed.legacy iframe {
    border-radius: 15px;
    corner-shape: superellipse(1.5);
    height: calc(100% - 105px);
    margin-top: 80px;
}

.legacy-app-header {
    position: absolute;
    top: 0;
    left: 28px;
    height: 80px;
    display: none;
    /* Hidden by default */
    align-items: center;
    gap: 18px;
    z-index: 1;
    max-width: calc(100% - 140px);
    overflow: hidden;
}

.fullscreen-embed.legacy .legacy-app-header {
    display: flex;
    /* Shown only on legacy embeds */
}

.legacy-app-header img {
    width: 32px;
    height: 32px;
    border-radius: 35%;
    corner-shape: superellipse(1.25);
    object-fit: cover;
}

.legacy-app-header span {
    font-weight: 500;
    color: var(--text-color);
}

.legacy-nav-controls {
    display: flex;
    gap: 8px;
    border-right: 2px solid var(--background-color-tr-op);
    padding-right: 18px;
}

.legacy-nav-controls .btn-qc {
    background-color: transparent;
    box-shadow: none;
    border: none;
    backdrop-filter: none;
}

/* Visual state when picking the second app */
.fullscreen-embed.split-selecting {
    transform: scale(0.95) !important;
    filter: opacity(0.6) blur(2.5px);
    border-radius: 35px !important;
    corner-shape: superellipse(1.5) !important;
    pointer-events: none !important;
    transition: transform 0.3s ease, filter 0.3s ease;
}

/* --- Split Screen Styles --- */

/* Classes applied to fullscreen-embed when split */
.fullscreen-embed.split-left {
    width: 50% !important;
    left: 0 !important;
    right: auto !important;
    border-right: 1px solid var(--glass-border);
    transition: width 0.1s linear, transform 0.3s ease, opacity 0.3s ease !important;
}

.fullscreen-embed.split-right {
    width: 50% !important;
    left: auto !important;
    right: 0 !important;
    border-left: 1px solid var(--glass-border);
    transition: width 0.1s linear, transform 0.3s ease, opacity 0.3s ease !important;
}

/* Ensure inner iframes respect the split size */
.fullscreen-embed.split-left iframe,
.fullscreen-embed.split-right iframe {
    width: 100%;
    padding: 0;
}

.fullscreen-embed.split-left.legacy iframe,
.fullscreen-embed.split-right.legacy iframe {
    width: calc(100% - 20px);
    padding: 0 10px;
}

.fullscreen-embed.is-resizing {
    pointer-events: none !important;
    /* Prevent iframe interaction during resize */
}

.fullscreen-embed.is-resizing iframe {
    pointer-events: none !important;
}

/* The draggable divider */
#split-divider {
    position: fixed;
    top: 0;
    left: 50%;
    /* Default center */
    width: 24px;
    /* Touch target size */
    height: 100%;
    transform: translateX(-50%);
    cursor: col-resize;
    z-index: 99999;
    /* Above apps */
    display: none;
    justify-content: center;
    align-items: center;
    touch-action: none;
}

#split-divider.is-resizing {
    transition: none !important;
    /* Follow finger instantly */
    background-color: var(--background-color);
}

.split-handle-bar {
    width: 4px;
    height: 40px;
    background-color: var(--search-background-op);
    border-radius: 8px;
    transition: height 0.2s, opacity 0.2s;
}

#split-divider:active .split-handle-bar,
#split-divider:hover .split-handle-bar {
    width: 8px;
    height: 60px;
    background-color: var(--accent);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}