/* Copyright (c) 2026 William Chesher | MIT License */
/* embed.css - Grafana panel embed styles */

/* Container grid for embedded panels */
.embed-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 1rem;
}

.embed-grid.cols-1 { grid-template-columns: 1fr; }
.embed-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.embed-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }

/* Full-width span for wide panels */
.panel-embed.span-full { grid-column: 1 / -1; }
.panel-embed.span-2 { grid-column: span 2; }

/* Individual panel embed */
.panel-embed {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s;
}

.panel-embed:hover {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

/* Hover overlay action (open full dashboard) */
.panel-embed-overlay-action {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.85);
    color: #999;
    text-decoration: none;
    font-size: 0.7rem;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s, color 0.15s;
    z-index: 2;
    pointer-events: none;
}

.panel-embed:hover .panel-embed-overlay-action {
    opacity: 1;
    pointer-events: auto;
}

.panel-embed-overlay-action:hover {
    background: #eee;
    color: #555;
}

/* Panel body (iframe container) */
.panel-embed-body {
    position: relative;
    overflow: hidden;
    background: #f8f8f8;
}

.panel-embed-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    visibility: hidden;
}

.panel-embed-body.loaded .panel-embed-iframe {
    visibility: visible;
}

/* Loading state */
.panel-embed-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #aaa;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.panel-embed-body.loaded .panel-embed-loading {
    display: none;
}

.panel-embed-error {
    color: #c62828;
    font-size: 0.8rem;
}

/* Section wrapper on pages like index.html */
.embed-section {
    margin-top: 1.5rem;
}

.embed-section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
}

.embed-section-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.embed-section-header h2 svg {
    width: 1.2em;
    height: 1.2em;
    color: var(--accent, #7c6fae);
}

/* Responsive */
@media (max-width: 900px) {
    .embed-grid {
        grid-template-columns: 1fr;
    }
    .panel-embed.span-full,
    .panel-embed.span-2 {
        grid-column: 1;
    }
}

/* ---- Dark theme ---- */
html.dark-theme .panel-embed {
    background: rgba(15, 15, 35, 0.85);
    border-color: rgba(124, 255, 220, 0.12);
}

html.dark-theme .panel-embed:hover {
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.3);
}

html.dark-theme .panel-embed-overlay-action {
    background: rgba(20, 20, 45, 0.85);
    color: #666;
}

html.dark-theme .panel-embed-overlay-action:hover {
    background: rgba(124, 255, 220, 0.08);
    color: #aaa;
}

html.dark-theme .panel-embed-body {
    background: #0d0d1a;
}

html.dark-theme .panel-embed-loading {
    color: #555;
}

html.dark-theme .embed-section-header {
    border-bottom-color: rgba(124, 255, 220, 0.1);
}

html.dark-theme .embed-section-header h2 {
    color: #ccc;
}
