/* Custom styles for JSON formatting */
.json-key {
    color: #881391;
    font-weight: bold;
}

.json-string {
    color: #1A1AA6;
}

.json-number {
    color: #1C00CF;
}

.json-boolean {
    color: #0000FF;
}

.json-null {
    color: #808080;
}

.json-mark {
    color: #000000;
}

/* JSON property and array item styles */
.json-property, .json-array-item {
    display: block;
    padding: 2px 0;
    position: relative;
    line-height: 1.5;
    border-left: none;
}

.json-property:hover, .json-array-item:hover {
    background-color: rgba(243, 244, 246, 0.5);
    border-radius: 2px;
}

/* Hover styles for JSON elements */
.json-value, .json-key {
    cursor: pointer;
    position: relative;
    padding: 1px 3px;
    border-radius: 2px;
    transition: background-color 0.2s;
}

.json-value:hover, .json-key:hover {
    background-color: rgba(79, 70, 229, 0.1);
}

/* Highlighted element */
.highlighted {
    background-color: transparent;
    box-shadow: none;
    border: none;
    padding: 1px 3px;
    position: relative;
    z-index: 2;
    outline: none;
    transition: all 0.2s ease;
}

.highlighted::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: rgba(139, 157, 195, 0.9);
    animation: underlinePulse 2s infinite;
}

@keyframes underlinePulse {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
    100% {
        opacity: 1;
    }
}

/* Flash highlight animation */
.flash-highlight::after {
    animation: flash-underline 1s ease-out;
}

@keyframes flash-underline {
    0% {
        background: rgba(139, 157, 195, 1);
        height: 3px;
    }
    100% {
        background: rgba(139, 157, 195, 0.9);
        height: 2px;
    }
}

/* Ensure all JSON types can be highlighted */
.json-string.highlighted,
.json-number.highlighted,
.json-boolean.highlighted,
.json-null.highlighted,
.json-object.highlighted,
.json-array.highlighted,
.json-key.highlighted {
    background-color: transparent;
    box-shadow: none;
}

/* Placeholder for lazy-loaded content */
.json-placeholder {
    color: #6B7280;
    font-style: italic;
    padding: 2px 5px;
    background-color: rgba(243, 244, 246, 0.5);
    border-radius: 4px;
}

/* Collapsible sections */
.collapsible {
    cursor: pointer;
    user-select: none;
    position: relative;
    display: inline-block;
    color: #333;
    font-weight: bold;
}

.collapsible::before {
    content: '▼';
    display: inline-block;
    margin-right: 5px;
    transition: transform 0.2s;
    font-size: 0.7em;
    color: #4F46E5;
}

.collapsed::before {
    transform: rotate(-90deg);
}

.collapsible-container {
    display: block;
    position: relative;
}

.collapsible-content {
    margin-left: 20px;
    transition: height 0.2s ease;
}

.json-content {
    margin-left: 20px;
    padding-left: 10px;
    border-left: 1px dotted #ccc;
    transition: height 0.3s ease-out;
}

.hidden {
    display: none !important;
}

.hidden-content {
    display: none;
}

/* Path tooltip styling */
#pathTooltip {
    pointer-events: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    z-index: 1000;
}

/* JSON container */
.json-container {
    line-height: 1.5;
}

/* Performance optimizations */
.json-container * {
    contain: content;
}

/* Loading spinner */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* JSONPath Display Styles */
#jsonPath {
    cursor: pointer;
    transition: color 0.2s;
    position: relative;
}

#jsonPath:hover {
    color: #4f46e5;
}

#jsonPath:after {
    content: '↓';
    font-size: 10px;
    margin-left: 5px;
    opacity: 0;
    transition: opacity 0.2s;
}

#jsonPath:hover:after {
    opacity: 1;
}

/* JSONPath Evaluation Styles - removed, using main .highlighted styles instead */

#jsonPathResultsList li {
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

#jsonPathResultsList li:hover {
    background-color: rgba(79, 70, 229, 0.1);
}

/* Results list highlighting */
.result-item {
    padding: 6px 10px;
    margin: 4px 0;
    border-radius: 4px;
    background-color: #f3f4f6;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.result-item:hover {
    background-color: #e5e7eb;
    border-left: 3px solid #4f46e5;
}

.result-item.active {
    background-color: rgba(79, 70, 229, 0.1);
    border-left: 3px solid #4f46e5;
    font-weight: bold;
}

.result-path {
    font-family: monospace;
    font-size: 0.9em;
    color: #4f46e5;
    margin-bottom: 4px;
}

.result-value {
    font-family: monospace;
    font-size: 0.85em;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.result-type {
    font-size: 0.75em;
    color: #6b7280;
    background-color: #f3f4f6;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 6px;
}

/* JSON toggle and structure styles */
.json-toggle {
    cursor: pointer;
    user-select: none;
    font-size: 0.7em;
    margin-right: 4px;
    color: #4F46E5;
    display: inline-block;
    width: 12px;
    text-align: center;
}

.json-bracket {
    color: #333;
    font-weight: bold;
}

.json-comma {
    color: #333;
}

.json-colon {
    color: #333;
}

.json-items, .json-properties {
    margin-left: 20px;
    padding-left: 10px;
    border-left: 1px dotted #ccc;
    transition: height 0.3s ease-out;
}

.json-item, .json-property {
    margin: 2px 0;
    position: relative;
}

.collapsed {
    display: none;
}

.json-object, .json-array {
    position: relative;
}

.json-lazy-load {
    margin: 5px 0;
    color: #6B7280;
    font-style: italic;
    cursor: pointer;
    padding: 2px 5px;
    background-color: rgba(243, 244, 246, 0.5);
    border-radius: 4px;
}

.json-lazy-text {
    color: #4F46E5;
}

.json-lazy-text.clickable {
    text-decoration: underline;
    cursor: pointer;
}

.json-lazy-text.clickable:hover {
    color: #4338CA;
    font-weight: 600;
}

.json-lazy-load:hover {
    background-color: rgba(243, 244, 246, 0.8);
}

/* Path segment highlighting */
.path-segment {
    background-color: rgba(79, 70, 229, 0.1);
    position: relative;
}

/* SVG path styling */
#json-path-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    overflow: visible;
}

#json-path-svg path {
    fill: none;
    stroke: rgba(79, 70, 229, 0.8);
    stroke-width: 3px;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
    animation: path-appear 0.3s ease-out;
}

@keyframes path-appear {
    from {
        stroke-dasharray: 1000;
        stroke-dashoffset: 1000;
    }
    to {
        stroke-dasharray: 1000;
        stroke-dashoffset: 0;
    }
}

/* Ensure the JSON output container properly handles the SVG */
.json-output {
    position: relative;
    overflow: auto;
}

/* Remove border styling */
.json-property, .json-array-item {
    border-left: none;
    margin-left: 0;
    padding-left: 0;
}

.path-segment.json-property, 
.path-segment.json-array-item,
.path-segment .json-property,
.path-segment .json-array-item {
    border-left: none;
}

/* Remove the complex path line approach */
#json-path-lines-container {
    display: none;
}

.json-path-line {
    display: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .collapsible-content {
        margin-left: 10px;
    }
    
    #jsonOutput, #jsonInput {
        font-size: 0.8rem;
    }
}
