* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: #f0f0f0;
}

.controls {
    padding: 20px;
    background-color: #333;
    display: flex;
    gap: 10px;
}

.controls button {
    padding: 10px 20px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
}

.controls button:hover {
    background-color: #45a049;
}

#canvas {
    position: relative;
    width: 100%;
    height: calc(100vh - 80px);
    background-color: white;
    overflow: auto;
}

#connectionSvg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

#groups {
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 2;
}

.letter-group {
    position: absolute;
    display: inline-flex;
    align-items: center;
    gap: 0;
    padding: 8px 12px;
    background-color: #e8f4f8;
    border: 2px solid #2196F3;
    border-radius: 8px;
    cursor: ns-resize;
    font-size: 18px;
    font-weight: bold;
    color: #1976D2;
    user-select: none;
    transition: all 0.2s;
}

.letter-arrow {
    font-size: 14px;
    color: #999;
    margin: 0 4px;
    font-weight: normal;
}

.delete-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    background-color: #f44336;
    color: white;
    border-radius: 50%;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: all 0.2s;
    opacity: 0;
    visibility: hidden;
}

.letter-group:hover .delete-btn {
    opacity: 1;
    visibility: visible;
}


.delete-btn:hover {
    background-color: #d32f2f;
    transform: scale(1.1);
}

.letter-group:hover {
    background-color: #d0e9f3;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.letter-group.selected {
    border-color: #ff5722;
    background-color: #ffe0d6;
}

.letter-group.dragging {
    opacity: 0.7;
    cursor: ns-resize;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.letter-group.first-group {
    cursor: default;
    background-color: #f0f7fa;
}

.letter-group.first-group:hover {
    background-color: #e3f2f7;
}

.connection-line {
    stroke: #666;
    stroke-width: 2;
    fill: none;
    marker-end: url(#arrowhead);
}

.level-line {
    stroke: #ddd;
    stroke-width: 1;
    stroke-dasharray: 5, 5;
    opacity: 0.6;
}

.level-text {
    fill: #999;
    font-size: 14px;
    font-weight: bold;
    font-family: Arial, sans-serif;
    pointer-events: none;
}

.connection-point {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: #2196F3;
    border-radius: 50%;
    z-index: 3;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1000;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.modal-content h3 {
    margin-bottom: 20px;
    color: #333;
}

.modal-content label {
    display: block;
    margin-bottom: 10px;
    color: #555;
}

.label-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.label-container label {
    margin-bottom: 0;
}

.tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background-color: #e0e0e0;
    border-radius: 50%;
    color: #666;
    font-size: 12px;
    font-weight: bold;
    cursor: help;
    transition: background-color 0.2s;
}

.tooltip-icon:hover {
    background-color: #2196F3;
    color: white;
}

.tooltip-popup {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px;
    padding: 8px 12px;
    background-color: #333;
    color: white;
    font-size: 12px;
    border-radius: 4px;
    white-space: nowrap;
    max-width: 250px;
    white-space: normal;
    z-index: 1001;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.tooltip-popup::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #333;
}

.modal-content input,
.modal-content select {
    width: 100%;
    padding: 8px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.modal-content .button-group {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.modal-content button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.modal-content .btn-primary {
    background-color: #2196F3;
    color: white;
}

.modal-content .btn-secondary {
    background-color: #ccc;
    color: #333;
}

.modal-content .btn-danger {
    background-color: #f44336;
    color: white;
}

.modal-content .btn-danger:hover {
    background-color: #d32f2f;
}

.modal-content button:hover {
    opacity: 0.9;
}

/* Info modal styles */
.info-content {
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.info-content h3 {
    margin-bottom: 20px;
    color: #2196F3;
    font-size: 24px;
}

.info-content h4 {
    margin-top: 20px;
    margin-bottom: 10px;
    color: #333;
    font-size: 18px;
}

.info-content p {
    margin-bottom: 15px;
    line-height: 1.6;
    color: #555;
}

.info-content ul, .info-content ol {
    margin-left: 20px;
    margin-bottom: 15px;
    line-height: 1.8;
    color: #555;
}

.info-content li {
    margin-bottom: 8px;
}

.info-content strong {
    color: #333;
    font-weight: 600;
}

.info-content .close-info {
    margin-top: 20px;
    padding: 10px 30px;
    width: auto;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

#shareButton {
    background-color: #9C27B0;
}

#shareButton:hover {
    background-color: #7B1FA2;
}

#infoButton {
    background-color: #2196F3;
}

#infoButton:hover {
    background-color: #1976D2;
}

.inline-edit-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.inline-edit-input {
    border: none;
    background: rgba(255, 255, 255, 0.9);
    font-size: 18px;
    font-weight: bold;
    color: #1976D2;
    text-align: center;
    padding: 2px 4px;
    margin: 0;
    outline: 2px solid #ff5722;
    border-radius: 4px;
    font-family: Arial, sans-serif;
    text-transform: uppercase;
    width: 60px;
}