/**
 * Rootspersona SVG Frontend Styles
 */

.rootspersona-svg-container {
    position: relative;
    width: 100%;
    min-height: 400px;
    overflow: hidden;
    border: 1px solid #ddd;
    background: #fff;
    margin: 20px 0;
}

.rootspersona-svg-container svg.rootspersona-svg-tree {
    display: block;
    width: 100%;
    height: auto;
    cursor: grab;
}

.rootspersona-svg-container svg.rootspersona-svg-tree:active {
    cursor: grabbing;
}

/* Controls */
.rp-svg-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: rgba(255, 255, 255, 0.9);
    padding: 5px;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.rp-svg-controls button {
    width: 32px;
    height: 32px;
    border: 1px solid #ccc;
    background: #fff;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    border-radius: 3px;
    transition: all 0.2s;
}

.rp-svg-controls button:hover {
    background: #f0f0f0;
    border-color: #999;
}

.rp-svg-controls button:active {
    background: #e0e0e0;
}

/* Clickable nodes */
.rp-tree-node {
    transition: opacity 0.2s;
}

.rp-tree-node:hover {
    opacity: 0.9;
}

.rp-tree-node[data-permalink] {
    cursor: pointer;
}

/* Line highlighting */
.rp-tree-line.rp-line-highlight {
    stroke-width: 2 !important;
    stroke: #ff6600 !important;
    opacity: 0.8;
}

/* Loading state */
.rp-svg-loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.rp-svg-loading:before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}

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

/* Error messages */
.rootspersona-svg-error {
    color: #d63638;
    padding: 20px;
    text-align: center;
    background: #fff;
    border: 1px solid #d63638;
    border-radius: 4px;
    margin: 20px 0;
}

/* Responsive */
@media (max-width: 768px) {
    .rp-svg-controls {
        position: relative;
        top: auto;
        right: auto;
        flex-direction: row;
        justify-content: center;
        margin-bottom: 10px;
    }

    .rootspersona-svg-container {
        min-height: 300px;
    }
}
