/**
 * Webview/Iframe Embed Styles
 * Styles for secure sandboxed iframe embeds
 */

.webview-container {
    background: #2a2a2a;
    border-radius: 8px;
    overflow: hidden;
    margin: 10px 0;
    max-width: 100%;
    border: 1px solid #3a3a3a;
}

.webview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #1e1e1e;
    border-bottom: 1px solid #3a3a3a;
}

.webview-title {
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.webview-link {
    color: #4a9eff;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    margin-left: 12px;
}

.webview-link:hover {
    background: #3a3a3a;
    color: #6bb3ff;
}

.webview-link svg,
.webview-link i {
    width: 16px;
    height: 16px;
}

.webview-iframe-wrapper {
    position: relative;
    width: 100%;
    background: #1a1a1a;
    overflow: hidden;
}

.webview-click-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 10;
    background: transparent;
}

.webview-click-overlay:hover {
    background: rgba(74, 158, 255, 0.05);
}

.webview-iframe {
    display: block;
    width: 100%;
    border: none;
    background: #ffffff;
}

.webview-security-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #1e1e1e;
    border-top: 1px solid #3a3a3a;
    color: #888888;
    font-size: 12px;
}

.webview-security-info svg,
.webview-security-info i {
    width: 14px;
    height: 14px;
    color: #4caf50;
}

.webview-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: #2a1e1e;
    color: #ff6b6b;
    text-align: center;
    min-height: 200px;
}

.webview-error svg,
.webview-error i {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    opacity: 0.7;
}

.webview-error p {
    margin: 0;
    font-size: 14px;
}

/* Loading state */
.webview-iframe-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #2a2a2a;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.webview-iframe-wrapper.loading::before {
    opacity: 1;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .webview-header {
        padding: 10px 12px;
    }

    .webview-title {
        font-size: 13px;
    }

    .webview-link {
        padding: 4px 6px;
    }

    .webview-security-info {
        padding: 6px 12px;
        font-size: 11px;
    }

    .webview-iframe-wrapper {
        min-height: 250px;
    }
}

/* Very small screens */
@media (max-width: 480px) {
    .webview-title {
        font-size: 12px;
    }

    .webview-header {
        padding: 8px 10px;
    }

    .webview-security-info {
        flex-direction: column;
        gap: 4px;
        text-align: center;
    }
}

/* Dark mode support (if needed) */
@media (prefers-color-scheme: dark) {
    .webview-container {
        background: #1a1a1a;
        border-color: #2a2a2a;
    }

    .webview-header {
        background: #0a0a0a;
        border-bottom-color: #2a2a2a;
    }

    .webview-link:hover {
        background: #2a2a2a;
    }

    .webview-iframe-wrapper {
        background: #0a0a0a;
    }

    .webview-security-info {
        background: #0a0a0a;
        border-top-color: #2a2a2a;
    }

    .webview-error {
        background: #1a0a0a;
    }
}

/* Fullscreen support for iframes */
.webview-iframe:-webkit-full-screen {
    width: 100%;
    height: 100%;
}

.webview-iframe:-moz-full-screen {
    width: 100%;
    height: 100%;
}

.webview-iframe:-ms-fullscreen {
    width: 100%;
    height: 100%;
}

.webview-iframe:fullscreen {
    width: 100%;
    height: 100%;
}

/* Security badge styling */
.webview-security-info::after {
    content: '🔒';
    margin-left: auto;
    font-size: 12px;
    opacity: 0.5;
}

/* Lightbox fullscreen styles */
#webview-lightbox-container {
    width: 95vw;
    height: 95vh;
    display: flex;
    flex-direction: column;
}

.lightbox-webview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #1e1e1e;
    border-bottom: 1px solid #3a3a3a;
    flex-shrink: 0;
}

.lightbox-webview-title {
    color: #ffffff;
    font-size: 16px;
    font-weight: 500;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lightbox-webview-link {
    color: #4a9eff;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 4px;
    transition: all 0.2s ease;
    margin-left: 12px;
}

.lightbox-webview-link:hover {
    background: #3a3a3a;
    color: #6bb3ff;
}

.lightbox-webview-link i {
    font-size: 18px;
    color: inherit;
}

.lightbox-webview-iframe-wrapper {
    flex: 1;
    width: 100%;
    background: #1a1a1a;
    overflow: hidden;
}

.lightbox-webview-iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: none;
    background: #ffffff;
}
