/* WP Process Diagram Frontend Styles */

/* Container */
.wpd-diagram-container {
    position: relative;
    margin: 20px 0;
    background: #f9f9f9;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Block alignment support */
.wp-block-wpd-process-diagram {
    margin: 20px 0;
}

.wp-block-wpd-process-diagram.alignwide {
    margin: 20px auto;
    max-width: var(--wp--style--global--wide-size, 1200px);
}

.wp-block-wpd-process-diagram.alignfull {
    margin: 20px 0;
    width: 100vw;
    max-width: none;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
}

.wp-block-wpd-process-diagram.alignfull .wpd-diagram-container {
    border-radius: 0;
    max-width: none;
    padding: 40px 20px;
}

.wpd-diagram-wrapper {
    position: relative;
    width: 100%;
    overflow: auto;
}

/* Controls */
.wpd-diagram-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
}

.wpd-fullscreen-btn {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.wpd-fullscreen-btn:hover {
    background: #f0f0f0;
    border-color: #999;
}

.wpd-fullscreen-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* SVG Container */
.wpd-diagram-svg {
    width: 100%;
    min-height: 400px;
}

.wpd-diagram-svg svg {
    display: block;
    margin: 0 auto;
}

/* Hexagon styles */
.wpd-hexagon {
    transition: all 0.3s ease;
}

.wpd-hexagon:hover {
    opacity: 0.9;
}

.wpd-hexagon-inner {
    transition: all 0.3s ease;
}

/* Meander line */
.wpd-meander {
    shape-rendering: geometricPrecision;
}

/* Step text */
.wpd-step-title {
    fill: #333;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.wpd-step-content {
    fill: #666;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Icons */
.wpd-icon {
    font-family: dashicons;
    pointer-events: none;
}

/* Images in shapes */
.wpd-diagram-svg image {
    image-rendering: auto;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    object-fit: cover;
}

/* Tooltip */
.wpd-tooltip {
    position: absolute;
    text-align: left;
    padding: 12px;
    font-size: 14px;
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    border-radius: 4px;
    pointer-events: none;
    max-width: 400px;
    z-index: 1000;
    line-height: 1.5;
}

.wpd-tooltip > strong {
    display: block;
    margin-bottom: 5px;
    font-size: 16px;
    font-weight: bold;
}

.wpd-tooltip strong {
    display: inline;
    font-weight: bold;
}

.wpd-tooltip p {
    margin: 0.5em 0;
    color: #fff;
}

.wpd-tooltip p:first-child {
    margin-top: 0;
}

.wpd-tooltip p:last-child {
    margin-bottom: 0;
}

/* Flowing connectors */
.wpd-connector {
    pointer-events: none;
}

.wpd-connector path {
    transition: all 0.3s ease;
}

.wpd-connector circle {
    transition: all 0.3s ease;
}

/* Baseline-through style */
.wpd-baseline line {
    shape-rendering: geometricPrecision;
}
.wpd-leaders line {
    shape-rendering: geometricPrecision;
}

/* Fullscreen mode */
.wpd-diagram-container.wpd-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    border-radius: 0;
    z-index: 9999;
    background: #fff;
}

.wpd-fullscreen .wpd-diagram-wrapper {
    height: calc(100% - 60px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.wpd-fullscreen .wpd-diagram-svg {
    height: 100%;
}

/* Fallback styles (no JavaScript) */
.wpd-diagram-fallback {
    display: flex;
    gap: 20px;
    padding: 20px;
    overflow-x: auto;
}

.wpd-diagram-fallback.wpd-orientation-vertical {
    flex-direction: column;
}

.wpd-step-fallback {
    flex: 0 0 auto;
    min-width: 200px;
    padding: 20px;
    border-radius: 8px;
    color: #fff;
    text-align: center;
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.wpd-step-fallback .wpd-step-number {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 30px;
    height: 30px;
    background: #fff;
    color: #333;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border: 2px solid currentColor;
}

.wpd-step-fallback h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
}

.wpd-step-fallback p {
    margin: 0;
    font-size: 14px;
    opacity: 0.95;
}

/* Animation */
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.wpd-step-group:hover .wpd-hexagon {
    animation: pulse 0.5s ease-in-out;
}

/* Responsive */
@media screen and (max-width: 768px) {
    .wpd-diagram-container {
        padding: 10px;
    }
    
    .wpd-diagram-fallback {
        flex-direction: column;
    }
    
    .wpd-step-fallback {
        min-width: 100%;
    }
    
    .wpd-fullscreen-btn .wpd-btn-text {
        display: none;
    }
}

/* Print styles */
@media print {
    .wpd-diagram-controls {
        display: none;
    }
    
    .wpd-diagram-container {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* Loading state */
.wpd-diagram-loading {
    position: relative;
    min-height: 400px;
}

.wpd-diagram-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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