.argument-connections button {
    pointer-events: auto;
    position: absolute;

    /* Ensure buttons appear above connections */
    z-index: 1;
}

.argument-connections {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: visible;
}

.argument-container {
    position: relative;
    width: 100%;
    overflow: auto;
}

.argument-node .content {
    padding: 10px;
}

.argument-node {
    width: 440px;
    border-radius: 8px;
    margin: 0;  /* Remove margin to avoid unexpected sizing */
    position: relative;
    box-shadow: 0 4px 12px var(--neutral-dark);
    height: 340px; /* Set fixed height */
    background-color: white;
    overflow: hidden; /* Prevent content from expanding the node */
}

.selectable-container{
    min-height: inherit;
    min-width: 85%;
}

.unselected {
    outline: none;
}

.argument-node.expanded {
    width: 640px;
    height: auto;
}

.argument-node-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Base styles for all short arguments */
.short-argument {
    margin-bottom: 8px;
    font-family: "Lexend Deca", sans-serif;
    line-height: 1.5;
    display: block;
    white-space: normal;
}

.display {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden auto; /* Enable vertical scrolling */
    padding: 0; /* Remove padding that might interfere with scrolling */
    scrollbar-width: thin;
    scrollbar-color: #ccc #f5f5f5;
}

.quote-wrapper {
    font-style: italic;
    color: var(--standard-text);
    position: relative;
    background: linear-gradient(to right, rgb(86 100 245 / 5%), transparent);
    border-left: 3px solid var(--primary-dark);
    margin: 10px 0;
    padding: 0.8em 1.2em;
}

.quote-wrapper::before {
    content: '"';
    font-family: Georgia, serif;
    font-size: 1.2em;
    font-weight: bold;
    position: absolute;
    left: 0.5em;
    top: 0.5em;
    color: var(--standard-text);
}

.quote-wrapper::after {
    content: '"';
    font-family: Georgia, serif;
    font-size: 1.2em;
    font-weight: bold;
    position: absolute;
    right: 0.5em;
    bottom: 0;
    color: var(--standard-text);
}

/* Styling for empty root node instruction text */
.empty-root-node-instruction {
    font-style: italic;
    color: #888;
    padding: 10px;
    border-left: 3px solid #ccc;
    background-color: #f9f9f9;
    border-radius: 4px;
    margin: 10px 0;
}

.citation-block {
    font-family: "Lexend Deca", sans-serif;
    font-size: 0.875em;
    line-height: 1.4;
    color: #202122;
    display: flex;
    align-items: center;
    gap: 0.5em;
    position: sticky;
    bottom: 0;
    background-color: var(--bg-light);
    border-top: 1px solid var(--bg-light);
    margin-bottom: 12px;
    padding: 8px 10px;
    margin-top: auto; /* Push to bottom */
    z-index: 2; /* Ensure it appears above scrolling content */
}

.citation-link,
.citation-link:visited {
    color: var(--standard-link-text);
    text-decoration: none;
}

.citation-link:hover {
    text-decoration: underline;
}

.citation-authors a,
.citation-authors a:visited {
    color: var(--standard-link-text);
    text-decoration: none;
}

.citation-authors a:hover {
    text-decoration: underline;
}

.citation-text {
    color: var(--standard-secondary-text);
}

.citation-date {
    color: var(--standard-secondary-text);
}

/* Search box styles */
.search-container {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    width: 300px;
    padding-bottom: 16px;
}

.search-fields {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 8px;
}

.argument-select {
    margin-left: 8px;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: var(--bg-light);
    min-width: 150px;
}

/* Connection path styles */
.node-connection-fg {
    fill: none;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke-width 0.2s ease;
}

.node-connection-fg.support {
    stroke: var(--support-color);
}

.node-connection-fg.rebuttal {
    stroke: var(--attack-color);
}

.node-connection-fg.cited-argument {
    stroke: var(--cited-color);
}

.support.arrow-color {
    fill: var(--support-color);
    stroke: var(--support-color);
}

.rebuttal.arrow-color {
    fill: var(--attack-color);
    stroke: var(--attack-color);
}

.arrow-color.cited-argument {
    fill: var(--cited-color);
    stroke: var(--cited-color);
}

/* Hover effect for connections */
.node-connection-fg:hover {
    stroke-width: 8;
}

.node-connection-bg {
    fill: none;
    stroke: var(--bg-very-light);
    stroke-width: 14;
    stroke-linecap: square;
    stroke-linejoin: miter;
}

/* Debug styling for development */
.debug-overlay {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--debug-overlay-bg);
    padding: 10px;
    border-radius: 4px;
    font-family: monospace;
    z-index: 1000;
}

/* Nodes layer and connections layer */
.nodes-layer {
    z-index: 2;
}

.connections-layer {
    z-index: 1;
}

.pin-all-arguments-button,
.unpin-all-arguments-button {
    width: 100%;
    height: 32px;
    border-radius: 4px;
    background-color: var(--neutral-dark);
    color: var(--bg-light);
    border: 1px solid var(--neutral-dark);
    box-shadow: 0 1px 2px var(--neutral);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

/* Main content area - takes remaining space */
.main-content-area {
    flex: 1; /* Takes all remaining space */
    display: flex;
    flex-direction: column;
    min-width: 0; /* Allow shrinking if needed */
    height: 100vh;
    position: relative;
}

/* Ensure the SVG container takes the full available space and allows scrolling */
.svg-framework-container {
    flex: 1; /* Takes remaining space */
    min-height: 0; /* Allow shrinking */
    width: 100%;
    height: 100%;
    overflow: auto !important; /* Force scrolling regardless of other styles */
    position: relative;
    background-color: var(--bg-very-light);
}

/* When edit panel is present, add margin to the svg-framework-container */
.edit-side-panel ~ .svg-framework-container {
    margin-left: 250px; /* Same as the width of edit-side-panel */
    width: 100%;
    transition: margin-left 0.3s ease, width 0.3s ease; /* Smooth transition */
}

/* SVG element should take full space but allow scrolling beyond its bounds */
.svg-framework {
    width: 100%;
    height: 100%;
    min-width: 3000px; /* Ensure there's enough horizontal space */
    min-height: 2000px; /* Ensure there's enough vertical space */
    transform-origin: top left;
    transition: transform 0.2s ease; /* Smooth transition for zooming */
}

/* Ensure the argument-framework-pane allows scrolling */
.argument-framework-pane {
    display: flex;
    width: 100vw;
    position: relative;
    overflow: auto !important; /* Force scrolling */
    isolation: isolate;
    height: calc(100vh - 85px); /* Account for the exact navigation bar height */
    margin-top: 90px; /* Add margin equal to the navigation bar height */
    padding-top: 20px; /* Reduced from 70px since we're using margin-top instead */
}

/* When edit panel is present, add padding to the left */
.argument-framework-pane:has(.edit-side-panel) {
    padding-left: 300px;
}

/* Improve the content wrapper to better handle overflow */
.argument-content-wrapper {
    position: relative;
    width: max-content;  /* Allow content to determine width */
    min-width: 100%;
    padding: 20px;  /* Add some padding */
}

/* Add a responsive container wrapper for better layout */
.svg-responsive-container {
    width: 100%;
    height: 100%;
    overflow: auto;
    position: relative;
}

/* Ensure foreignObjects are properly sized */
foreignObject {
    overflow: visible;
}

/* Ensure argument nodes don't have their own margins within foreignObject */
foreignObject .argument-node {
    margin: 0;
    box-sizing: border-box;
    width: 100%;
    height: auto;
}

.svg-framework-container::after {
    content: "";
    display: block;
    height: 100px;
    width: 100%;
}

.theme-label, .theme-tag {
    font-family: "Lexend Deca", sans-serif;
    font-size: 14px;  /* Slightly smaller to fit better */
    font-weight: 600;
    color: var(--standard-text);
    text-align: center;
    line-height: 1.2;
    margin-bottom: 4px;
    max-width: 140px; /* Limit width to prevent overflow */
    word-wrap: break-word; /* Enable word wrapping */
    white-space: normal; /* Allow text to wrap */
    overflow-wrap: break-word; /* Additional support for wrapping */
    display: block; /* Make it a block element */
}

/* Update the argument node to properly center the circle */
.argument-node.circle {
    padding-bottom: 170px;
    width: 90px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    box-shadow: none;
    overflow: visible;
}

/* When in circle mode, hide any text content */
.argument-node.circle .display,
.argument-node.circle .content {
    display: none;
}

/* Ensure the parent container has the right dimensions */
foreignObject .argument-node.circle {
    width: 100%;
    height: 100%;
}

.pin-indicator {
    /* Size and position */
    width: auto;
    height: 24px;
    top: 8px;
    left: 8px;

    /* Styling */
    background-color: var(--primary);
    color: white;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);

    /* Text styling */
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
    font-family: "Lexend Deca", sans-serif;

    /* Content layout */
    padding: 0 8px;
    display: flex;
    align-items: center;
    justify-content: center;

    /* Interactivity */
    cursor: pointer;
    transition: all 0.2s ease;
}


.pin-indicator.pinned {
    background-color: var(--critical-medium);
}

.argument-wrapper {
    box-shadow: 0 4px 12px var(--neutral);;
    background: var(--bg-light);
    width: 440px;
    height: 340px; /* Set a fixed height */
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Important to prevent content from expanding the container */
}

.argument-wrapper.edit-mode {
    display: flex;
    flex-direction: row-reverse; /* Reverse the order to put buttons on the right */
    position: relative;

}

.argument-wrapper.read-mode {
    display: flex;
    flex-direction: column;
}

.argument-instructions {
    font-family: "Lexend Deca", sans-serif;
    font-size: 12px;
    font-style: italic;
    color: var(--standard-text);
    font-weight: 400;
    letter-spacing: 0.3px;
    padding: 4px 0;
    cursor: pointer;
}

.pin-instructions{
    font-family: "Lexend Deca", sans-serif;
    font-size: 12px;
    font-style: italic;
    color: var(--standard-text);
    font-weight: 400;
    letter-spacing: 0.3px;
    padding: 4px 0;
    cursor: pointer;
}

.pin-instructions-container,
.argument-instructions-container {
    display: flex;
    padding: 8px 12px 0;
    width: 100%;
}

.pin-instructions-container{
    z-index: 1000;
}

.grid-point {
    fill: none;
    stroke-width: 1;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke: var(--neutral-dark);
}

.grid-point-warning {
    fill: none;
    stroke-width: 1;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke: var(--critical-dark)
}

.grid-point-bypass {
    fill: none;
    stroke-width: 1;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke: var(--affirmative-neutral)
}

.display::-webkit-scrollbar {
    width: 8px;
}

.display::-webkit-scrollbar-track {
    background: #f5f5f5;
    border-radius: 4px;
}

.display::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 4px;
    border: 2px solid #f5f5f5;
}

/* Fixed-size argument node with scrollbar for content */
.argument-node.expanded .display,
.argument-node.pinned .display {
    max-height: 300px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--neutral-light) var(--neutral-dark);
}

/* Style the scrollbar for WebKit browsers */
.argument-node.expanded .display::-webkit-scrollbar,
.argument-node.pinned .display::-webkit-scrollbar {
    width: 8px;
}

.argument-node.expanded .display::-webkit-scrollbar-track,
.argument-node.pinned .display::-webkit-scrollbar-track {
    background: var(--neutral-light);
    border-radius: 4px;
}

.argument-node.expanded .display::-webkit-scrollbar-thumb,
.argument-node.pinned .display::-webkit-scrollbar-thumb {
    background-color: var(--neutral-light);
    border-radius: 4px;
    border: 2px solid var(--neutral-light);
}

/* Ensure the content has proper padding inside the scrollable area */
.argument-node.expanded .display .short-argument,
.argument-node.pinned .display .short-argument {
    padding: 10px;
    margin-bottom: 0;
}

/* Ensure content within the display area has proper padding */
.scrollable-content {
    padding: 10px;
}

/* Ensure the argument buttons container has proper styling */
.argument-buttons-container {
    width: 100%; /* Take full width */
    padding: 8px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
}

/* Hover Card Styles */
.hover-card {
    position: fixed;
    width: 440px;
    max-height: 400px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgb(0 0 0 / 30%);
    z-index: 1000;
    overflow: hidden;
    transform-origin: top left;

    /* Ensure it's not affected by the SVG zoom */
    transform: scale(1) !important;
    pointer-events: auto;
    animation: hover-card-appear 0.2s ease-out;
}

@keyframes hover-card-appear {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.hover-card-content {
    max-height: 360px;
    overflow-y: auto;
    padding: 20px;
    scrollbar-width: thin;
    scrollbar-color: #ccc #f5f5f5;
    font-family: "Lexend Deca", sans-serif;
    line-height: 1.5;
}

.hover-card-content::-webkit-scrollbar {
    width: 8px;
}

.hover-card-content::-webkit-scrollbar-track {
    background: #f5f5f5;
    border-radius: 4px;
}

.hover-card-content::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 4px;
    border: 2px solid #f5f5f5;
}

.hover-card-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f3f4f6;
    color: #4b5563;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    z-index: 2;
    line-height: 1;
}

.hover-card-close:hover {
    background-color: #e5e7eb;
    color: #1f2937;
}

.hover-card-citation {
    border-top: 1px solid #eee;
    padding-top: 10px;
    margin-top: 10px;
    font-size: 0.875em;
    color: #4b5563;
}

/* Ensure the hover card is not affected by SVG transforms */
.hover-cards-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

/* Update the circle-content class to be a rounded rectangle instead */
.circle-content {
    width: 160px; /* Double the width (original was 60px) */
    height: 80px; /* Keep the same height */
    border-radius: 8px; /* Rounded corners instead of 50% */
    background-color: var(--bg-medium);
    border: 2px solid var(--bg-medium);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px var(--bg-dark);
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    padding: 2px;
}

/* Hover effect for the rounded rectangle */
.circle-content:hover {
    transform: scale(1.05);
}

.year-label {
    font-family: var(--font-family-main), serif;
    font-size: 14px;
    color: var(--standard-text);
    font-weight: 500;
    text-align: center;
    line-height: 1;
}

.connection-label {
    font-family: var(--font-family-labels), serif;
    font-size: 18px;
    font-weight: 500;
    fill: #333;
}

.hover-tooltip {
    position: initial;
    top: 40px;
    left: -150px;
    bottom: auto;
    z-index: 1000;
    background-color: var(--primary-lightest);
    padding: 8px 12px;
    border-radius: 6px;
    font-family: var(--font-family-labels), serif;
    font-size: 14px;
    font-weight: 500;
    color: var(--standard-text);
    box-shadow: 0 1px 3px var(--bg-dark);
    pointer-events: none;
    display: flex;
    align-items: center;
    max-width: 250px;
}

@media (max-width: 768px) {
    .argument-framework-pane {
        margin-top: 45px;
        height: 100%;
    }
}