/* Diagram Block Styles (Rise Theme) */

.block-diagram {
    margin: 0;
}

/* Content column - matches Rise pattern (76rem centered) */
.block-diagram__col {
    width: 76rem;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

/* SVG diagram rendering */
.block-diagram__svg {
    background: var(--rise-color-card, #fff);
    padding: 2.4rem;
    border-radius: 0.8rem;
    border: 1px solid var(--arc-color-border-standard, rgba(0,0,0,0.1));
    overflow: hidden;
    text-align: center;
    position: relative;
    max-height: 80rem;
    min-height: 20rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: filter 0.3s;
}

.block-diagram__svg:hover {
    filter: brightness(0.9);
}

.block-diagram__svg svg,
.block-diagram__svg img {
    max-width: 100%;
    max-height: 80rem;
    width: auto !important;
    height: auto !important;
    display: block;
}

/* Hover overlay */
.block-diagram__svg::after {
    content: '🔍 Cliquez pour zoomer';
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.block-diagram__svg:hover::after {
    opacity: 1;
}

/* Diagram Modal (Lightbox) */
.diagram-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.diagram-modal__backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
}

.diagram-modal__content {
    position: relative;
    width: min(95vw, 95vh);
    height: min(95vw, 95vh);
    background: white;
    border-radius: 12px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.diagram-modal__container {
    flex: 1;
    overflow: hidden;
    position: relative;
    background: #fafafa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.diagram-modal__container svg,
.diagram-modal__container img {
    max-width: 100%;
    max-height: 100%;
    width: auto !important;
    height: auto !important;
    user-select: none;
}

.diagram-modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background 0.2s;
}

.diagram-modal__close:hover {
    background: rgba(0, 0, 0, 0.8);
}

.diagram-modal__close svg {
    width: 20px;
    height: 20px;
}

.diagram-modal__controls {
    position: absolute;
    bottom: 24px;
    right: 24px;
    display: flex;
    gap: 8px;
    z-index: 10;
}

.diagram-modal__controls button {
    width: 44px;
    height: 44px;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border-radius: 8px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.diagram-modal__controls button:hover {
    background: rgba(0, 0, 0, 0.8);
}

/* Fallback display (when Kroki unavailable) */
.block-diagram__fallback {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

.block-diagram__fallback-note {
    background: #fff3cd;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    color: #856404;
    border-bottom: 2px solid #ffc107;
}

.block-diagram__code {
    margin: 0;
    padding: 20px;
    background: #f8f9fa;
    overflow-x: auto;
    font-family: 'Courier New', 'Courier', monospace;
    font-size: 13px;
    line-height: 1.6;
}

.block-diagram__code code {
    color: #1a1a1a;
}

/* Responsive */
@media (max-width: 768px) {
    .block-diagram__svg {
        padding: 16px;
    }

    .block-diagram__code {
        font-size: 12px;
        padding: 16px;
    }
}
